New issue
Advanced search Search tips

Issue 834734 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Jun 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

webRequest hooks called with no initiator info

Project Member Reported by nya@chromium.org, Apr 19 2018

Issue description

Chrome Version: 65.0.3325.181 (Official Build)
OS: macOS Sierra 10.12.6

What steps will reproduce the problem?
(1) In Chrome extension, use webRequest.onBeforeSendHeaders.addListener() to hook outgoing requests.
(2) Send a web request from Chrome extension by fetch().

What is the expected result?

The callback is invoked with initiator = "chrome-extension://<extension-ID>"

What happens instead?

The callback is invoked with initiator = undefined


The documentation [1] says initiator field is available since M63, and until a few days ago it worked for me. I guess it is a bug introduced in M63.

BTW, it works fine on canary (68.0.3400.0).

[1] https://developer.chrome.com/extensions/webRequest#event-onBeforeRequest

 

Comment 1 by nya@chromium.org, Apr 19 2018

Here is a repro code. I also attached a zipped extension.

================ manifest.json
{
  "manifest_version": 2,
  "name": "WebRequest Example",
  "description": "WebRequest Example",
  "version": "1.0.0",
  "background": {
    "scripts": ["background.js"],
    "persistent": true
  },
  "browser_action": {},
  "permissions": [
    "webRequest",
    "https://example.com/*"
  ]
}

================ background.js
function onBeforeSendHeaders(details) {
  console.log(details.initiator);
  console.log(details);
}

function onClicked() {
  fetch('https://example.com/');
}

chrome.webRequest.onBeforeSendHeaders.addListener(
    onBeforeSendHeaders,
    { urls: ['https://example.com/*'] });

chrome.browserAction.onClicked.addListener(onClicked);
crbug834734.zip
885 bytes Download
Owner: karandeepb@chromium.org
Status: Assigned (was: Untriaged)
karandeepb@'s been in the area lately; Karan, mind taking a look?
Status: WontFix (was: Assigned)
I tried this and it didn't reproduce on Stable (67.0.3396.62). Not sure why it didn't work on 65. 

Closing it for now. Please reopen if you see this again.

Sign in to add a comment