[webkit-dev] Issue regarding Same Origin check with Blobs and XMLHttpRequest

Adam Barth abarth at webkit.org
Thu May 10 10:30:54 PDT 2012


[webkit-dev -> bcc]

What URL are you trying to load?  The error message doesn't say.  I
wonder if you're trying to load a relative URL, which is trying to be
resolved relative to the blob URL.  It might work better with an
absolute URL.

Adam


On Thu, May 10, 2012 at 1:32 AM, Vishal Shah <vishal at sokrati.com> wrote:
> Hello,
>
> I have implemented a web worker that handles XMLHttpRequest object for my
> application
> When I create a separate *.js file for the worker's script it works
> perfectly fine.
> However, when trying to instantiate the worker using a Blob, Chrome throws
> an error as follows:
>
> XMLHttpRequest cannot load . Cross origin requests are only supported for
> HTTP.
>
> The URL of the blob is
> "blob:http%3A//localhost%3A8080/047cca65-b588-4077-a81d-84e772dde20d" which
> when decoded is
> "blob:http://localhost:8080/047cca65-b588-4077-a81d-84e772dde20d"
> And my application is also running at localhost:8080
>
> I think somehow the same origin check is failing for the blob.
> Following is the code snippet I am trying to implement:
>
>             var blobBuilder, blobBuilderClass, blobURL, urlClass, worker;
>             blobBuilderClass = wObj.BlobBuilder || wObj.WebKitBlobBuilder ||
> wObj.MozBlobBuilder;
>             urlClass = wObj.URL || wObj.webkitURL;
>             blobBuilder = new blobBuilderClass();
>             blobBuilder.append(workerFunction.toString() +
> ";\nworkerFunction();");
>             blobURL = urlClass.createObjectURL(blobBuilder.getBlob());
>
>             worker = new Worker(blobURL);
>             urlClass.revokeObjectURL(blobURL);
>
> Am I doing anything wrong here or is it a known bug in Chrome?
>
> Please suggest. References to any related article will be helpful.
> If this is not the correct list to be contacted, please suggest me the
> correct one.
>
> Thanks and Regards,
> Vishal Shah
> Sokrati Inc.
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>


More information about the webkit-dev mailing list