Bug 1510569 - QueryInterface received nsIRequest in promiseBrowserLoaded to an nsIChannel r=kmag
authorBarret Rennie <barret@brennie.ca>
Wed, 03 Apr 2019 17:50:58 +0000
changeset 467872 26bcb800c9778be8d253080c5ce589bfabd29c94
parent 467871 d34a8ec4785c335bfad41186b200e4ad81d772a4
child 467873 b485ad73deaf6c780b185a130d2effeb8e08006c
push id35810
push useraciure@mozilla.com
push dateThu, 04 Apr 2019 04:33:36 +0000
treeherdermozilla-central@b72c02e34261 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1510569
milestone68.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 1510569 - QueryInterface received nsIRequest in promiseBrowserLoaded to an nsIChannel r=kmag Changing RemoteWebProgress to a C++ XPCOM object will cause the request being passed into the `onStateChange` handler in `promiseBrowserLoaded` to become a wrapped XPCOM object for an nsIRequest, instead of the JS object it was previously. This results in the attribute lookup for `originalURI` on the request to fail, leading to cascading failures. Differential Revision: https://phabricator.services.mozilla.com/D24809
toolkit/components/extensions/ExtensionXPCShellUtils.jsm
--- a/toolkit/components/extensions/ExtensionXPCShellUtils.jsm
+++ b/toolkit/components/extensions/ExtensionXPCShellUtils.jsm
@@ -89,16 +89,18 @@ function frameScript() {
 
 let kungFuDeathGrip = new Set();
 function promiseBrowserLoaded(browser, url, redirectUrl) {
   return new Promise(resolve => {
     const listener = {
       QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIWebProgressListener]),
 
       onStateChange(webProgress, request, stateFlags, statusCode) {
+        request.QueryInterface(Ci.nsIChannel);
+
         let requestUrl = request.originalURI ? request.originalURI.spec : webProgress.DOMWindow.location.href;
         if (webProgress.isTopLevel &&
             (requestUrl === url || requestUrl === redirectUrl) &&
             (stateFlags & Ci.nsIWebProgressListener.STATE_STOP)) {
           resolve();
           kungFuDeathGrip.delete(listener);
           browser.removeProgressListener(listener);
         }