Using webRequest.onHeadersReceived causes Edge to download the page rather than navigate

Fixed, flighted Issue #8796739

Details

Created
Sep 8, 2016
Privacy
This issue is public.
Fixed in build #
15016
Reports
Reported by 11 people

Sign in to watch or report this issue.

Steps to reproduce

Sideload an extension that modifies headers inside onHeadersReceived in Edge

Navigate to www.purple.com

Expected

Edge navigates successfully

Actual

Edge downloads the page and does not navigate

Additional Information

This does not occur in Chrome

=========================================================

uBlock-Edge repro steps

The repro steps are pretty simple:

Install
the preview release from the store: 

https://www.microsoft.com/en-us/store/p/app/9nblggh444l4

Turn
it on in Edge

Go
to
http://www.tomshardware.com/

 

Expected: 
The page
loads successfully

Actual: 
The page is
downloaded by the browser

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Venkat K.”

    Changed Assigned To from “Venkat K.” to “Rajat J.”

  • We are seeing a similar error. Modifying the content-type header causes the request to fail (webRequest.onErrorOccurred is triggered) and Edge offers to download the file. This is not the behavior of Chrome.

  • Microsoft Edge Team

    Changed Steps to Reproduce

  • I have added an attachment containing an Extension that demonstrates the problem. The attachment contains both Chrome and Edge versions. The Edge version was created from the Chrome version using the Microsoft Edge Extension Toolkit.

    1. In Edge, load and enable the attached Header Mod Test extension from the “Header Mod Test - Edge” folder. The extension uses webRequest.onHeadersReceived() to change the Content-Type header to “text/html” when it is received as "image/cpi".

    2. Open the following link: http://cartesianinc.com/Demo/CPCStreams/Gilman2.cpi

    If you look at the console, you will see that the after the extension modifies the Content-Type header, the request gets an error via WebRequest.onErrorOccurred:

    TEST MOD ERROR: Error 0x80004004 [object Object] Extension.js (44,13)
    “TEST MOD ERROR: Error 0x80004004”
    {
    [functions]: ,
    proto: { },
    error: "Error 0x80004004",
    frameId: 0,
    fromCache: false,
    ip: "173.203.184.217",
    method: "GET",
    parentFrameId: -1,
    requestId: "1B34-9DDDFD7-2",
    tabId: 2,
    timeStamp: 1482294137498,
    type: "main_frame",
    url: “http://cartesianinc.com/Demo/CPCStreams/CJ961.cpi
    }

    Edge should have rendered the binary data as gibberish text in the current tab. This is what happens in Chrome and Firefox. It is also consistent with the documentation which states that if you modify the headers, "The browser will behave as if the server had sent the modified headers.". The extension changes the Content-Type to "text/html", so the browser should behave as if the server sent the binary data as html.

    We use this feature to implement a Chrome Extension viewer for our proprietary image format (https://chrome.google.com/webstore/detail/cpc-view-web-edition/hlgphhncnghffihkkfalfnjigadphdhk). After the extension changes the content-type, Chrome navigates to the url as if it is ordinary html, and our extension injects a content-script into the incoming binary data that provides the viewer UI and renders the images from the binary data.

    We would like to add support for Edge to our viewer. If modifying the content-type header is not supported in Edge, is there an alternative Extension API that allows an Extension to handle the display of a proprietary mime type?

  • Microsoft Edge Team

    Changed Status to “Confirmed”

    Changed Status from “Confirmed” to “In code review”

    Changed Status from “In code review” to “In progress”

    Changed Assigned To from “Rajat J.” to “Scott L.”

    Changed Status from “In progress” to “Fixed, not yet flighted”

    Changed Status from “Fixed, not yet flighted” to “Fixed, flighted”

  • Hi thank you for fixing this!

    When will this be released? Not familiar with your release cycle.

  • Microsoft Edge Team

    Changed Assigned To to “Rajat J.”

    Changed Status from “Fixed, flighted”

    Changed Steps to Reproduce

    Changed Assigned To from “Rajat J.” to “Scott L.”

    Changed Status to “Fixed, flighted”

You need to sign in to your Microsoft account to add a comment.

Sign in