Bug 1329299 verify frameId in webrequest tests, r=kmag
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 12 Jan 2017 12:09:35 -0800
changeset 329305 f15661d44c76b87c7e23c2e1d4944ae4c0ebd2af
parent 329304 8ce511714aad7d3f58fdfa47ad5403371ae36ec1
child 329306 b9e61617c8c988a8923b87d1c3989d57d0a4a8d6
push id36046
push usermixedpuppy@gmail.com
push dateFri, 13 Jan 2017 20:55:22 +0000
treeherderautoland@f15661d44c76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1329299
milestone53.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 1329299 verify frameId in webrequest tests, r=kmag MozReview-Commit-ID: LuQcGsogs7J
toolkit/components/extensions/ext-webRequest.js
toolkit/components/extensions/test/mochitest/head_webrequest.js
--- a/toolkit/components/extensions/ext-webRequest.js
+++ b/toolkit/components/extensions/ext-webRequest.js
@@ -39,17 +39,17 @@ function WebRequestEventManager(context,
       let data2 = {
         requestId: data.requestId,
         url: data.url,
         originUrl: data.originUrl,
         method: data.method,
         tabId: browserData.tabId,
         type: data.type,
         timeStamp: Date.now(),
-        frameId: ExtensionManagement.getFrameId(data.windowId),
+        frameId: data.type == "main_frame" ? 0 : ExtensionManagement.getFrameId(data.windowId),
         parentFrameId: ExtensionManagement.getParentFrameId(data.parentWindowId, data.windowId),
       };
 
       const maybeCached = ["onResponseStarted", "onBeforeRedirect", "onCompleted", "onErrorOccurred"];
       if (maybeCached.includes(eventName)) {
         data2.fromCache = !!data.fromCache;
       }
 
--- a/toolkit/components/extensions/test/mochitest/head_webrequest.js
+++ b/toolkit/components/extensions/test/mochitest/head_webrequest.js
@@ -183,16 +183,19 @@ function background(events) {
           browser.test.assertEq(expected.test.requestId, details.requestId, "redirects will keep the same requestId");
         } else {
           // Save any values we want to validate in later events.
           expected.test.requestId = details.requestId;
           expected.test.tabId = details.tabId;
         }
         // Tests we don't need to do every event.
         browser.test.assertTrue(details.type.toUpperCase() in browser.webRequest.ResourceType, `valid resource type ${details.type}`);
+        if (details.type == "main_frame") {
+          browser.test.assertEq(0, details.frameId, "frameId is zero when type is main_frame bug 1329299");
+        }
       } else {
         // On events after onBeforeRequest, check the previous values.
         browser.test.assertEq(expected.test.requestId, details.requestId, "correct requestId");
         browser.test.assertEq(expected.test.tabId, details.tabId, "correct tabId");
       }
       if (name == "onBeforeSendHeaders") {
         if (expected.headers && expected.headers.request) {
           result.requestHeaders = processHeaders("request", expected, details);