Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/content.js

Issue 29570614: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Use polyfill.js Created Oct. 10, 2017, 10:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ext/common.js ('k') | ext/devtools.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/content.js
===================================================================
--- a/ext/content.js
+++ b/ext/content.js
@@ -1,34 +1,34 @@
"use strict";
// Firefox 55 erroneously sends messages from the content script to the
// devtools panel:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1383310
// As a workaround, listen for messages only if this isn't the devtools panel.
-// Note that Firefox processes API access lazily, so chrome.devtools will always
-// exist but will have undefined as its value on other pages.
-if (!chrome.devtools)
+// Note that Firefox processes API access lazily, so browser.devtools will
+// always exist but will have undefined as its value on other pages.
+if (!browser.devtools)
{
// Listen for messages from the background page.
- chrome.runtime.onMessage.addListener((message, sender, sendResponse) =>
+ browser.runtime.onMessage.addListener((message, sender, sendResponse) =>
{
return ext.onMessage._dispatch(message, {}, sendResponse).includes(true);
});
}
(function()
{
let port = null;
ext.onExtensionUnloaded = {
addListener(listener)
{
if (!port)
- port = chrome.runtime.connect();
+ port = browser.runtime.connect();
// When the extension is reloaded, disabled or uninstalled the
// background page dies and automatically disconnects all ports
port.onDisconnect.addListener(listener);
},
removeListener(listener)
{
if (port)
« no previous file with comments | « ext/common.js ('k') | ext/devtools.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld