Closed Bug 1311576 Opened 9 years ago Closed 9 years ago

webRequest.RequestFilter doesn't support tabId or windowId values

Categories

(WebExtensions :: Untriaged, defect, P2)

defect

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: 21Naown, Assigned: mixedpuppy)

References

Details

(Keywords: dev-doc-complete, Whiteboard: triaged)

Attachments

(1 file, 1 obsolete file)

For example: chrome.webRequest.onResponseStarted.addListener(getURL, {urls: ["TO_MATCH"], tabId: 22}, ["responseHeaders"]); work out of tabId 22.
Assignee: nobody → mixedpuppy
Priority: -- → P2
Whiteboard: triaged
expanding this to include both missing items.
Summary: chrome.webRequest.*.addListener doesn't support tabId value → webRequest.RequestFilter doesn't support tabId or windowId values
Attached patch WIP webrequestFilter (obsolete) — Splinter Review
Wondering about the approach here. One approach would be to just do this in WebRequest.jsm, but it doesn't seem right to pull in ext-* stuff there. So this is a later filtering than the filtering done in WebRequest.jsm.
Attachment #8807390 - Flags: feedback?(kmaglione+bmo)
I forgot to add that in the doc (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest#Chrome_incompatibilities), the problem is already reported. May be you known it too?
Attachment #8807390 - Attachment is obsolete: true
Attachment #8807390 - Flags: feedback?(kmaglione+bmo)
Building the tests on top of patches in bug 1314492
Depends on: 1314492
Comment on attachment 8807749 [details] Bug 1311576 fix webrequest filter for tabId and windowId, https://reviewboard.mozilla.org/r/90792/#review90670 ::: toolkit/components/extensions/test/mochitest/test_ext_webrequest_filter.html:22 (Diff revision 1) > + > +add_task(function* setup() { > + testWindow = window.open("about:blank", "_blank", "width=100,height=100"); > + yield waitForLoad(testWindow); > + > + // fetch the windowId and tabId we need to filter with WebRequest Nit: Please capitalize comments and end with full stop. ::: toolkit/components/extensions/test/mochitest/test_ext_webrequest_filter.html:31 (Diff revision 1) > + "tabs", > + ], > + }, > + background() { > + browser.windows.getCurrent({populate: true}).then(window => { > + browser.test.log(`current window ${window.id} tabs: ${JSON.stringify(window.tabs.map((tab) => { return [tab.id, tab.url]; }))}`); Nit: `.map(tab => [tab.id, tab.url])` ::: toolkit/components/extensions/test/mochitest/test_ext_webrequest_filter.html:38 (Diff revision 1) > + }); > + }, > + }); > + yield extension.startup(); > + windowData = yield extension.awaitMessage("windowData"); > + info(`window is is ${JSON.stringify(windowData)}`); s/is is/is/ ::: toolkit/components/extensions/test/mochitest/test_ext_webrequest_filter.html:48 (Diff revision 1) > + yield SpecialPowers.pushPrefEnv({ > + set: [["dom.serviceWorkers.testing.enabled", true]], > + }); > + > + let events = { > + "onBeforeRequest": [{urls: ["<all_urls>"], windowId: windowData.windowId}, ["blocking", "requestBody"]], Probably best to leave "requestBody" out, and none of these probably need to be blocking.
Attachment #8807749 - Flags: review?(kmaglione+bmo) → review+
Pushed by mixedpuppy@gmail.com: https://hg.mozilla.org/integration/autoland/rev/15886f6c3dd1 fix webrequest filter for tabId and windowId, r=kmag
Kris, can you look at the test changes in the last push to review?
Flags: needinfo?(mixedpuppy) → needinfo?(kmaglione+bmo)
Comment on attachment 8807749 [details] Bug 1311576 fix webrequest filter for tabId and windowId, https://reviewboard.mozilla.org/r/90792/#review93290 ::: toolkit/components/extensions/test/mochitest/head_webrequest.js:163 (Diff revisions 4 - 5) > let expectedEvent = expected.events[0] == name; > if (expectedEvent) { > expected.events.shift(); > } else { > - expectedEvent = expected.optional_events[0] == name; > - if (expectedEvent) { > + // e10s vs. non-e10s errors can end with either onCompleted or onErrorOccurred > + expectedEvent = expected.optional_events.indexOf(name) >= 0; `expected.optional_events.includes(name)`
Looks OK to me
Flags: needinfo?(kmaglione+bmo)
Pushed by mixedpuppy@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b227cc95b6d9 fix webrequest filter for tabId and windowId, r=kmag
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
I've updated the compat data for this change. I think that's all we need, so am marking this dev-doc complete.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: