Bug 1530408 Comment 37 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Ok, I have a solution, though kinda hacky IMO.

We need to stop the block that decides to load alt-data[1].  I can do that by inserting the following before attaching our stream listener[2].  If I wait till later (when we call setNewListener) the cache decision has already won that race.

```
  // Disable alt-data for extension stream listeners.
  nsCOMPtr<nsIHttpChannelInternal> internal = do_QueryInterface(chan);
  internal->SetAltDataForChild(false);
```

[1] https://searchfox.org/mozilla-central/rev/b712398b7fae54ef377a558d6f16dede7a7f8530/netwerk/protocol/http/nsHttpChannel.cpp#5122-5132
[2] https://searchfox.org/mozilla-central/rev/b712398b7fae54ef377a558d6f16dede7a7f8530/toolkit/components/extensions/webrequest/StreamFilterParent.cpp#139
Ok, I have a solution, though kinda hacky IMO.

We need to stop the block that decides to load alt-data[1].  I can do that by inserting the following before attaching our stream listener[2].  If I wait till later (when we call setNewListener) the cache decision has already won that race.  Note that this also requires the extension to create the filter in onBeforeRequest, rather than onHeadersReceived.  It seems to me that this could also be a performance hit (bypassing the bytecode cache).

```
  // Disable alt-data for extension stream listeners.
  nsCOMPtr<nsIHttpChannelInternal> internal = do_QueryInterface(chan);
  internal->SetAltDataForChild(false);
```

[1] https://searchfox.org/mozilla-central/rev/b712398b7fae54ef377a558d6f16dede7a7f8530/netwerk/protocol/http/nsHttpChannel.cpp#5122-5132
[2] https://searchfox.org/mozilla-central/rev/b712398b7fae54ef377a558d6f16dede7a7f8530/toolkit/components/extensions/webrequest/StreamFilterParent.cpp#139

Back to Bug 1530408 Comment 37