Closed Bug 1404408 Opened 7 years ago Closed 6 years ago

StreamFilter onstop is not called when filter.close is called.

Categories

(WebExtensions :: Request Handling, defect, P3)

57 Branch
defect

Tracking

(firefox57 affected)

RESOLVED WORKSFORME
Tracking Status
firefox57 --- affected

People

(Reporter: robwu, Unassigned)

References

Details

Attachments

(1 file)

When I load a http:-URL in a document and suspend and close the filter as shown below, then the document gets stuck at loading.

let filter = browser.webRequest.filterResponseData(details.requestId);
filter.onstart = () => {
  filter.suspend();
  filter.resume(); // <-- Adding/removing this makes no difference.
  filter.close();
};


STR:
1. Load attached extension.
2. click on the extension button to load a test page.
3. Look at the page.
4. Look at the console.

Expected:
At step 3: The document should stop loading (and be blank).
At step 4: The console should show print: filter.onstart, filter.onstop

Actual:
At step 3: The document loads forever, the status bar shows "Transferring data from example.com..."
At step 4: The console only shows the filter.onstart event.

While running the above steps, stderr contains:
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost


More info:
- I tried to schedule filter.close later, e.g. in a microtask (Promise) or macrotask (setTimeout), but the problem still occurs. Only when I moved the filter.close call inside filter.ondata, the problem disappeared.

- This problem only happens with http:, not with https:.


Tested with Firefox Nightly 58.0a1 build ID 20170926100259 on ArchLinux.
Can you give this a priority please Kris.
Flags: needinfo?(kmaglione+bmo)
Guessing at P2, but waiting for comment 2.
Priority: -- → P2
The problem with document loading finishing no longer occurs, however you still do not see any logging from onerror or onstop.  Leaving ni? for kris.
Priority: P2 → P3
Summary: Documents from http:-URLs get stuck at loading when a suspended StreamFilter is closed before ondata event → StreamFilter onstop is not called when filter.close is called.
onstop is intentionally not called after close()
Flags: needinfo?(kmaglione+bmo)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: