Bug 1463663 - Prefix exported functions of the RemotePageManager with RPM. r=mossop
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Wed, 27 Jun 2018 09:08:32 +0200
changeset 478976 f3977af8a9fd5fc8d0c35500eafefff2259366c0
parent 478975 8b99a48a2b7062aef9540b947b9ba675da301b95
child 478977 78ddf47da425f6f6d14032017d783a80c8e0cadc
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1463663
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1463663 - Prefix exported functions of the RemotePageManager with RPM. r=mossop
browser/base/content/aboutTabCrashed.js
browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
browser/extensions/activity-stream/content-src/asrouter/asrouter-content.jsx
browser/extensions/activity-stream/content-src/lib/init-store.js
browser/extensions/activity-stream/content-src/lib/snippets.js
browser/extensions/activity-stream/data/content/activity-stream.bundle.js
testing/talos/talos/tests/tabswitch/content/test.html
toolkit/content/plugins.html
toolkit/modules/RemotePageManager.jsm
toolkit/modules/tests/browser/testremotepagemanager.html
toolkit/modules/tests/browser/testremotepagemanager2.html
tools/lint/eslint/eslint-plugin-mozilla/lib/environments/frame-script.js
--- a/browser/base/content/aboutTabCrashed.js
+++ b/browser/base/content/aboutTabCrashed.js
@@ -50,17 +50,17 @@ var AboutTabCrashed = {
 
     return this.pageData = {
       title: titleMatch && titleMatch[1] ? decodeURIComponent(titleMatch[1]) : "",
       URL: URLMatch && URLMatch[1] ? decodeURIComponent(URLMatch[1]) : "",
     };
   },
 
   init() {
-    this.MESSAGES.forEach((msg) => addMessageListener(msg, this.receiveMessage.bind(this)));
+    this.MESSAGES.forEach((msg) => RPMAddMessageListener(msg, this.receiveMessage.bind(this)));
     addEventListener("DOMContentLoaded", this);
 
     document.title = this.pageData.title;
   },
 
   receiveMessage(message) {
     switch (message.name) {
       case "UpdateCount": {
@@ -103,17 +103,17 @@ var AboutTabCrashed = {
 
     // For setting "emailMe" checkbox automatically on email value change.
     document.getElementById("email").addEventListener("input", this);
 
     // Error pages are loaded as LOAD_BACKGROUND, so they don't get load events.
     let event = new CustomEvent("AboutTabCrashedLoad", {bubbles: true});
     document.dispatchEvent(event);
 
-    sendAsyncMessage("Load");
+    RPMSendAsyncMessage("Load");
   },
 
   onClick(event) {
     switch (event.target.id) {
       case "closeTab": {
         this.sendMessage("closeTab");
         break;
       }
@@ -290,17 +290,17 @@ var AboutTabCrashed = {
     if (requestAutoSubmit.hidden) {
       // The checkbox is hidden if the user has already opted in to sending
       // backlogged crash reports.
       autoSubmit = true;
     } else {
       autoSubmit = document.getElementById("autoSubmit").checked;
     }
 
-    sendAsyncMessage(messageName, {
+    RPMSendAsyncMessage(messageName, {
       sendReport,
       comments,
       email,
       emailMe,
       includeURL,
       URL,
       autoSubmit,
       hasReport: this.hasReport,
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ -28,23 +28,23 @@ function updateTPInfo() {
 }
 
 document.addEventListener("DOMContentLoaded", function() {
   if (!RPMIsWindowPrivate()) {
     document.documentElement.classList.remove("private");
     document.documentElement.classList.add("normal");
     document.getElementById("favicon").setAttribute("href", FAVICON_QUESTION);
     document.getElementById("startPrivateBrowsing").addEventListener("click", function() {
-      sendAsyncMessage("OpenPrivateWindow");
+      RPMSendAsyncMessage("OpenPrivateWindow");
     });
     return;
   }
 
   document.getElementById("startTour").addEventListener("click", function() {
-    sendAsyncMessage("DontShowIntroPanelAgain");
+    RPMSendAsyncMessage("DontShowIntroPanelAgain");
   });
   document.getElementById("startTour").setAttribute("href",
     RPMGetFormatURLPref("privacy.trackingprotection.introURL"));
 
   document.getElementById("learnMore").setAttribute("href",
     RPMGetFormatURLPref("app.support.baseURL") + "private-browsing");
 
   let tpToggle = document.getElementById("tpToggle");
--- a/browser/extensions/activity-stream/content-src/asrouter/asrouter-content.jsx
+++ b/browser/extensions/activity-stream/content-src/asrouter/asrouter-content.jsx
@@ -9,23 +9,23 @@ import ReactDOM from "react-dom";
 import {safeURI} from "./template-utils";
 import {SimpleSnippet} from "./templates/SimpleSnippet/SimpleSnippet";
 
 const INCOMING_MESSAGE_NAME = "ASRouter:parent-to-child";
 const OUTGOING_MESSAGE_NAME = "ASRouter:child-to-parent";
 
 export const ASRouterUtils = {
   addListener(listener) {
-    global.addMessageListener(INCOMING_MESSAGE_NAME, listener);
+    global.RPMAddMessageListener(INCOMING_MESSAGE_NAME, listener);
   },
   removeListener(listener) {
-    global.removeMessageListener(INCOMING_MESSAGE_NAME, listener);
+    global.RPMRemoveMessageListener(INCOMING_MESSAGE_NAME, listener);
   },
   sendMessage(action) {
-    global.sendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
+    global.RPMSendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
   },
   blockById(id) {
     ASRouterUtils.sendMessage({type: "BLOCK_MESSAGE_BY_ID", data: {id}});
   },
   blockBundle(bundle) {
     ASRouterUtils.sendMessage({type: "BLOCK_BUNDLE", data: {bundle}});
   },
   executeAction({button_action, button_action_params}) {
@@ -42,17 +42,17 @@ export const ASRouterUtils = {
   getNextMessage() {
     ASRouterUtils.sendMessage({type: "GET_NEXT_MESSAGE"});
   },
   overrideMessage(id) {
     ASRouterUtils.sendMessage({type: "OVERRIDE_MESSAGE", data: {id}});
   },
   sendTelemetry(ping) {
     const payload = ac.ASRouterUserEvent(ping);
-    global.sendAsyncMessage(AS_GENERAL_OUTGOING_MESSAGE_NAME, payload);
+    global.RPMSendAsyncMessage(AS_GENERAL_OUTGOING_MESSAGE_NAME, payload);
   }
 };
 
 // Note: nextProps/prevProps refer to props passed to <ImpressionsWrapper />, not <ASRouterUISurface />
 function shouldSendImpressionOnUpdate(nextProps, prevProps) {
   return (nextProps.message.id && (!prevProps.message || prevProps.message.id !== nextProps.message.id));
 }
 
--- a/browser/extensions/activity-stream/content-src/lib/init-store.js
+++ b/browser/extensions/activity-stream/content-src/lib/init-store.js
@@ -35,17 +35,17 @@ function mergeStateReducer(mainReducer) 
 }
 
 /**
  * messageMiddleware - Middleware that looks for SentToMain type actions, and sends them if necessary
  */
 const messageMiddleware = store => next => action => {
   const skipLocal = action.meta && action.meta.skipLocal;
   if (au.isSendToMain(action)) {
-    sendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
+    RPMSendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
   }
   if (!skipLocal) {
     next(action);
   }
 };
 
 export const rehydrationMiddleware = store => next => action => {
   if (store._didRehydrate) {
@@ -113,24 +113,24 @@ export const queueEarlyMessageMiddleware
  * @param  {object} reducers An object containing Redux reducers
  * @param  {object} intialState (optional) The initial state of the store, if desired
  * @return {object}          A redux store
  */
 export function initStore(reducers, initialState) {
   const store = createStore(
     mergeStateReducer(combineReducers(reducers)),
     initialState,
-    global.addMessageListener && applyMiddleware(rehydrationMiddleware, queueEarlyMessageMiddleware, messageMiddleware)
+    global.RPMAddMessageListener && applyMiddleware(rehydrationMiddleware, queueEarlyMessageMiddleware, messageMiddleware)
   );
 
   store._didRehydrate = false;
   store._didRequestInitialState = false;
 
-  if (global.addMessageListener) {
-    global.addMessageListener(INCOMING_MESSAGE_NAME, msg => {
+  if (global.RPMAddMessageListener) {
+    global.RPMAddMessageListener(INCOMING_MESSAGE_NAME, msg => {
       try {
         store.dispatch(msg.data);
       } catch (ex) {
         console.error("Content msg:", msg, "Dispatch error: ", ex); // eslint-disable-line no-console
         dump(`Content msg: ${JSON.stringify(msg)}\nDispatch error: ${ex}\n${ex.stack}`);
       }
     });
   }
--- a/browser/extensions/activity-stream/content-src/lib/snippets.js
+++ b/browser/extensions/activity-stream/content-src/lib/snippets.js
@@ -69,32 +69,32 @@ export class SnippetsMap extends Map {
 
   showFirefoxAccounts() {
     this._dispatch(ac.AlsoToMain({type: at.SHOW_FIREFOX_ACCOUNTS}));
   }
 
   getTotalBookmarksCount() {
     return new Promise(resolve => {
       this._dispatch(ac.OnlyToMain({type: at.TOTAL_BOOKMARKS_REQUEST}));
-      global.addMessageListener("ActivityStream:MainToContent", function onMessage({data: action}) {
+      global.RPMAddMessageListener("ActivityStream:MainToContent", function onMessage({data: action}) {
         if (action.type === at.TOTAL_BOOKMARKS_RESPONSE) {
           resolve(action.data);
-          global.removeMessageListener("ActivityStream:MainToContent", onMessage);
+          global.RPMRemoveMessageListener("ActivityStream:MainToContent", onMessage);
         }
       });
     });
   }
 
   getAddonsInfo() {
     return new Promise(resolve => {
       this._dispatch(ac.OnlyToMain({type: at.ADDONS_INFO_REQUEST}));
-      global.addMessageListener("ActivityStream:MainToContent", function onMessage({data: action}) {
+      global.RPMAddMessageListener("ActivityStream:MainToContent", function onMessage({data: action}) {
         if (action.type === at.ADDONS_INFO_RESPONSE) {
           resolve(action.data);
-          global.removeMessageListener("ActivityStream:MainToContent", onMessage);
+          global.RPMRemoveMessageListener("ActivityStream:MainToContent", onMessage);
         }
       });
     });
   }
 
   /**
    * connect - Attaches an indexedDB back-end to the Map so that any set values
    *           are also cached in a store. It also restores any existing values
@@ -313,18 +313,18 @@ export class SnippetsProvider {
   async init(options) {
     Object.assign(this, {
       appData: {},
       elementId: "snippets",
       connect: true
     }, options);
 
     // Add listener so we know when snippets are blocked on other pages
-    if (global.addMessageListener) {
-      global.addMessageListener("ActivityStream:MainToContent", this._onAction);
+    if (global.RPMAddMessageListener) {
+      global.RPMAddMessageListener("ActivityStream:MainToContent", this._onAction);
     }
 
     // TODO: Requires enabling indexedDB on newtab
     // Restore the snippets map from indexedDB
     if (this.connect) {
       try {
         await this.snippetsMap.connect();
       } catch (e) {
@@ -355,18 +355,18 @@ export class SnippetsProvider {
 
     this._forceOnboardingVisibility(true);
     this.initialized = true;
   }
 
   uninit() {
     window.dispatchEvent(new Event(SNIPPETS_DISABLED_EVENT));
     this._forceOnboardingVisibility(false);
-    if (global.removeMessageListener) {
-      global.removeMessageListener("ActivityStream:MainToContent", this._onAction);
+    if (global.RPMRemoveMessageListener) {
+      global.RPMRemoveMessageListener("ActivityStream:MainToContent", this._onAction);
     }
     this.initialized = false;
   }
 }
 
 /**
  * addSnippetsSubscriber - Creates a SnippetsProvider that Initializes
  *                         when the store has received the appropriate
--- a/browser/extensions/activity-stream/data/content/activity-stream.bundle.js
+++ b/browser/extensions/activity-stream/data/content/activity-stream.bundle.js
@@ -386,38 +386,37 @@ var actionUtils = {
 /***/ (function(module, exports) {
 
 module.exports = ReactIntl;
 
 /***/ }),
 /* 3 */
 /***/ (function(module, exports) {
 
-var g;
-
-// This works in non-strict mode
-g = (function() {
-	return this;
-})();
-
-try {
-	// This works if eval is allowed (see CSP)
-	g = g || Function("return this")() || (1,eval)("this");
-} catch(e) {
-	// This works if the window reference is available
-	if(typeof window === "object")
-		g = window;
-}
-
-// g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
-
-module.exports = g;
-
+var g;
+
+// This works in non-strict mode
+g = (function() {
+ return this;
+})();
+
+try {
+ // This works if eval is allowed (see CSP)
+ g = g || Function("return this")() || (1,eval)("this");
+} catch(e) {
+ // This works if the window reference is available
+ if(typeof window === "object")
+   g = window;
+}
+
+// g can still be undefined, but nothing to do about it...
+// We return undefined, instead of nothing here, so it's
+// easier to handle this case. if(!global) { ...}
+
+module.exports = g;
 
 /***/ }),
 /* 4 */
 /***/ (function(module, exports) {
 
 module.exports = ReactRedux;
 
 /***/ }),
@@ -929,23 +928,23 @@ var _extends = Object.assign || function
 
 
 
 const INCOMING_MESSAGE_NAME = "ASRouter:parent-to-child";
 const OUTGOING_MESSAGE_NAME = "ASRouter:child-to-parent";
 
 const ASRouterUtils = {
   addListener(listener) {
-    global.addMessageListener(INCOMING_MESSAGE_NAME, listener);
+    global.RPMAddMessageListener(INCOMING_MESSAGE_NAME, listener);
   },
   removeListener(listener) {
-    global.removeMessageListener(INCOMING_MESSAGE_NAME, listener);
+    global.RPMRemoveMessageListener(INCOMING_MESSAGE_NAME, listener);
   },
   sendMessage(action) {
-    global.sendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
+    global.RPMSendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
   },
   blockById(id) {
     ASRouterUtils.sendMessage({ type: "BLOCK_MESSAGE_BY_ID", data: { id } });
   },
   blockBundle(bundle) {
     ASRouterUtils.sendMessage({ type: "BLOCK_BUNDLE", data: { bundle } });
   },
   executeAction({ button_action, button_action_params }) {
@@ -962,17 +961,17 @@ const ASRouterUtils = {
   getNextMessage() {
     ASRouterUtils.sendMessage({ type: "GET_NEXT_MESSAGE" });
   },
   overrideMessage(id) {
     ASRouterUtils.sendMessage({ type: "OVERRIDE_MESSAGE", data: { id } });
   },
   sendTelemetry(ping) {
     const payload = __WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["b" /* actionCreators */].ASRouterUserEvent(ping);
-    global.sendAsyncMessage(__WEBPACK_IMPORTED_MODULE_2_content_src_lib_init_store__["a" /* OUTGOING_MESSAGE_NAME */], payload);
+    global.RPMSendAsyncMessage(__WEBPACK_IMPORTED_MODULE_2_content_src_lib_init_store__["a" /* OUTGOING_MESSAGE_NAME */], payload);
   }
 };
 /* harmony export (immutable) */ __webpack_exports__["b"] = ASRouterUtils;
 
 
 // Note: nextProps/prevProps refer to props passed to <ImpressionsWrapper />, not <ASRouterUISurface />
 function shouldSendImpressionOnUpdate(nextProps, prevProps) {
   return nextProps.message.id && (!prevProps.message || prevProps.message.id !== nextProps.message.id);
@@ -3352,17 +3351,17 @@ function mergeStateReducer(mainReducer) 
 }
 
 /**
  * messageMiddleware - Middleware that looks for SentToMain type actions, and sends them if necessary
  */
 const messageMiddleware = store => next => action => {
   const skipLocal = action.meta && action.meta.skipLocal;
   if (__WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["d" /* actionUtils */].isSendToMain(action)) {
-    sendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
+    RPMSendAsyncMessage(OUTGOING_MESSAGE_NAME, action);
   }
   if (!skipLocal) {
     next(action);
   }
 };
 
 const rehydrationMiddleware = store => next => action => {
   if (store._didRehydrate) {
@@ -3431,23 +3430,23 @@ const queueEarlyMessageMiddleware = stor
 /**
  * initStore - Create a store and listen for incoming actions
  *
  * @param  {object} reducers An object containing Redux reducers
  * @param  {object} intialState (optional) The initial state of the store, if desired
  * @return {object}          A redux store
  */
 function initStore(reducers, initialState) {
-  const store = Object(__WEBPACK_IMPORTED_MODULE_1_redux__["createStore"])(mergeStateReducer(Object(__WEBPACK_IMPORTED_MODULE_1_redux__["combineReducers"])(reducers)), initialState, global.addMessageListener && Object(__WEBPACK_IMPORTED_MODULE_1_redux__["applyMiddleware"])(rehydrationMiddleware, queueEarlyMessageMiddleware, messageMiddleware));
+  const store = Object(__WEBPACK_IMPORTED_MODULE_1_redux__["createStore"])(mergeStateReducer(Object(__WEBPACK_IMPORTED_MODULE_1_redux__["combineReducers"])(reducers)), initialState, global.RPMAddMessageListener && Object(__WEBPACK_IMPORTED_MODULE_1_redux__["applyMiddleware"])(rehydrationMiddleware, queueEarlyMessageMiddleware, messageMiddleware));
 
   store._didRehydrate = false;
   store._didRequestInitialState = false;
 
-  if (global.addMessageListener) {
-    global.addMessageListener(INCOMING_MESSAGE_NAME, msg => {
+  if (global.RPMAddMessageListener) {
+    global.RPMAddMessageListener(INCOMING_MESSAGE_NAME, msg => {
       try {
         store.dispatch(msg.data);
       } catch (ex) {
         console.error("Content msg:", msg, "Dispatch error: ", ex); // eslint-disable-line no-console
         dump(`Content msg: ${JSON.stringify(msg)}\nDispatch error: ${ex}\n${ex.stack}`);
       }
     });
   }
@@ -5310,32 +5309,32 @@ class SnippetsMap extends Map {
 
   showFirefoxAccounts() {
     this._dispatch(__WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["b" /* actionCreators */].AlsoToMain({ type: __WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["c" /* actionTypes */].SHOW_FIREFOX_ACCOUNTS }));
   }
 
   getTotalBookmarksCount() {
     return new Promise(resolve => {
       this._dispatch(__WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["b" /* actionCreators */].OnlyToMain({ type: __WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["c" /* actionTypes */].TOTAL_BOOKMARKS_REQUEST }));
-      global.addMessageListener("ActivityStream:MainToContent", function onMessage({ data: action }) {
+      global.RPMAddMessageListener("ActivityStream:MainToContent", function onMessage({ data: action }) {
         if (action.type === __WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["c" /* actionTypes */].TOTAL_BOOKMARKS_RESPONSE) {
           resolve(action.data);
-          global.removeMessageListener("ActivityStream:MainToContent", onMessage);
+          global.RPMRemoveMessageListener("ActivityStream:MainToContent", onMessage);
         }
       });
     });
   }
 
   getAddonsInfo() {
     return new Promise(resolve => {
       this._dispatch(__WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["b" /* actionCreators */].OnlyToMain({ type: __WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["c" /* actionTypes */].ADDONS_INFO_REQUEST }));
-      global.addMessageListener("ActivityStream:MainToContent", function onMessage({ data: action }) {
+      global.RPMAddMessageListener("ActivityStream:MainToContent", function onMessage({ data: action }) {
         if (action.type === __WEBPACK_IMPORTED_MODULE_0_common_Actions_jsm__["c" /* actionTypes */].ADDONS_INFO_RESPONSE) {
           resolve(action.data);
-          global.removeMessageListener("ActivityStream:MainToContent", onMessage);
+          global.RPMRemoveMessageListener("ActivityStream:MainToContent", onMessage);
         }
       });
     });
   }
 
   /**
    * connect - Attaches an indexedDB back-end to the Map so that any set values
    *           are also cached in a store. It also restores any existing values
@@ -5562,18 +5561,18 @@ class SnippetsProvider {
     return _asyncToGenerator(function* () {
       Object.assign(_this4, {
         appData: {},
         elementId: "snippets",
         connect: true
       }, options);
 
       // Add listener so we know when snippets are blocked on other pages
-      if (global.addMessageListener) {
-        global.addMessageListener("ActivityStream:MainToContent", _this4._onAction);
+      if (global.RPMAddMessageListener) {
+        global.RPMAddMessageListener("ActivityStream:MainToContent", _this4._onAction);
       }
 
       // TODO: Requires enabling indexedDB on newtab
       // Restore the snippets map from indexedDB
       if (_this4.connect) {
         try {
           yield _this4.snippetsMap.connect();
         } catch (e) {
@@ -5605,18 +5604,18 @@ class SnippetsProvider {
       _this4._forceOnboardingVisibility(true);
       _this4.initialized = true;
     })();
   }
 
   uninit() {
     window.dispatchEvent(new Event(SNIPPETS_DISABLED_EVENT));
     this._forceOnboardingVisibility(false);
-    if (global.removeMessageListener) {
-      global.removeMessageListener("ActivityStream:MainToContent", this._onAction);
+    if (global.RPMRemoveMessageListener) {
+      global.RPMRemoveMessageListener("ActivityStream:MainToContent", this._onAction);
     }
     this.initialized = false;
   }
 }
 /* unused harmony export SnippetsProvider */
 
 
 /**
--- a/testing/talos/talos/tests/tabswitch/content/test.html
+++ b/testing/talos/talos/tests/tabswitch/content/test.html
@@ -1,15 +1,16 @@
 <html>
   <head>
     <script>
+      /* global RPMAddMessageListener, RPMSendAsyncMessage */
       function do_test(override) {
         if (override || document.location.hash.indexOf("#auto") == 0) {
-          sendAsyncMessage("tabswitch-do-test");
-          addMessageListener("tabswitch-test-results", function onMessage(msg) {
+          RPMSendAsyncMessage("tabswitch-do-test");
+          RPMAddMessageListener("tabswitch-test-results", function onMessage(msg) {
             let data = msg.data;
             tpRecordTime(data.times.join(","), 0, data.urls.join(","));
           });
         }
       }
     </script>
   </head>
   <body onload="do_test(false)">
--- a/toolkit/content/plugins.html
+++ b/toolkit/content/plugins.html
@@ -57,17 +57,17 @@
 
    * First, refresh plugins in case anything has been changed recently in
    * prefs: (The "false" argument tells refresh not to reload or activate
    * any plug-ins that would be active otherwise.  In contrast, one would
    * use "true" in the case of ASD instead of restarting)
    */
   navigator.plugins.refresh(false);
 
-  addMessageListener("PluginList", function({ data: aPlugins }) {
+  RPMAddMessageListener("PluginList", function({ data: aPlugins }) {
     var fragment = document.createDocumentFragment();
 
     // "Installed plugins"
     var id, label;
     if (aPlugins.length > 0) {
       id = "plugs";
       label = "installedplugins_label";
     } else {
@@ -210,13 +210,13 @@
           }
         }
       }
     }
 
     document.getElementById("outside").appendChild(fragment);
   });
 
-  sendAsyncMessage("RequestPlugins");
+  RPMSendAsyncMessage("RequestPlugins");
 </script>
 </div>
 </body>
 </html>
--- a/toolkit/modules/RemotePageManager.jsm
+++ b/toolkit/modules/RemotePageManager.jsm
@@ -507,24 +507,24 @@ ChromeMessagePort.prototype.destroy = fu
 function ChildMessagePort(contentFrame, window) {
   let portID = Services.appinfo.processID + ":" + ChildMessagePort.prototype.nextPortID++;
   MessagePort.call(this, contentFrame, portID);
 
   this.window = window;
 
   // Add functionality to the content page
   Cu.exportFunction(this.sendAsyncMessage.bind(this), window, {
-    defineAs: "sendAsyncMessage",
+    defineAs: "RPMSendAsyncMessage",
   });
   Cu.exportFunction(this.addMessageListener.bind(this), window, {
-    defineAs: "addMessageListener",
+    defineAs: "RPMAddMessageListener",
     allowCallbacks: true,
   });
   Cu.exportFunction(this.removeMessageListener.bind(this), window, {
-    defineAs: "removeMessageListener",
+    defineAs: "RPMRemoveMessageListener",
     allowCallbacks: true,
   });
   Cu.exportFunction(this.getBoolPref.bind(this), window, {
     defineAs: "RPMGetBoolPref",
   });
   Cu.exportFunction(this.setBoolPref.bind(this), window, {
     defineAs: "RPMSetBoolPref",
   });
--- a/toolkit/modules/tests/browser/testremotepagemanager.html
+++ b/toolkit/modules/tests/browser/testremotepagemanager.html
@@ -1,31 +1,31 @@
 <!DOCTYPE HTML>
 
 <html>
 <head>
 <script type="text/javascript">
-/* global addMessageListener, sendAsyncMessage, removeMessageListener */
+/* global RPMAddMessageListener, RPMSendAsyncMessage, RPMRemoveMessageListener */
 
-addMessageListener("Ping", function(message) {
-  sendAsyncMessage("Pong", {
+RPMAddMessageListener("Ping", function(message) {
+  RPMSendAsyncMessage("Pong", {
     str: message.data.str,
     counter: message.data.counter + 1
   });
 });
 
-addMessageListener("Ping2", function(message) {
-  sendAsyncMessage("Pong2", message.data);
+RPMAddMessageListener("Ping2", function(message) {
+  RPMSendAsyncMessage("Pong2", message.data);
 });
 
 function neverCalled() {
-  sendAsyncMessage("Pong3");
+  RPMSendAsyncMessage("Pong3");
 }
-addMessageListener("Pong3", neverCalled);
-removeMessageListener("Pong3", neverCalled);
+RPMAddMessageListener("Pong3", neverCalled);
+RPMRemoveMessageListener("Pong3", neverCalled);
 
 function testData(data) {
   var response = {
     result: true,
     status: "All data correctly received"
   };
 
   function compare(prop, expected) {
@@ -40,29 +40,29 @@ function testData(data) {
   compare("integer", 45);
   compare("real", 45.78);
   compare("str", "foobar");
   compare("array", [1, 2, 3, 5, 27]);
 
   return response;
 }
 
-addMessageListener("SendData", function(message) {
-  sendAsyncMessage("ReceivedData", testData(message.data));
+RPMAddMessageListener("SendData", function(message) {
+  RPMSendAsyncMessage("ReceivedData", testData(message.data));
 });
 
-addMessageListener("SendData2", function(message) {
-  sendAsyncMessage("ReceivedData2", testData(message.data.data));
+RPMAddMessageListener("SendData2", function(message) {
+  RPMSendAsyncMessage("ReceivedData2", testData(message.data.data));
 });
 
 var cookie = "nom";
-addMessageListener("SetCookie", function(message) {
+RPMAddMessageListener("SetCookie", function(message) {
   cookie = message.data.value;
 });
 
-addMessageListener("GetCookie", function(message) {
-  sendAsyncMessage("Cookie", { value: cookie });
+RPMAddMessageListener("GetCookie", function(message) {
+  RPMSendAsyncMessage("Cookie", { value: cookie });
 });
 </script>
 </head>
 <body>
 </body>
 </html>
--- a/toolkit/modules/tests/browser/testremotepagemanager2.html
+++ b/toolkit/modules/tests/browser/testremotepagemanager2.html
@@ -1,17 +1,17 @@
 <!DOCTYPE HTML>
 <!-- A second page to test that RemotePages works with multiple urls -->
 <html>
 <head>
 <script type="text/javascript">
-/* global addMessageListener, sendAsyncMessage */
+/* global RPMAddMessageListener, RPMSendAsyncMessage */
 
-addMessageListener("Ping", function(message) {
-  sendAsyncMessage("Pong", {
+RPMAddMessageListener("Ping", function(message) {
+  RPMSendAsyncMessage("Pong", {
     str: message.data.str,
     counter: message.data.counter + 1
   });
 });
 
 </script>
 </head>
 <body>
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/frame-script.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/environments/frame-script.js
@@ -22,11 +22,14 @@ module.exports = {
     removeWeakMessageListener: false,
     sendAsyncMessage: false,
     sendSyncMessage: false,
     sendRpcMessage: false,
     tabEventTarget: false,
     RPMGetBoolPref: false,
     RPMSetBoolPref: false,
     RPMGetFormatURLPref: false,
-    RPMIsWindowPrivate: false
+    RPMIsWindowPrivate: false,
+    RPMSendAsyncMessage: false,
+    RPMAddMessageListener: false,
+    RPMRemoveMessageListener: false
   }
 };