Skip to content

CEF3: Support cross-origin XMLHttpRequest loads and redirects for custom standard schemes when enabled via the cross-origin whitelist #950

Description

@magreenblatt

Original report by me.


Original issue 950 created by magreenblatt on 2013-04-18T17:36:42.000Z:

What steps will reproduce the problem?

  1. Register a custom standard scheme (for example, "myscheme").
  2. Attempt an XMLHttpRequest (XHR) where the target URL redirects to a different origin. For example:

A. Add a cross-origin whitelist entry for the domains (current origin is "myscheme://mydomain"):

CefAddCrossOriginWhitelistEntry("myscheme://mydomain", "myscheme", "mydomain2", false);

B. Send an XHR request where "myscheme://mydomain/xhr.html" redirects to "myscheme://mydomain2/xhr.html":

xhr = new XMLHttpRequest();
xhr.open("GET", "myscheme://mydomain/xhr.html", true);
xhr.onload = function(e) { ... }
xhr.send();

What is the expected output? What do you see instead?
The request should succeed. Instead, the request fails.

There are a few different problems here:

  1. Custom standard schemes are not currently registered as CORS-enabled so all CORS checks fail immediately.

  2. All synchronous cross-origin XHR redirects are denied in SyncResourceHandler::OnRequestRedirected().

  3. Asynchronous cross-origin XHR redirects are filtered based on CORS restrictions in DocumentThreadableLoader::redirectReceived(). However, some redirects are handled internally using URLRequestRedirectJob (for example, changing the URL in CefRequestHandler::OnBeforeResourceLoad) and there is no opportunity for the client to add the necessary CORS headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions