[SOLVED] WebExtensions: webRequest.onHeadersReceived callback not being called in 54 for iframes

chrome.webRequest.onHeadersReceived.addListener(function (details) {
  console.log('headers received!');
  return { responseHeaders: details.responseHeaders.filter(function (header) {
      return HEADERS_TO_STRIP_LOWERCASE.indexOf(header.name.toLowerCase()) < 0;
    }) };
}, { urls: ["*://*.netflix.com/*"] }, ["blocking", "responseHeaders"]);

manifest:

"permissions": [
    "webRequest",
    "webRequestBlocking",
    "*://*.netflix.com/*"
  ],

This seems to not fire for requests made by an iframe (ie an iframe pointed to netflix.com in this case). If you navigate directly to netflix.com the callback does trigger as expected.

This was working in 53, fwiw.

Any ideas?

EDIT: For future reference, https://bugzilla.mozilla.org/show_bug.cgi?id=1311815 is applicable here. You’ll have to add permissions for the embedding page as well as requested resource.

1 Like