Backed out changeset 8628b6ec7506 (bug 1576252) for multiple failures at components/extensions/test/xpcshell/test_webRequest_filtering.js on a CLOSED TREE
authorCoroiu Cristina <ccoroiu@mozilla.com>
Sat, 24 Aug 2019 00:06:37 +0300
changeset 553413 996ae56a62134d46e0bb460857d33af8eff8ff02
parent 553412 6ecde9adcfebd7e2ce1738a37d54d3e1a49e1eaf
child 553414 558f8555b78f036e47c9fdc3524846497d01fb57
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1576252
milestone70.0a1
backs out8628b6ec750681fca7eb5b2d2ef4e1369ebb2737
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
Backed out changeset 8628b6ec7506 (bug 1576252) for multiple failures at components/extensions/test/xpcshell/test_webRequest_filtering.js on a CLOSED TREE
toolkit/components/extensions/test/mochitest/test_ext_activityLog.html
toolkit/components/extensions/webrequest/WebRequest.jsm
--- a/toolkit/components/extensions/test/mochitest/test_ext_activityLog.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_activityLog.html
@@ -11,37 +11,16 @@
 
 <script type="text/javascript">
 "use strict";
 
 
 add_task(async function test_api() {
   let URL = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest/file_sample.html";
 
-  // Test that an unspecified extension is not logged by the watcher extension.
-  let unlogged = ExtensionTestUtils.loadExtension({
-    isPrivileged: true,
-    manifest: {
-      applications: { gecko: { id: "unlogged@tests.mozilla.org" } },
-      permissions: ["webRequest", "webRequestBlocking", "<all_urls>"],
-    },
-    background() {
-      // This privileged test extension should not affect the webRequest
-      // data received by non-privileged extensions (See Bug 1576272).
-      browser.webRequest.onBeforeRequest.addListener(
-        details => {
-          return { cancel: false };
-        },
-        { urls: ["http://mochi.test/*/file_sample.html"] },
-        ["blocking"]
-      );
-    },
-  });
-  await unlogged.startup();
-
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       applications: { gecko: { id: "watched@tests.mozilla.org" } },
       permissions: ["webRequest", "webRequestBlocking", "<all_urls>"],
       content_scripts: [
         {
           matches: ["http://mochi.test/*/file_sample.html"],
           js: ["content_script.js"],
@@ -296,17 +275,16 @@ add_task(async function test_api() {
 
   await Promise.all([
     extension.awaitMessage("content_script"),
     extension.awaitMessage("registered_script"),
     logger.awaitFinish("activity"),
   ]);
 
   await extension.unload();
-  await unlogged.unload();
   await logger.unload();
 });
 
 
 </script>
 
 </body>
 </html>
--- a/toolkit/components/extensions/webrequest/WebRequest.jsm
+++ b/toolkit/components/extensions/webrequest/WebRequest.jsm
@@ -752,17 +752,17 @@ HttpObserverManager = {
       lastActivity !== this.GOOD_LAST_ACTIVITY &&
       lastActivity !==
         nsIHttpActivityObserver.ACTIVITY_SUBTYPE_TRANSACTION_CLOSE
     ) {
       channel.lastActivity = activitySubtype;
     }
   },
 
-  getRequestData(channel, extraData) {
+  getRequestData(channel, extraData, policy) {
     let originAttributes =
       channel.loadInfo && channel.loadInfo.originAttributes;
     let data = {
       requestId: String(channel.id),
       url: channel.finalURL,
       method: channel.method,
       browser: channel.browserElement,
       type: channel.type,
@@ -779,16 +779,22 @@ HttpObserverManager = {
 
       ip: channel.remoteAddress,
 
       proxyInfo: channel.proxyInfo,
 
       serialize: serializeRequestData,
     };
 
+    // We're limiting access to
+    // urlClassification while the feature is further fleshed out.
+    if (policy && policy.extension.isPrivileged) {
+      data.urlClassification = channel.urlClassification;
+    }
+
     return Object.assign(data, extraData);
   },
 
   handleEvent(event) {
     let channel = event.currentTarget;
     switch (event.type) {
       case "error":
         this.runChannelListener(channel, "onError", {
@@ -834,31 +840,24 @@ HttpObserverManager = {
       let commonData = null;
       let requestBody;
       this.listeners[kind].forEach((opts, callback) => {
         if (!channel.matches(opts.filter, opts.extension, extraData)) {
           return;
         }
 
         if (!commonData) {
-          commonData = this.getRequestData(channel, extraData);
+          commonData = this.getRequestData(channel, extraData, opts.extension);
           if (this.STATUS_TYPES.has(kind)) {
             commonData.statusCode = channel.statusCode;
             commonData.statusLine = channel.statusLine;
           }
         }
         let data = Object.create(commonData);
 
-        // We're limiting access to urlClassification while the feature is
-        // further fleshed out.
-        let { policy } = opts.extension;
-        if (policy && policy.extension.isPrivileged) {
-          data.urlClassification = channel.urlClassification;
-        }
-
         if (registerFilter && opts.blocking && opts.extension) {
           data.registerTraceableChannel = (extension, remoteTab) => {
             // `channel` is a ChannelWrapper, which contains the actual
             // underlying nsIChannel in `channel.channel`.  For startup events
             // that are held until the extension background page is started,
             // it is possible that the underlying channel can be closed and
             // cleaned up between the time the event occurred and the time
             // we reach this code.