From 0a6fd85ac1b3c1e22a5c216e5fcbf7d192a5fc20 Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 19 Apr 2018 11:39:02 -0500 Subject: Force use of level 1 Liftetime DSE optimization on modern GCC Instead of completely disabling it. --- build/autoconf/compiler-opts.m4 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index 57a974435..d4016b609 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -183,16 +183,15 @@ if test "$GNU_CC"; then case "$CC_VERSION" in 4.*) ;; + 5.*) + ;; *) # Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko. - # Ideally, we'd use -flifetime-dse=1, but that means we'd forcefully - # enable it on optimization levels where it would otherwise not be enabled. - # So we disable it entirely. But since that would mean inconsistency with - # GCC5, which has level 1 depending on optimization level, disable it on - # GCC5 as well, because better safe than sorry. + # Instead of completely disabling this optimization on newer GCC's, + # we'll force them to use level 1 optimization with -flifetime-dse=1. # Add it first so that a mozconfig can override by setting CFLAGS/CXXFLAGS. - CFLAGS="-fno-lifetime-dse $CFLAGS" - CXXFLAGS="-fno-lifetime-dse $CXXFLAGS" + CFLAGS="-flifetime-dse=1 $CFLAGS" + CXXFLAGS="-flifetime-dse=1 $CXXFLAGS" ;; esac fi -- cgit v1.2.3 From c5a52404bd6206a481aedc61ea21f9dccf93377a Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 20 Apr 2018 08:27:35 -0500 Subject: Style fix --- build/autoconf/compiler-opts.m4 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index d4016b609..c47d792f4 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -181,9 +181,7 @@ if test "$GNU_CC"; then if test -z "$CLANG_CC"; then case "$CC_VERSION" in - 4.*) - ;; - 5.*) + 4.* | 5.*) ;; *) # Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko. -- cgit v1.2.3 From 0b2e4f1afad41e638bce2c631c7bc895ba6c0c69 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 17:39:09 +0200 Subject: moebius#217: WebExtensions - Implemented "runtime.onMessageExternal"/"onConnectExternal" https://github.com/MoonchildProductions/moebius/pull/217 --- .../components/webextensions/ExtensionChild.jsm | 28 +++- .../components/webextensions/ExtensionCommon.jsm | 3 +- .../components/webextensions/ExtensionContent.jsm | 2 +- .../webextensions/LegacyExtensionsUtils.jsm | 2 +- toolkit/components/webextensions/ext-c-runtime.js | 5 +- .../components/webextensions/schemas/runtime.json | 2 - .../webextensions/test/mochitest/mochitest.ini | 1 + .../test/mochitest/test_ext_all_apis.js | 2 + .../mochitest/test_ext_external_messaging.html | 111 ++++++++++++++++ .../mochitest/test_ext_sendmessage_reply2.html | 144 +++++++++++++++++---- .../xpcshell/test_ext_legacy_extension_context.js | 4 +- 11 files changed, 262 insertions(+), 42 deletions(-) create mode 100644 toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html diff --git a/toolkit/components/webextensions/ExtensionChild.jsm b/toolkit/components/webextensions/ExtensionChild.jsm index c953dd685..5dc4e2277 100644 --- a/toolkit/components/webextensions/ExtensionChild.jsm +++ b/toolkit/components/webextensions/ExtensionChild.jsm @@ -325,7 +325,7 @@ class Messenger { return this.sendMessage(messageManager, msg, recipient, responseCallback); } - onMessage(name) { + _onMessage(name, filter) { return new SingletonEventManager(this.context, name, callback => { let listener = { messageFilterPermissive: this.optionalFilter, @@ -333,7 +333,8 @@ class Messenger { filterMessage: (sender, recipient) => { // Ignore the message if it was sent by this Messenger. - return sender.contextId !== this.context.contextId; + return (sender.contextId !== this.context.contextId && + filter(sender, recipient)); }, receiveMessage: ({target, data: message, sender, recipient}) => { @@ -373,6 +374,14 @@ class Messenger { }).api(); } + onMessage(name) { + return this._onMessage(name, sender => sender.id === this.sender.id); + } + + onMessageExternal(name) { + return this._onMessage(name, sender => sender.id !== this.sender.id); + } + _connect(messageManager, port, recipient) { let msg = { name: port.name, @@ -407,7 +416,7 @@ class Messenger { return this._connect(messageManager, port, recipient); } - onConnect(name) { + _onConnect(name, filter) { return new SingletonEventManager(this.context, name, callback => { let listener = { messageFilterPermissive: this.optionalFilter, @@ -415,7 +424,8 @@ class Messenger { filterMessage: (sender, recipient) => { // Ignore the port if it was created by this Messenger. - return sender.contextId !== this.context.contextId; + return (sender.contextId !== this.context.contextId && + filter(sender, recipient)); }, receiveMessage: ({target, data: message, sender}) => { @@ -438,6 +448,14 @@ class Messenger { }; }).api(); } + + onConnect(name) { + return this._onConnect(name, sender => sender.id === this.sender.id); + } + + onConnectExternal(name) { + return this._onConnect(name, sender => sender.id !== this.sender.id); + } } var apiManager = new class extends SchemaAPIManager { @@ -745,7 +763,7 @@ class ExtensionPageContextChild extends BaseContext { // This is the MessageSender property passed to extension. // It can be augmented by the "page-open" hook. - let sender = {id: extension.uuid}; + let sender = {id: extension.id}; if (viewType == "tab") { sender.tabId = tabId; this.tabId = tabId; diff --git a/toolkit/components/webextensions/ExtensionCommon.jsm b/toolkit/components/webextensions/ExtensionCommon.jsm index a339fb27e..9ec84b5c7 100644 --- a/toolkit/components/webextensions/ExtensionCommon.jsm +++ b/toolkit/components/webextensions/ExtensionCommon.jsm @@ -197,10 +197,9 @@ class BaseContext { * @returns {Promise} */ sendMessage(target, messageName, data, options = {}) { - options.recipient = options.recipient || {}; + options.recipient = Object.assign({extensionId: this.extension.id}, options.recipient); options.sender = options.sender || {}; - options.recipient.extensionId = this.extension.id; options.sender.extensionId = this.extension.id; options.sender.contextId = this.contextId; diff --git a/toolkit/components/webextensions/ExtensionContent.jsm b/toolkit/components/webextensions/ExtensionContent.jsm index 9b9a02091..5bdcde6f5 100644 --- a/toolkit/components/webextensions/ExtensionContent.jsm +++ b/toolkit/components/webextensions/ExtensionContent.jsm @@ -456,7 +456,7 @@ class ContentScriptContextChild extends BaseContext { defineLazyGetter(ContentScriptContextChild.prototype, "messenger", function() { // The |sender| parameter is passed directly to the extension. - let sender = {id: this.extension.uuid, frameId: this.frameId, url: this.url}; + let sender = {id: this.extension.id, frameId: this.frameId, url: this.url}; let filter = {extensionId: this.extension.id}; let optionalFilter = {frameId: this.frameId}; diff --git a/toolkit/components/webextensions/LegacyExtensionsUtils.jsm b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm index 7632548e3..e8d276fe9 100644 --- a/toolkit/components/webextensions/LegacyExtensionsUtils.jsm +++ b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm @@ -64,7 +64,7 @@ var LegacyExtensionContext = class extends BaseContext { {value: cloneScope, enumerable: true, configurable: true, writable: true} ); - let sender = {id: targetExtension.uuid}; + let sender = {id: targetExtension.id}; let filter = {extensionId: targetExtension.id}; // Legacy addons live in the main process. Messages from other addons are // Messages from WebExtensions are sent to the main process and forwarded via diff --git a/toolkit/components/webextensions/ext-c-runtime.js b/toolkit/components/webextensions/ext-c-runtime.js index 8adca60ca..1dcac35da 100644 --- a/toolkit/components/webextensions/ext-c-runtime.js +++ b/toolkit/components/webextensions/ext-c-runtime.js @@ -9,6 +9,10 @@ function runtimeApiFactory(context) { onMessage: context.messenger.onMessage("runtime.onMessage"), + onConnectExternal: context.messenger.onConnectExternal("runtime.onConnectExternal"), + + onMessageExternal: context.messenger.onMessageExternal("runtime.onMessageExternal"), + connect: function(extensionId, connectInfo) { let name = connectInfo !== null && connectInfo.name || ""; extensionId = extensionId || extension.id; @@ -47,7 +51,6 @@ function runtimeApiFactory(context) { if (options != null && typeof options != "object") { return Promise.reject({message: "runtime.sendMessage's options argument is invalid"}); } - // TODO(robwu): Validate option keys and values when we support it. extensionId = extensionId || extension.id; let recipient = {extensionId}; diff --git a/toolkit/components/webextensions/schemas/runtime.json b/toolkit/components/webextensions/schemas/runtime.json index b3f12a768..575df7d27 100644 --- a/toolkit/components/webextensions/schemas/runtime.json +++ b/toolkit/components/webextensions/schemas/runtime.json @@ -535,7 +535,6 @@ }, { "name": "onConnectExternal", - "unsupported": true, "type": "function", "description": "Fired when a connection is made from another extension.", "parameters": [ @@ -560,7 +559,6 @@ }, { "name": "onMessageExternal", - "unsupported": true, "type": "function", "description": "Fired when a message is sent from another extension/app. Cannot be used in a content script.", "parameters": [ diff --git a/toolkit/components/webextensions/test/mochitest/mochitest.ini b/toolkit/components/webextensions/test/mochitest/mochitest.ini index 45586237e..1f61060ad 100644 --- a/toolkit/components/webextensions/test/mochitest/mochitest.ini +++ b/toolkit/components/webextensions/test/mochitest/mochitest.ini @@ -59,6 +59,7 @@ skip-if = os == 'android' # Android does not support tabs API. Bug 1260250 [test_ext_contentscript_teardown.html] skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250 [test_ext_exclude_include_globs.html] +[test_ext_external_messaging.html] [test_ext_i18n_css.html] [test_ext_generate.html] [test_ext_notifications.html] diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js b/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js index 0f617c37e..25d04b36b 100644 --- a/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js +++ b/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js @@ -75,7 +75,9 @@ let expectedBackgroundApis = [ "runtime.getBackgroundPage", "runtime.getBrowserInfo", "runtime.getPlatformInfo", + "runtime.onConnectExternal", "runtime.onInstalled", + "runtime.onMessageExternal", "runtime.onStartup", "runtime.onUpdateAvailable", "runtime.openOptionsPage", diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html b/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html new file mode 100644 index 000000000..dfc1f9427 --- /dev/null +++ b/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html @@ -0,0 +1,111 @@ + + + + WebExtension external messaging + + + + + + + + + + + + diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html index 1ebc1b40f..5c350be2f 100644 --- a/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html +++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html @@ -13,48 +13,119 @@ diff --git a/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js index 63d5361a1..770851472 100644 --- a/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js +++ b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js @@ -108,7 +108,7 @@ add_task(function* test_legacy_extension_context() { "Got the expected message"); ok(msgSender, "Got a message sender object"); - equal(msgSender.id, extensionInfo.uuid, "The sender has the expected id property"); + equal(msgSender.id, extension.id, "The sender has the expected id property"); equal(msgSender.url, extensionInfo.bgURL, "The sender has the expected url property"); // Wait confirmation that the reply has been received. @@ -136,7 +136,7 @@ add_task(function* test_legacy_extension_context() { ok(port, "Got the Port API object"); ok(port.sender, "The port has a sender property"); - equal(port.sender.id, extensionInfo.uuid, + equal(port.sender.id, extension.id, "The port sender has the expected id property"); equal(port.sender.url, extensionInfo.bgURL, "The port sender has the expected url property"); -- cgit v1.2.3 From 11c9f20ea8e15cb5ef51c5cab0863d311ac00025 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 18:08:43 +0200 Subject: moebius#219: WebExtensions - add-on throws error on load when suggested_key is null / missing https://github.com/MoonchildProductions/moebius/pull/219 --- browser/components/webextensions/ext-commands.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/browser/components/webextensions/ext-commands.js b/browser/components/webextensions/ext-commands.js index 416544e86..3f0bf8d1a 100644 --- a/browser/components/webextensions/ext-commands.js +++ b/browser/components/webextensions/ext-commands.js @@ -74,15 +74,14 @@ CommandList.prototype = { // For Windows, chrome.runtime expects 'win' while chrome.commands // expects 'windows'. We can special case this for now. let os = PlatformInfo.os == "win" ? "windows" : PlatformInfo.os; - for (let name of Object.keys(manifest.commands)) { - let command = manifest.commands[name]; - let shortcut = command.suggested_key[os] || command.suggested_key.default; - if (shortcut) { - commands.set(name, { - description: command.description, - shortcut: shortcut.replace(/\s+/g, ""), - }); - } + for (let [name, command] of Object.entries(manifest.commands)) { + let suggested_key = command.suggested_key || {}; + let shortcut = suggested_key[os] || suggested_key.default; + shortcut = shortcut ? shortcut.replace(/\s+/g, "") : null; + commands.set(name, { + description: command.description, + shortcut, + }); } return commands; }, @@ -96,8 +95,10 @@ CommandList.prototype = { let keyset = doc.createElementNS(XUL_NS, "keyset"); keyset.id = `ext-keyset-id-${this.id}`; this.commands.forEach((command, name) => { - let keyElement = this.buildKey(doc, name, command.shortcut); - keyset.appendChild(keyElement); + if (command.shortcut) { + let keyElement = this.buildKey(doc, name, command.shortcut); + keyset.appendChild(keyElement); + } }); doc.documentElement.appendChild(keyset); this.keysetsMap.set(window, keyset); -- cgit v1.2.3 From 7d7df95f2866c5c45f0aaa77baa2b5508ea9b1c7 Mon Sep 17 00:00:00 2001 From: JustOff Date: Fri, 20 Apr 2018 21:10:10 +0300 Subject: [PMkit] Provide gContextMenuContentData for 'sdk/context-menu' --- application/palemoon/base/content/content.js | 108 +++++++++++++++++++++ application/palemoon/base/content/nsContextMenu.js | 3 + 2 files changed, 111 insertions(+) diff --git a/application/palemoon/base/content/content.js b/application/palemoon/base/content/content.js index 19c8b0682..653dac3e3 100644 --- a/application/palemoon/base/content/content.js +++ b/application/palemoon/base/content/content.js @@ -60,6 +60,114 @@ addEventListener("blur", function(event) { LoginManagerContent.onUsernameInput(event); }); +// Provide gContextMenuContentData for 'sdk/context-menu' +var handleContentContextMenu = function (event) { + let defaultPrevented = event.defaultPrevented; + if (!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")) { + let plugin = null; + try { + plugin = event.target.QueryInterface(Ci.nsIObjectLoadingContent); + } catch (e) {} + if (plugin && plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN) { + // Don't open a context menu for plugins. + return; + } + + defaultPrevented = false; + } + + if (defaultPrevented) + return; + + let addonInfo = {}; + let subject = { + event: event, + addonInfo: addonInfo, + }; + subject.wrappedJSObject = subject; + Services.obs.notifyObservers(subject, "content-contextmenu", null); + + let doc = event.target.ownerDocument; + let docLocation = doc.mozDocumentURIIfNotForErrorPages; + docLocation = docLocation && docLocation.spec; + let charSet = doc.characterSet; + let baseURI = doc.baseURI; + let referrer = doc.referrer; + let referrerPolicy = doc.referrerPolicy; + let frameOuterWindowID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils) + .outerWindowID; + let loginFillInfo = LoginManagerContent.getFieldContext(event.target); + + // The same-origin check will be done in nsContextMenu.openLinkInTab. + let parentAllowsMixedContent = !!docShell.mixedContentChannel; + + // get referrer attribute from clicked link and parse it + // if per element referrer is enabled, the element referrer overrules + // the document wide referrer + if (Services.prefs.getBoolPref("network.http.enablePerElementReferrer")) { + let referrerAttrValue = Services.netUtils.parseAttributePolicyString(event.target. + getAttribute("referrerpolicy")); + if (referrerAttrValue !== Ci.nsIHttpChannel.REFERRER_POLICY_UNSET) { + referrerPolicy = referrerAttrValue; + } + } + + // Media related cache info parent needs for saving + let contentType = null; + let contentDisposition = null; + if (event.target.nodeType == Ci.nsIDOMNode.ELEMENT_NODE && + event.target instanceof Ci.nsIImageLoadingContent && + event.target.currentURI) { + + try { + let imageCache = + Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools) + .getImgCacheForDocument(doc); + let props = + imageCache.findEntryProperties(event.target.currentURI, doc); + try { + contentType = props.get("type", Ci.nsISupportsCString).data; + } catch (e) {} + try { + contentDisposition = + props.get("content-disposition", Ci.nsISupportsCString).data; + } catch (e) {} + } catch (e) {} + } + + let selectionInfo = BrowserUtils.getSelectionDetails(content); + + let loadContext = docShell.QueryInterface(Ci.nsILoadContext); + let userContextId = loadContext.originAttributes.userContextId; + + let browser = docShell.chromeEventHandler; + let mainWin = browser.ownerGlobal; + + mainWin.gContextMenuContentData = { + isRemote: false, + event: event, + popupNode: event.target, + browser: browser, + addonInfo: addonInfo, + documentURIObject: doc.documentURIObject, + docLocation: docLocation, + charSet: charSet, + referrer: referrer, + referrerPolicy: referrerPolicy, + contentType: contentType, + contentDisposition: contentDisposition, + selectionInfo: selectionInfo, + loginFillInfo, + parentAllowsMixedContent, + userContextId, + }; +} + +Cc["@mozilla.org/eventlistenerservice;1"] + .getService(Ci.nsIEventListenerService) + .addSystemEventListener(global, "contextmenu", handleContentContextMenu, false); + // Lazily load the finder code addMessageListener("Finder:Initialize", function () { let {RemoteFinderListener} = Cu.import("resource://gre/modules/RemoteFinder.jsm", {}); diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index 1fe592b52..3d5d40e4c 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -4,6 +4,8 @@ Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); +var gContextMenuContentData = null; + function nsContextMenu(aXulMenu, aIsShift) { this.shouldDisplay = true; this.initMenu(aXulMenu, aIsShift); @@ -39,6 +41,7 @@ nsContextMenu.prototype = { }, hiding: function CM_hiding() { + gContextMenuContentData = null; InlineSpellCheckerUI.clearSuggestionsFromMenu(); InlineSpellCheckerUI.clearDictionaryListFromMenu(); InlineSpellCheckerUI.uninit(); -- cgit v1.2.3 From 4c0556f9283c8c5c6ac8db9d454e2116d571e997 Mon Sep 17 00:00:00 2001 From: JustOff Date: Fri, 20 Apr 2018 21:11:18 +0300 Subject: [PMkit] Remove embedded WebExtensions support --- toolkit/jetpack/moz.build | 12 ++++++++---- toolkit/jetpack/sdk/addon/bootstrap.js | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/toolkit/jetpack/moz.build b/toolkit/jetpack/moz.build index ad11e90a3..1e1b48f3d 100644 --- a/toolkit/jetpack/moz.build +++ b/toolkit/jetpack/moz.build @@ -128,9 +128,10 @@ EXTRA_JS_MODULES.commonjs += [ 'test.js', ] -EXTRA_JS_MODULES.commonjs.sdk += [ - 'sdk/webextension.js', -] +if not CONFIG['MC_PALEMOON']: + EXTRA_JS_MODULES.commonjs.sdk += [ + 'sdk/webextension.js', + ] EXTRA_JS_MODULES.commonjs.dev += [ 'dev/debuggee.js', @@ -228,7 +229,6 @@ EXTRA_PP_JS_MODULES.commonjs.sdk += [ ] EXTRA_JS_MODULES.commonjs.sdk.addon += [ - 'sdk/addon/bootstrap.js', 'sdk/addon/events.js', 'sdk/addon/host.js', 'sdk/addon/installer.js', @@ -237,6 +237,10 @@ EXTRA_JS_MODULES.commonjs.sdk.addon += [ 'sdk/addon/window.js', ] +EXTRA_PP_JS_MODULES.commonjs.sdk.addon += [ + 'sdk/addon/bootstrap.js', +] + EXTRA_JS_MODULES.commonjs.sdk.browser += [ 'sdk/browser/events.js', ] diff --git a/toolkit/jetpack/sdk/addon/bootstrap.js b/toolkit/jetpack/sdk/addon/bootstrap.js index 0397d91e5..9eb5efac7 100644 --- a/toolkit/jetpack/sdk/addon/bootstrap.js +++ b/toolkit/jetpack/sdk/addon/bootstrap.js @@ -134,8 +134,10 @@ Bootstrap.prototype = { const main = command === "test" ? "sdk/test/runner" : null; const prefsURI = `${baseURI}defaults/preferences/prefs.js`; +#ifndef MC_PALEMOON // Init the 'sdk/webextension' module from the bootstrap addon parameter. require("sdk/webextension").initFromBootstrapAddonParam(addon); +#endif const { startup } = require("sdk/addon/runner"); startup(reason, {loader, main, prefsURI}); -- cgit v1.2.3 From e00e3008fe1775d17c4c9bba7a382a159ba5ef9e Mon Sep 17 00:00:00 2001 From: JustOff Date: Fri, 20 Apr 2018 22:45:23 +0300 Subject: [PMkit] Rely on MOZ_WEBEXTENSIONS to include 'sdk/webextension' --- toolkit/jetpack/moz.build | 2 +- toolkit/jetpack/sdk/addon/bootstrap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkit/jetpack/moz.build b/toolkit/jetpack/moz.build index 1e1b48f3d..2e5dbe5e8 100644 --- a/toolkit/jetpack/moz.build +++ b/toolkit/jetpack/moz.build @@ -128,7 +128,7 @@ EXTRA_JS_MODULES.commonjs += [ 'test.js', ] -if not CONFIG['MC_PALEMOON']: +if CONFIG['MOZ_WEBEXTENSIONS']: EXTRA_JS_MODULES.commonjs.sdk += [ 'sdk/webextension.js', ] diff --git a/toolkit/jetpack/sdk/addon/bootstrap.js b/toolkit/jetpack/sdk/addon/bootstrap.js index 9eb5efac7..6c5827f1e 100644 --- a/toolkit/jetpack/sdk/addon/bootstrap.js +++ b/toolkit/jetpack/sdk/addon/bootstrap.js @@ -134,7 +134,7 @@ Bootstrap.prototype = { const main = command === "test" ? "sdk/test/runner" : null; const prefsURI = `${baseURI}defaults/preferences/prefs.js`; -#ifndef MC_PALEMOON +#ifdef MOZ_WEBEXTENSIONS // Init the 'sdk/webextension' module from the bootstrap addon parameter. require("sdk/webextension").initFromBootstrapAddonParam(addon); #endif -- cgit v1.2.3 From 2828e5db828d13ef662817f37f55709ab302db51 Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 20 Apr 2018 17:44:53 -0500 Subject: Use -1 instead of 0 to indicate absent glxtest_pipe fd --- widget/GfxInfoX11.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 4297aaa93..48fc3dbb5 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -23,7 +23,7 @@ NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug) #endif // these global variables will be set when firing the glxtest process -int glxtest_pipe = 0; +int glxtest_pipe = -1; pid_t glxtest_pid = 0; nsresult @@ -50,8 +50,8 @@ GfxInfo::GetData() // to understand this function, see bug 639842. We retrieve the OpenGL driver information in a // separate process to protect against bad drivers. - // if glxtest_pipe == 0, that means that we already read the information - if (!glxtest_pipe) + // if glxtest_pipe == -1, that means that we already read the information + if (glxtest_pipe == -1) return; enum { buf_size = 1024 }; @@ -60,7 +60,7 @@ GfxInfo::GetData() &buf, buf_size-1); // -1 because we'll append a zero close(glxtest_pipe); - glxtest_pipe = 0; + glxtest_pipe = -1; // bytesread < 0 would mean that the above read() call failed. // This should never happen. If it did, the outcome would be to blacklist anyway. -- cgit v1.2.3