W3cubDocs

/Web Extensions

webRequest.StreamFilter.status

A string that describes the current status of the request. It will be one of the following values:

"uninitialized"
The filter is not fully initialized. No filter functions may be called.
"transferringdata"
The underlying channel is currently transferring data, which will be routed to the extension in one or more ondata events. The extension can call filter functions such as write(), close(), or disconnect().
"finishedtransferringdata"
The underlying channel has finished transferring data. In this state the extension can still write response data using the filter's write() function.
"suspended"
Data transfer is currently suspended. In this state the extension can resume the request by calling the filter's resume() function, and can write response data using the filter's write() function.
"closed"
The extension has closed the request by calling the filter's close() function. The filter will not fire any more events, and the extension may not call any filter functions.
"disconnected"
The extension has disconnected the filter from the request by calling the filter's disconnect() function. All further data will be delivered directly, without passing through the filter. The filter will not fire any more events, and the extension may not call any filter functions.
"failed"
An error has occurred and the filter has been disconnected from the request. The extension can find an error message in error, and may not call any filter functions.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
status
No
No
57
?
No
No
?
?
57
?
?
?

Examples

function listener(details) {
  let filter = browser.webRequest.filterResponseData(details.requestId);
  console.log(filter.status);          // uninitialized

  filter.onstart = event => {
    console.log(filter.status);        // transferringdata
  }

  filter.ondata = event => {
    console.log(filter.status);        // transferringdata
    // pass through the response data
    filter.write(event.data);
  }

  filter.onstop = event => {
    console.log(filter.status);        // finishedtransferringdata
    filter.disconnect();
    console.log(filter.status);        // disconnected
  }
}

browser.webRequest.onBeforeRequest.addListener(
  listener,
  {urls: ["https://example.com/*"], types: ["main_frame"]},
  ["blocking"]
);

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/StreamFilter/status