From 093632822d37a167f0bca876dab5305be011c24f Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Wed, 3 Apr 2019 20:21:33 +0530 Subject: [PATCH 1/6] Cef 3538 integration (#1) * CEF 3202 Mac * CEF 3202 * Complted Windows 32 build using Visual Studio 15 * Updated CEF version to 3.3497.1836.gb472a8d * updated CEF to 3.3538.1841.gdcdb070 * Updating gyp configs according to cef/cef_paths2.gypi in CEF-3.3538.1846.g678fa78 * fixing compiler warnings and linking errors * Disabled web-security to enable file:/// resource servicing, those were blocked by chromium for being cross origin. For file:// resource, hostnames are considered different despite pointing to same host * Corrected CEF url --- Gruntfile.js | 6 +- appshell.gyp | 36 ++------- appshell/appshell_extension_handler.h | 2 +- appshell/cefclient_mac.mm | 7 +- appshell/cefclient_win.cpp | 1 - appshell/client_app.h | 10 ++- appshell/client_app_delegates.cpp | 2 +- appshell/client_handler.cpp | 61 -------------- appshell/client_handler.h | 21 +---- appshell/command_callbacks.h | 2 +- appshell/update.cpp | 2 +- appshell_paths.gypi | 46 +++++++---- common.gypi | 112 +------------------------- package.json | 2 +- tasks/setup.js | 6 +- 15 files changed, 63 insertions(+), 253 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 61b57d255..260030e1f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -27,7 +27,7 @@ module.exports = function (grunt) { var common = require("./tasks/common")(grunt), platform = common.platform(), staging, - cef_version = "3.2623.1402"; + cef_version = "3.3538.1846.g678fa78"; if (platform === "mac") { staging = "installer/mac/staging/<%= build.name %>.app/Contents"; @@ -37,9 +37,7 @@ module.exports = function (grunt) { staging = "installer/linux/debian/package-root/opt/brackets"; } - if (platform === "mac") { - cef_version = "3.2704.1434"; - } else if (platform === "linux") { + if (platform === "linux") { cef_version = "3.2785.1487"; } diff --git a/appshell.gyp b/appshell.gyp index 366557118..bb0576bd3 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -51,6 +51,7 @@ ], 'defines': [ 'USING_CEF_SHARED', + 'WRAPING_CEF_SHARED', ], 'include_dirs': [ '.', @@ -274,16 +275,6 @@ '${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/' ], }, - { - 'postbuild_name': 'Fix Framework Link', - 'action': [ - 'install_name_tool', - '-change', - '@executable_path/<(framework_name)', - '@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)', - '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' - ], - }, { # Copy the entire "node-core" directory into the same location as the "www" # directory will end up. Note that the ".." in the path is necessary because @@ -304,22 +295,6 @@ '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Brackets-node', ], }, - { - # This postbuid step is responsible for creating the following - # helpers: - # - # <(appname) Helper EH.app and <(appname) Helper NP.app are created - # from <(appname) Helper.app. - # - # The EH helper is marked for an executable heap. The NP helper - # is marked for no PIE (ASLR). - 'postbuild_name': 'Make More Helpers', - 'action': [ - 'tools/make_more_helpers.sh', - 'Frameworks', - '<(appname)', - ], - }, ], 'link_settings': { 'libraries': [ @@ -444,6 +419,7 @@ 'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9', 'defines': [ 'USING_CEF_SHARED', + 'WRAPPING_CEF_SHARED', ], 'configurations': { 'Common_Base': { @@ -459,6 +435,7 @@ '<@(includes_common)', '<@(includes_capi)', '<@(includes_wrapper)', + '<@(libcef_dll_wrapper_sources_base)', '<@(libcef_dll_wrapper_sources_common)', ], 'xcode_settings': { @@ -521,6 +498,7 @@ ], 'defines': [ 'USING_CEF_SHARED', + 'WRAPING_CEF_SHARED', ], 'include_dirs': [ '.', @@ -570,11 +548,11 @@ # (DYLIB_INSTALL_NAME_BASE) relative to the main executable # (chrome). A different relative path needs to be used in # appshell_helper_app. - 'postbuild_name': 'Fix Framework Link', + 'postbuild_name': 'Fix Framework Link for Brackets Helper', 'action': [ 'install_name_tool', '-change', - '@executable_path/<(framework_name)', + '@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)', '@executable_path/../../../../Frameworks/<(framework_name).framework/<(framework_name)', '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' ], @@ -628,4 +606,4 @@ }, }], ], -} \ No newline at end of file +} diff --git a/appshell/appshell_extension_handler.h b/appshell/appshell_extension_handler.h index 588f42bbf..48138d3bf 100644 --- a/appshell/appshell_extension_handler.h +++ b/appshell/appshell_extension_handler.h @@ -157,7 +157,7 @@ class AppShellExtensionHandler : public CefV8Handler { CefRefPtr object, const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { + CefString& exception) OVERRIDE { // The only messages that are handled here is getElapsedMilliseconds(), // GetCurrentLanguage(), GetApplicationSupportDirectory(), and GetRemoteDebuggingPort(). diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 09eb5e61a..9a0539734 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -554,7 +554,7 @@ - (void)cleanup:(id)window { // BOBNOTE: Consider moving the AppDelegate interface into its own .h file // Receives notifications from the application. Will delete itself when done. -@interface ClientAppDelegate : NSObject +@interface ClientAppDelegate : NSObject { ClientWindowDelegate *delegate; ClientMenuDelegate *menuDelegate; @@ -680,8 +680,6 @@ - (void)createApp:(id)object { CefWindowInfo window_info; CefBrowserSettings settings; - settings.web_security = STATE_DISABLED; - // Necessary to enable document.executeCommand("paste") settings.javascript_access_clipboard = STATE_ENABLED; settings.javascript_dom_paste = STATE_ENABLED; @@ -827,11 +825,12 @@ int main(int argc, char* argv[]) { // Initialize the ClientApplication instance. [ClientApplication sharedApplication]; - NSObject* delegate = [[ClientAppDelegate alloc] init]; + NSObject* delegate = [[ClientAppDelegate alloc] init]; [NSApp setDelegate:delegate]; // Parse command line arguments. CefRefPtr cmdLine = CefCommandLine::CreateCommandLine(); + cmdLine->AppendSwitch(client::switches::kUniversalAccessFromFileUrlsAllowed); cmdLine->InitFromArgv(argc, argv); CefSettings settings; diff --git a/appshell/cefclient_win.cpp b/appshell/cefclient_win.cpp index a53ceb07a..0de65aded 100644 --- a/appshell/cefclient_win.cpp +++ b/appshell/cefclient_win.cpp @@ -13,7 +13,6 @@ #include "include/cef_version.h" #include "include/cef_browser.h" #include "include/cef_frame.h" -#include "include/cef_runnable.h" #include "client_handler.h" #include "config.h" #include "appshell/browser/resource.h" diff --git a/appshell/client_app.h b/appshell/client_app.h index f1a64940c..fad4a128f 100644 --- a/appshell/client_app.h +++ b/appshell/client_app.h @@ -20,7 +20,7 @@ class ClientApp : public CefApp, // Interface for renderer delegates. All RenderDelegates must be returned via // CreateRenderDelegates. Do not perform work in the RenderDelegate // constructor. See CefRenderProcessHandler for documentation. - class RenderDelegate : public virtual CefBase { + class RenderDelegate : public virtual CefBaseRefCounted { public: virtual void OnRenderThreadCreated(CefRefPtr app, CefRefPtr extra_info) {} @@ -93,11 +93,11 @@ class ClientApp : public CefApp, static void CreateRenderDelegates(RenderDelegateSet& delegates); // Registers custom schemes. Implemented in client_app_delegates. - static void RegisterCustomSchemes(CefRefPtr registrar); + static void RegisterCustomSchemes(CefRawPtr registrar); // CefApp methods. virtual void OnRegisterCustomSchemes( - CefRefPtr registrar) OVERRIDE { + CefRawPtr registrar) OVERRIDE { RegisterCustomSchemes(registrar); } virtual CefRefPtr GetRenderProcessHandler() @@ -121,6 +121,10 @@ class ClientApp : public CefApp, CefRefPtr browser, CefProcessId source_process, CefRefPtr message) OVERRIDE; + virtual void OnBeforeCommandLineProcessing(const CefString& process_type,CefRefPtr command_line) override + { + command_line->AppendSwitch("--disable-web-security"); + } // Set of supported RenderDelegates. RenderDelegateSet render_delegates_; diff --git a/appshell/client_app_delegates.cpp b/appshell/client_app_delegates.cpp index f8345d852..a093b358c 100644 --- a/appshell/client_app_delegates.cpp +++ b/appshell/client_app_delegates.cpp @@ -9,5 +9,5 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { } // static -void ClientApp::RegisterCustomSchemes(CefRefPtr registrar) { +void ClientApp::RegisterCustomSchemes(CefRawPtr registrar) { } diff --git a/appshell/client_handler.cpp b/appshell/client_handler.cpp index 83d3d8f6f..075e24810 100644 --- a/appshell/client_handler.cpp +++ b/appshell/client_handler.cpp @@ -205,9 +205,7 @@ bool ClientHandler::OnDragEnter(CefRefPtr browser, void ClientHandler::OnLoadStart(CefRefPtr browser, CefRefPtr frame - #ifdef OS_LINUX ,TransitionType transition_type - #endif ) { CEF_REQUIRE_UI_THREAD(); @@ -280,65 +278,6 @@ void ClientHandler::OnLoadingStateChange(CefRefPtr browser, SetNavState(canGoBack, canGoForward); } -bool ClientHandler::OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) { - // Don't write the message to a console.log file. Instead, we'll just - // return false here so the message gets written to the console (output window - // in xcode, or console window in dev tools) - -/* - CEF_REQUIRE_UI_THREAD(); - - bool first_message; - std::string logFile; - - { - AutoLock lock_scope(this); - - first_message = m_LogFile.empty(); - if (first_message) { - std::stringstream ss; - ss << AppGetWorkingDirectory(); -#if defined(OS_WIN) - ss << "\\"; -#else - ss << "/"; -#endif - ss << "console.log"; - m_LogFile = ss.str(); - } - logFile = m_LogFile; - } - - FILE* file = fopen(logFile.c_str(), "a"); - if (file) { - std::stringstream ss; - ss << "Message: " << std::string(message) << "\r\nSource: " << - std::string(source) << "\r\nLine: " << line << - "\r\n-----------------------\r\n"; - fputs(ss.str().c_str(), file); - fclose(file); - - if (first_message) - SendNotification(NOTIFY_CONSOLE_MESSAGE); - } -*/ - return false; -} - -bool ClientHandler::OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) { - // Allow geolocation access from all websites. - // TODO: What does ref app do? - callback->Continue(true); - return true; -} - void ClientHandler::OnBeforeContextMenu( CefRefPtr browser, CefRefPtr frame, diff --git a/appshell/client_handler.h b/appshell/client_handler.h index 7c67a3598..774885b7f 100644 --- a/appshell/client_handler.h +++ b/appshell/client_handler.h @@ -31,13 +31,12 @@ class ClientHandler : public CefClient, public CefRequestHandler, public CefDisplayHandler, public CefKeyboardHandler, - public CefGeolocationHandler, public CefContextMenuHandler { public: // Interface for process message delegates. Do not perform work in the // RenderDelegate constructor. - class ProcessMessageDelegate : public virtual CefBase { + class ProcessMessageDelegate : public virtual CefBaseRefCounted { public: // Called when a process message is received. Return true if the message was // handled and should not be passed on to other handlers. @@ -57,7 +56,7 @@ class ClientHandler : public CefClient, // Interface for request handler delegates. Do not perform work in the // RequestDelegate constructor. - class RequestDelegate : public virtual CefBase { + class RequestDelegate : public virtual CefBaseRefCounted { public: // Called to retrieve a resource handler. virtual CefRefPtr GetResourceHandler( @@ -94,9 +93,6 @@ class ClientHandler : public CefClient, virtual CefRefPtr GetDisplayHandler() OVERRIDE { return this; } - virtual CefRefPtr GetGeolocationHandler() OVERRIDE { - return this; - } virtual CefRefPtr GetContextMenuHandler() OVERRIDE { return this; } @@ -135,9 +131,7 @@ virtual bool OnBeforePopup(CefRefPtr browser, // CefLoadHandler methods virtual void OnLoadStart(CefRefPtr browser, CefRefPtr frame - #ifdef OS_LINUX ,TransitionType transition_type - #endif ) OVERRIDE; virtual void OnLoadEnd(CefRefPtr browser, CefRefPtr frame, @@ -164,17 +158,6 @@ virtual bool OnBeforePopup(CefRefPtr browser, const CefString& url) OVERRIDE; virtual void OnTitleChange(CefRefPtr browser, const CefString& title) OVERRIDE; - virtual bool OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) OVERRIDE; - - // CefGeolocationHandler methods - virtual bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) OVERRIDE; // CefContextMenuHandler methods virtual void OnBeforeContextMenu(CefRefPtr browser, diff --git a/appshell/command_callbacks.h b/appshell/command_callbacks.h index 709797c48..8ff25fe51 100644 --- a/appshell/command_callbacks.h +++ b/appshell/command_callbacks.h @@ -53,7 +53,7 @@ const ExtensionString EDIT_SELECT_ALL = "edit.selectAll"; #endif // Base CommandCallback class -class CommandCallback : public CefBase { +class CommandCallback : public CefBaseRefCounted { public: // Called when the command is complete. When handled=true, the command diff --git a/appshell/update.cpp b/appshell/update.cpp index e3fc06acd..41f401a49 100644 --- a/appshell/update.cpp +++ b/appshell/update.cpp @@ -62,4 +62,4 @@ int32 ParseCommandLineParamsJSON(CefString &updateArgs, CefRefPtr@(change_mach_o_flags_options)', - ], - }, - ], - 'conditions': [ - ['asan==1', { - 'variables': { - 'asan_saves_file': 'asan.saves', - }, - 'xcode_settings': { - 'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)', - }, - }], - ], - 'target_conditions': [ - ['mac_pie==1 and release_valgrind_build==0', { - # Turn on position-independence (ASLR) for executables. When - # PIE is on for the Chrome executables, the framework will - # also be subject to ASLR. - # Don't do this when building for Valgrind, because Valgrind - # doesn't understand slide. TODO: Make Valgrind on Mac OS X - # understand slide, and get rid of the Valgrind check. - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-Wl,-pie', # Position-independent executable (MH_PIE) - ], - }, - }], - ], - }], - ['(_type=="executable" or _type=="shared_library" or \ - _type=="loadable_module") and mac_strip!=0', { - 'target_conditions': [ - ['mac_real_dsym == 1', { - # To get a real .dSYM bundle produced by dsymutil, set the - # debug information format to dwarf-with-dsym. Since - # strip_from_xcode will not be used, set Xcode to do the - # stripping as well. - 'configurations': { - 'Release_Base': { - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'target_conditions': [ - ['_type=="shared_library" or _type=="loadable_module"', { - # The Xcode default is to strip debugging symbols - # only (-S). Local symbols should be stripped as - # well, which will be handled by -x. Xcode will - # continue to insert -S when stripping even when - # additional flags are added with STRIPFLAGS. - 'STRIPFLAGS': '-x', - }], # _type=="shared_library" or _type=="loadable_module"' - ], # target_conditions - }, # xcode_settings - }, # configuration "Release" - }, # configurations - }, { # mac_real_dsym != 1 - # To get a fast fake .dSYM bundle, use a post-build step to - # produce the .dSYM and strip the executable. strip_from_xcode - # only operates in the Release configuration. - 'postbuilds': [ - { - 'variables': { - # Define strip_from_xcode in a variable ending in _path - # so that gyp understands it's a path and performs proper - # relativization during dict merging. - 'strip_from_xcode_path': 'mac/strip_from_xcode' - }, - 'postbuild_name': 'Strip If Needed', - 'action': ['scripts/strip_from_xcode.sh'] - }, - ], # postbuilds - }], # mac_real_dsym - ], # target_conditions - }], # (_type=="executable" or _type=="shared_library" or - # _type=="loadable_module") and mac_strip!=0 - ], # target_conditions }, # target_defaults }], # OS=="mac" ['OS=="ios"', { diff --git a/package.json b/package.json index b4af707fe..7442488ba 100644 --- a/package.json +++ b/package.json @@ -28,4 +28,4 @@ "install": "", "postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'" } -} \ No newline at end of file +} diff --git a/tasks/setup.js b/tasks/setup.js index 381fe2fbc..464bd71fc 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -384,10 +384,10 @@ module.exports = function (grunt) { var memo = path.resolve(process.cwd(), "deps/cef/" + zipName + ".txt"), permissionsPromise; - if (platform === "mac") { + /*if (platform === "mac") { // FIXME figure out how to use fs.chmod to only do additive mode u+x permissionsPromise = exec("chmod u+x deps/cef/tools/*"); - } else { + } else */{ permissionsPromise = q.resolve(); } @@ -688,4 +688,4 @@ module.exports = function (grunt) { } else { grunt.registerTask("setup", ["cef", "node", "node-check", "icu", "create-project"]); } -}; \ No newline at end of file +}; From 3a1452c83dac1fbe8eea9d3cc4d2a894913b038a Mon Sep 17 00:00:00 2001 From: gautam0217 Date: Fri, 12 Apr 2019 00:12:10 +0530 Subject: [PATCH 2/6] Linux setup --- Gruntfile.js | 8 +++-- appshell/appshell_extensions_platform.cpp | 5 ++-- appshell/browser/client_app_browser.h | 2 +- appshell/browser/client_handler.cc | 30 ++----------------- appshell/browser/client_handler.h | 18 +---------- appshell/browser/print_handler_gtk.cc | 5 +++- appshell/browser/print_handler_gtk.h | 11 ++++--- appshell/browser/root_window_manager.cc | 1 + appshell/cefclient.cpp | 2 +- appshell/cefclient_gtk.cc | 2 -- appshell/common/client_app.cc | 2 +- appshell/common/client_app.h | 6 ++-- .../common/client_app_delegates_common.cc | 2 +- appshell/renderer/client_app_renderer.h | 4 +-- 14 files changed, 34 insertions(+), 64 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 260030e1f..ce33ac709 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -38,7 +38,7 @@ module.exports = function (grunt) { } if (platform === "linux") { - cef_version = "3.2785.1487"; + cef_version = "3.3683.1920.g9f41a27"; } grunt.initConfig({ @@ -251,6 +251,10 @@ module.exports = function (grunt) { "natives_blob.bin", "snapshot_blob.bin", "chrome-sandbox", + "swiftshader/*", + "libEGL.so", + "libGLESv2.so", + "v8_context_snapshot.bin" ], "dest" : "<%= build.staging %>" }, @@ -323,7 +327,7 @@ module.exports = function (grunt) { } }, "cef": { - "url" : "http://s3.amazonaws.com/files.brackets.io/cef", + "url" : "http://localhost:8000", "version" : cef_version }, "node": { diff --git a/appshell/appshell_extensions_platform.cpp b/appshell/appshell_extensions_platform.cpp index 2337552c7..a3a929e96 100644 --- a/appshell/appshell_extensions_platform.cpp +++ b/appshell/appshell_extensions_platform.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #ifdef OS_LINUX #include "appshell/browser/main_context.h" @@ -71,7 +72,7 @@ void CharSetEncode::operator()(std::string &contents) { if(error != U_BUFFER_OVERFLOW_ERROR) { throw "Unable to convert encoding"; } - std::auto_ptr target(new char[targetLen + 1]()); + std::unique_ptr target(new char[targetLen + 1]()); error = U_ZERO_ERROR; ustr.extract(target.get(), targetLen, m_conv, error); target.get()[targetLen] = '\0'; @@ -87,7 +88,7 @@ void DecodeContents(std::string &contents, const std::string& encoding) { if(status != U_BUFFER_OVERFLOW_ERROR) { throw "Unable to decode contents"; } - std::auto_ptr target(new char[targetLen + 1]()); + std::unique_ptr target(new char[targetLen + 1]()); status = U_ZERO_ERROR; ustr.extract(target.get(), targetLen, NULL, status); target.get()[targetLen] = '\0'; diff --git a/appshell/browser/client_app_browser.h b/appshell/browser/client_app_browser.h index 0b58f0d22..6663ba226 100644 --- a/appshell/browser/client_app_browser.h +++ b/appshell/browser/client_app_browser.h @@ -19,7 +19,7 @@ class ClientAppBrowser : public ClientApp, // Interface for browser delegates. All Delegates must be returned via // CreateDelegates. Do not perform work in the Delegate // constructor. See CefBrowserProcessHandler for documentation. - class Delegate : public virtual CefBase { + class Delegate : public virtual CefBaseRefCounted { public: virtual void OnBeforeCommandLineProcessing( CefRefPtr app, diff --git a/appshell/browser/client_handler.cc b/appshell/browser/client_handler.cc index 81d5e1830..884c2607e 100644 --- a/appshell/browser/client_handler.cc +++ b/appshell/browser/client_handler.cc @@ -272,32 +272,6 @@ void ClientHandler::OnFullscreenModeChange(CefRefPtr browser, NotifyFullscreen(fullscreen); } -bool ClientHandler::OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) { - CEF_REQUIRE_UI_THREAD(); - - // FILE* file = fopen(console_log_file_.c_str(), "a"); - // if (file) { - // std::stringstream ss; - // ss << "Message: " << message.ToString() << NEWLINE << - // "Source: " << source.ToString() << NEWLINE << - // "Line: " << line << NEWLINE << - // "-----------------------" << NEWLINE; - // fputs(ss.str().c_str(), file); - // fclose(file); - - // if (first_console_message_) { - // test_runner::Alert( - // browser, "Console messages written to \"" + console_log_file_ + "\""); - // first_console_message_ = false; - // } - // } - - return false; -} - void ClientHandler::OnBeforeDownload( CefRefPtr browser, CefRefPtr download_item, @@ -347,7 +321,6 @@ void ClientHandler::OnDraggableRegionsChanged( NotifyDraggableRegions(regions); } -#endif bool ClientHandler::OnRequestGeolocationPermission( CefRefPtr browser, @@ -360,6 +333,7 @@ bool ClientHandler::OnRequestGeolocationPermission( callback->Continue(true); return true; } +#endif bool ClientHandler::OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, @@ -577,6 +551,7 @@ bool ClientHandler::OnCertificateError( CefRefPtr callback) { CEF_REQUIRE_UI_THREAD(); +#if 0 CefRefPtr subject = ssl_info->GetSubject(); CefRefPtr issuer = ssl_info->GetIssuer(); @@ -622,6 +597,7 @@ bool ClientHandler::OnCertificateError( // Load the error page. LoadErrorPage(browser->GetMainFrame(), request_url, cert_error, ss.str()); +#endif return false; // Cancel the request. } diff --git a/appshell/browser/client_handler.h b/appshell/browser/client_handler.h index 13e32e621..f260fe354 100644 --- a/appshell/browser/client_handler.h +++ b/appshell/browser/client_handler.h @@ -40,7 +40,6 @@ class ClientHandler : public CefDisplayHandler, public CefDownloadHandler, public CefDragHandler, - public CefGeolocationHandler, public CefKeyboardHandler, public CefLifeSpanHandler, public CefLoadHandler, @@ -111,9 +110,6 @@ class ClientHandler : } #endif - CefRefPtr GetGeolocationHandler() OVERRIDE { - return this; - } CefRefPtr GetKeyboardHandler() OVERRIDE { return this; } @@ -159,11 +155,6 @@ class ClientHandler : const CefString& title) OVERRIDE; void OnFullscreenModeChange(CefRefPtr browser, bool fullscreen) OVERRIDE; - bool OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) OVERRIDE; - // CefDownloadHandler methods void OnBeforeDownload( CefRefPtr browser, @@ -190,13 +181,6 @@ class ClientHandler : const std::vector& regions) OVERRIDE; #endif - // CefGeolocationHandler methods - bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) OVERRIDE; - // CefKeyboardHandler methods bool OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, @@ -235,7 +219,7 @@ class ClientHandler : bool OnBeforeBrowse(CefRefPtr browser, CefRefPtr frame, CefRefPtr request, - bool is_redirect) OVERRIDE; + bool is_redirect); bool OnOpenURLFromTab( CefRefPtr browser, CefRefPtr frame, diff --git a/appshell/browser/print_handler_gtk.cc b/appshell/browser/print_handler_gtk.cc index 377e30289..460018cf7 100644 --- a/appshell/browser/print_handler_gtk.cc +++ b/appshell/browser/print_handler_gtk.cc @@ -286,6 +286,7 @@ void ClientPrintHandlerGtk::OnPrintStart(CefRefPtr browser) { } void ClientPrintHandlerGtk::OnPrintSettings( + CefRefPtr browser, CefRefPtr settings, bool get_defaults) { if (get_defaults) { @@ -357,6 +358,7 @@ void ClientPrintHandlerGtk::OnPrintSettings( } bool ClientPrintHandlerGtk::OnPrintDialog( + CefRefPtr browser, bool has_selection, CefRefPtr callback) { dialog_callback_ = callback; @@ -398,6 +400,7 @@ bool ClientPrintHandlerGtk::OnPrintDialog( } bool ClientPrintHandlerGtk::OnPrintJob( + CefRefPtr browser, const CefString& document_name, const CefString& pdf_file_path, CefRefPtr callback) { @@ -424,7 +427,7 @@ bool ClientPrintHandlerGtk::OnPrintJob( return true; } -void ClientPrintHandlerGtk::OnPrintReset() { +void ClientPrintHandlerGtk::OnPrintReset( CefRefPtr browser) { if (dialog_) { gtk_widget_destroy(dialog_); dialog_ = NULL; diff --git a/appshell/browser/print_handler_gtk.h b/appshell/browser/print_handler_gtk.h index 11618e67d..1d7b55bea 100644 --- a/appshell/browser/print_handler_gtk.h +++ b/appshell/browser/print_handler_gtk.h @@ -20,15 +20,18 @@ class ClientPrintHandlerGtk : public CefPrintHandler { // CefPrintHandler methods. void OnPrintStart(CefRefPtr browser) OVERRIDE; - void OnPrintSettings(CefRefPtr settings, + void OnPrintSettings(CefRefPtr browser, + CefRefPtr settings, bool get_defaults) OVERRIDE; bool OnPrintDialog( + CefRefPtr browser, bool has_selection, CefRefPtr callback) OVERRIDE; - bool OnPrintJob(const CefString& document_name, + bool OnPrintJob(CefRefPtr browser, + const CefString& document_name, const CefString& pdf_file_path, - CefRefPtr callback) OVERRIDE; - void OnPrintReset() OVERRIDE; + CefRefPtr callback); + void OnPrintReset(CefRefPtr browser) OVERRIDE; CefSize GetPdfPaperSize(int device_units_per_inch) OVERRIDE; private: diff --git a/appshell/browser/root_window_manager.cc b/appshell/browser/root_window_manager.cc index 92a735dbd..c1b4707a4 100644 --- a/appshell/browser/root_window_manager.cc +++ b/appshell/browser/root_window_manager.cc @@ -22,6 +22,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler { bool OnBeforePluginLoad(const CefString& mime_type, const CefString& plugin_url, + bool is_main_frame, const CefString& top_origin_url, CefRefPtr plugin_info, PluginPolicy* plugin_policy) OVERRIDE { diff --git a/appshell/cefclient.cpp b/appshell/cefclient.cpp index 72777401b..eba9fc304 100644 --- a/appshell/cefclient.cpp +++ b/appshell/cefclient.cpp @@ -28,7 +28,7 @@ CefRefPtr AppGetBrowser() { CefWindowHandle AppGetMainHwnd() { if (!g_handler.get()) - return NULL; + return 0; return g_handler->GetMainHwnd(); } diff --git a/appshell/cefclient_gtk.cc b/appshell/cefclient_gtk.cc index bb45d6ce1..e4304db01 100644 --- a/appshell/cefclient_gtk.cc +++ b/appshell/cefclient_gtk.cc @@ -233,7 +233,5 @@ int RunMain(int argc, char* argv[]) { // Program entry point function. int main(int argc, char* argv[]) { - char extra_option[] ="--disable-gpu"; - argv[argc]=extra_option; ++argc; return client::RunMain(argc, argv); } diff --git a/appshell/common/client_app.cc b/appshell/common/client_app.cc index 662e2b654..3b05bf964 100644 --- a/appshell/common/client_app.cc +++ b/appshell/common/client_app.cc @@ -42,7 +42,7 @@ ClientApp::ProcessType ClientApp::GetProcessType( } void ClientApp::OnRegisterCustomSchemes( - CefRefPtr registrar) { + CefRawPtr registrar) { RegisterCustomSchemes(registrar, cookieable_schemes_); } diff --git a/appshell/common/client_app.h b/appshell/common/client_app.h index cdbbfdadd..295b564c4 100644 --- a/appshell/common/client_app.h +++ b/appshell/common/client_app.h @@ -34,12 +34,12 @@ class ClientApp : public CefApp { private: // Registers custom schemes. Implemented by cefclient in // client_app_delegates_common.cc - static void RegisterCustomSchemes(CefRefPtr registrar, - std::vector& cookiable_schemes); + static void RegisterCustomSchemes(CefRawPtr registrar, + std::vector& cookiable_schemes) /*OVERRIDE*/; // CefApp methods. void OnRegisterCustomSchemes( - CefRefPtr registrar) OVERRIDE; + CefRawPtr registrar); DISALLOW_COPY_AND_ASSIGN(ClientApp); }; diff --git a/appshell/common/client_app_delegates_common.cc b/appshell/common/client_app_delegates_common.cc index 67c091f63..9c37ea378 100644 --- a/appshell/common/client_app_delegates_common.cc +++ b/appshell/common/client_app_delegates_common.cc @@ -9,7 +9,7 @@ namespace client { // static void ClientApp::RegisterCustomSchemes( - CefRefPtr registrar, + CefRawPtr registrar, std::vector& cookiable_schemes) { // Brackets specific change. //scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes); diff --git a/appshell/renderer/client_app_renderer.h b/appshell/renderer/client_app_renderer.h index ad1048adf..05f469f6c 100644 --- a/appshell/renderer/client_app_renderer.h +++ b/appshell/renderer/client_app_renderer.h @@ -19,7 +19,7 @@ class ClientAppRenderer : public ClientApp, // Interface for renderer delegates. All Delegates must be returned via // CreateDelegates. Do not perform work in the Delegate // constructor. See CefRenderProcessHandler for documentation. - class Delegate : public virtual CefBase { + class Delegate : public virtual CefBaseRefCounted { public: virtual void OnRenderThreadCreated(CefRefPtr app, CefRefPtr extra_info) {} @@ -105,7 +105,7 @@ class ClientAppRenderer : public ClientApp, CefRefPtr frame, CefRefPtr request, NavigationType navigation_type, - bool is_redirect) OVERRIDE; + bool is_redirect); void OnContextCreated(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) OVERRIDE; From ae54e23082381130683b1a6cda5a9a356dfd5ae1 Mon Sep 17 00:00:00 2001 From: gautam0217 Date: Wed, 1 May 2019 12:11:55 +0530 Subject: [PATCH 3/6] Copy paste is working on all windows except new Brackets window even debugger window opened from it has copy paste working --- Gruntfile.js | 2 +- appshell/browser/client_handler.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ce33ac709..068a547bd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -334,7 +334,7 @@ module.exports = function (grunt) { "version" : "6.14.0" }, "icu": { - "url" : "http://s3.amazonaws.com/files.brackets.io/icu", + "url" : "http://localhost:8000", "version" : "58" }, "vsCrt": { diff --git a/appshell/browser/client_handler.cc b/appshell/browser/client_handler.cc index 884c2607e..26156f77a 100644 --- a/appshell/browser/client_handler.cc +++ b/appshell/browser/client_handler.cc @@ -367,7 +367,7 @@ bool ClientHandler::OnBeforePopup( CefRefPtr& client, CefBrowserSettings& settings, bool* no_javascript_access) { - CEF_REQUIRE_IO_THREAD(); + CEF_REQUIRE_UI_THREAD(); // Return true to cancel the popup window. return !CreatePopupWindow(browser, false, popupFeatures, windowInfo, client, From 2e5cae10dc8687a6c13c499d3a5dac7ac0ada06f Mon Sep 17 00:00:00 2001 From: gautam0217 Date: Wed, 1 May 2019 12:55:02 +0530 Subject: [PATCH 4/6] Removing changes not relavent for Linux --- Gruntfile.js | 14 ++--- appshell.gyp | 36 +++++++++--- appshell/cefclient_mac.mm | 7 ++- appshell/cefclient_win.cpp | 1 + appshell/update.cpp | 2 +- common.gypi | 112 ++++++++++++++++++++++++++++++++++++- package.json | 2 +- tasks/setup.js | 6 +- 8 files changed, 155 insertions(+), 25 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 068a547bd..c8b78da5c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -27,7 +27,7 @@ module.exports = function (grunt) { var common = require("./tasks/common")(grunt), platform = common.platform(), staging, - cef_version = "3.3538.1846.g678fa78"; + cef_version = "3.2623.1402"; if (platform === "mac") { staging = "installer/mac/staging/<%= build.name %>.app/Contents"; @@ -37,7 +37,9 @@ module.exports = function (grunt) { staging = "installer/linux/debian/package-root/opt/brackets"; } - if (platform === "linux") { + if (platform === "mac") { + cef_version = "3.2704.1434"; + } else if (platform === "linux") { cef_version = "3.3683.1920.g9f41a27"; } @@ -251,10 +253,6 @@ module.exports = function (grunt) { "natives_blob.bin", "snapshot_blob.bin", "chrome-sandbox", - "swiftshader/*", - "libEGL.so", - "libGLESv2.so", - "v8_context_snapshot.bin" ], "dest" : "<%= build.staging %>" }, @@ -327,14 +325,14 @@ module.exports = function (grunt) { } }, "cef": { - "url" : "http://localhost:8000", + "url" : "http://s3.amazonaws.com/files.brackets.io/cef", "version" : cef_version }, "node": { "version" : "6.14.0" }, "icu": { - "url" : "http://localhost:8000", + "url" : "http://s3.amazonaws.com/files.brackets.io/icu", "version" : "58" }, "vsCrt": { diff --git a/appshell.gyp b/appshell.gyp index bb0576bd3..366557118 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -51,7 +51,6 @@ ], 'defines': [ 'USING_CEF_SHARED', - 'WRAPING_CEF_SHARED', ], 'include_dirs': [ '.', @@ -275,6 +274,16 @@ '${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/Contents/Frameworks/' ], }, + { + 'postbuild_name': 'Fix Framework Link', + 'action': [ + 'install_name_tool', + '-change', + '@executable_path/<(framework_name)', + '@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)', + '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' + ], + }, { # Copy the entire "node-core" directory into the same location as the "www" # directory will end up. Note that the ".." in the path is necessary because @@ -295,6 +304,22 @@ '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Brackets-node', ], }, + { + # This postbuid step is responsible for creating the following + # helpers: + # + # <(appname) Helper EH.app and <(appname) Helper NP.app are created + # from <(appname) Helper.app. + # + # The EH helper is marked for an executable heap. The NP helper + # is marked for no PIE (ASLR). + 'postbuild_name': 'Make More Helpers', + 'action': [ + 'tools/make_more_helpers.sh', + 'Frameworks', + '<(appname)', + ], + }, ], 'link_settings': { 'libraries': [ @@ -419,7 +444,6 @@ 'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9', 'defines': [ 'USING_CEF_SHARED', - 'WRAPPING_CEF_SHARED', ], 'configurations': { 'Common_Base': { @@ -435,7 +459,6 @@ '<@(includes_common)', '<@(includes_capi)', '<@(includes_wrapper)', - '<@(libcef_dll_wrapper_sources_base)', '<@(libcef_dll_wrapper_sources_common)', ], 'xcode_settings': { @@ -498,7 +521,6 @@ ], 'defines': [ 'USING_CEF_SHARED', - 'WRAPING_CEF_SHARED', ], 'include_dirs': [ '.', @@ -548,11 +570,11 @@ # (DYLIB_INSTALL_NAME_BASE) relative to the main executable # (chrome). A different relative path needs to be used in # appshell_helper_app. - 'postbuild_name': 'Fix Framework Link for Brackets Helper', + 'postbuild_name': 'Fix Framework Link', 'action': [ 'install_name_tool', '-change', - '@executable_path/../Frameworks/<(framework_name).framework/<(framework_name)', + '@executable_path/<(framework_name)', '@executable_path/../../../../Frameworks/<(framework_name).framework/<(framework_name)', '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}' ], @@ -606,4 +628,4 @@ }, }], ], -} +} \ No newline at end of file diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index 9a0539734..09eb5e61a 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -554,7 +554,7 @@ - (void)cleanup:(id)window { // BOBNOTE: Consider moving the AppDelegate interface into its own .h file // Receives notifications from the application. Will delete itself when done. -@interface ClientAppDelegate : NSObject +@interface ClientAppDelegate : NSObject { ClientWindowDelegate *delegate; ClientMenuDelegate *menuDelegate; @@ -680,6 +680,8 @@ - (void)createApp:(id)object { CefWindowInfo window_info; CefBrowserSettings settings; + settings.web_security = STATE_DISABLED; + // Necessary to enable document.executeCommand("paste") settings.javascript_access_clipboard = STATE_ENABLED; settings.javascript_dom_paste = STATE_ENABLED; @@ -825,12 +827,11 @@ int main(int argc, char* argv[]) { // Initialize the ClientApplication instance. [ClientApplication sharedApplication]; - NSObject* delegate = [[ClientAppDelegate alloc] init]; + NSObject* delegate = [[ClientAppDelegate alloc] init]; [NSApp setDelegate:delegate]; // Parse command line arguments. CefRefPtr cmdLine = CefCommandLine::CreateCommandLine(); - cmdLine->AppendSwitch(client::switches::kUniversalAccessFromFileUrlsAllowed); cmdLine->InitFromArgv(argc, argv); CefSettings settings; diff --git a/appshell/cefclient_win.cpp b/appshell/cefclient_win.cpp index 0de65aded..a53ceb07a 100644 --- a/appshell/cefclient_win.cpp +++ b/appshell/cefclient_win.cpp @@ -13,6 +13,7 @@ #include "include/cef_version.h" #include "include/cef_browser.h" #include "include/cef_frame.h" +#include "include/cef_runnable.h" #include "client_handler.h" #include "config.h" #include "appshell/browser/resource.h" diff --git a/appshell/update.cpp b/appshell/update.cpp index 41f401a49..e3fc06acd 100644 --- a/appshell/update.cpp +++ b/appshell/update.cpp @@ -62,4 +62,4 @@ int32 ParseCommandLineParamsJSON(CefString &updateArgs, CefRefPtr@(change_mach_o_flags_options)', + ], + }, + ], + 'conditions': [ + ['asan==1', { + 'variables': { + 'asan_saves_file': 'asan.saves', + }, + 'xcode_settings': { + 'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)', + }, + }], + ], + 'target_conditions': [ + ['mac_pie==1 and release_valgrind_build==0', { + # Turn on position-independence (ASLR) for executables. When + # PIE is on for the Chrome executables, the framework will + # also be subject to ASLR. + # Don't do this when building for Valgrind, because Valgrind + # doesn't understand slide. TODO: Make Valgrind on Mac OS X + # understand slide, and get rid of the Valgrind check. + 'xcode_settings': { + 'OTHER_LDFLAGS': [ + '-Wl,-pie', # Position-independent executable (MH_PIE) + ], + }, + }], + ], + }], + ['(_type=="executable" or _type=="shared_library" or \ + _type=="loadable_module") and mac_strip!=0', { + 'target_conditions': [ + ['mac_real_dsym == 1', { + # To get a real .dSYM bundle produced by dsymutil, set the + # debug information format to dwarf-with-dsym. Since + # strip_from_xcode will not be used, set Xcode to do the + # stripping as well. + 'configurations': { + 'Release_Base': { + 'xcode_settings': { + 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', + 'DEPLOYMENT_POSTPROCESSING': 'YES', + 'STRIP_INSTALLED_PRODUCT': 'YES', + 'target_conditions': [ + ['_type=="shared_library" or _type=="loadable_module"', { + # The Xcode default is to strip debugging symbols + # only (-S). Local symbols should be stripped as + # well, which will be handled by -x. Xcode will + # continue to insert -S when stripping even when + # additional flags are added with STRIPFLAGS. + 'STRIPFLAGS': '-x', + }], # _type=="shared_library" or _type=="loadable_module"' + ], # target_conditions + }, # xcode_settings + }, # configuration "Release" + }, # configurations + }, { # mac_real_dsym != 1 + # To get a fast fake .dSYM bundle, use a post-build step to + # produce the .dSYM and strip the executable. strip_from_xcode + # only operates in the Release configuration. + 'postbuilds': [ + { + 'variables': { + # Define strip_from_xcode in a variable ending in _path + # so that gyp understands it's a path and performs proper + # relativization during dict merging. + 'strip_from_xcode_path': 'mac/strip_from_xcode' + }, + 'postbuild_name': 'Strip If Needed', + 'action': ['scripts/strip_from_xcode.sh'] + }, + ], # postbuilds + }], # mac_real_dsym + ], # target_conditions + }], # (_type=="executable" or _type=="shared_library" or + # _type=="loadable_module") and mac_strip!=0 + ], # target_conditions }, # target_defaults }], # OS=="mac" ['OS=="ios"', { diff --git a/package.json b/package.json index 7442488ba..b4af707fe 100644 --- a/package.json +++ b/package.json @@ -28,4 +28,4 @@ "install": "", "postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'" } -} +} \ No newline at end of file diff --git a/tasks/setup.js b/tasks/setup.js index 464bd71fc..381fe2fbc 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -384,10 +384,10 @@ module.exports = function (grunt) { var memo = path.resolve(process.cwd(), "deps/cef/" + zipName + ".txt"), permissionsPromise; - /*if (platform === "mac") { + if (platform === "mac") { // FIXME figure out how to use fs.chmod to only do additive mode u+x permissionsPromise = exec("chmod u+x deps/cef/tools/*"); - } else */{ + } else { permissionsPromise = q.resolve(); } @@ -688,4 +688,4 @@ module.exports = function (grunt) { } else { grunt.registerTask("setup", ["cef", "node", "node-check", "icu", "create-project"]); } -}; +}; \ No newline at end of file From 803c146e3a5dcad9163765cb439e1adc22731d90 Mon Sep 17 00:00:00 2001 From: gautam0217 Date: Wed, 1 May 2019 19:25:55 +0530 Subject: [PATCH 5/6] Deleted more than I should have --- appshell.gyp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appshell.gyp b/appshell.gyp index 366557118..9c06ab0be 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -444,6 +444,7 @@ 'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9', 'defines': [ 'USING_CEF_SHARED', + 'WRAPPING_CEF_SHARED', ], 'configurations': { 'Common_Base': { @@ -459,6 +460,7 @@ '<@(includes_common)', '<@(includes_capi)', '<@(includes_wrapper)', + '<@(libcef_dll_wrapper_sources_base)', '<@(libcef_dll_wrapper_sources_common)', ], 'xcode_settings': { @@ -628,4 +630,5 @@ }, }], ], -} \ No newline at end of file +} + From e6d58a43b8b01a267c329e9dccabc3fa89c61640 Mon Sep 17 00:00:00 2001 From: Gautam Date: Fri, 17 May 2019 00:23:57 +0530 Subject: [PATCH 6/6] Added copy instruction for new files --- Gruntfile.js | 4 ++++ appshell.gyp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index c8b78da5c..0473fca83 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -253,6 +253,10 @@ module.exports = function (grunt) { "natives_blob.bin", "snapshot_blob.bin", "chrome-sandbox", + "libEGL.so", + "libGLESv2.so", + "swiftshader/**", + "v8_context_snapshot.bin", ], "dest" : "<%= build.staging %>" }, diff --git a/appshell.gyp b/appshell.gyp index 9c06ab0be..f7f2ead05 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -395,6 +395,10 @@ '$(BUILDTYPE)/libcef.so', '$(BUILDTYPE)/natives_blob.bin', '$(BUILDTYPE)/snapshot_blob.bin', + '$(BUILDTYPE)/libEGL.so', + '$(BUILDTYPE)/libGLESv2.so', + '$(BUILDTYPE)/swiftshader', + '$(BUILDTYPE)/v8_context_snapshot.bin', ], }, {