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

Vishal Shah vishal at sokrati.com
Thu May 10 01:32:25 PDT 2012


I have implemented a web worker that handles XMLHttpRequest object for my
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

The URL of the blob is
"blob:http%3A//localhost%3A8080/047cca65-b588-4077-a81d-84e772dde20d" which
when decoded is "blob:
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() +
            blobURL = urlClass.createObjectURL(blobBuilder.getBlob());

            worker = new Worker(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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20120510/add65d49/attachment.html>

More information about the webkit-dev mailing list