[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jianli at chromium.org
jianli at chromium.org
Wed Dec 22 12:52:08 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b147efa50a4f494e0e476880e02c453f78bfe337
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 31 21:33:52 2010 +0000
Expose WorkerContext.createBlobURL and WorkerContext.revokeBlobURL.
https://bugs.webkit.org/show_bug.cgi?id=44972
Reviewed by David Levin.
WebCore:
Test: fast/files/workers/worker-apply-blob-url-to-xhr.html
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::canRequest):
* workers/WorkerContext.cpp:
(WebCore::WorkerContext::createBlobURL):
(WebCore::WorkerContext::revokeBlobURL):
* workers/WorkerContext.h:
* workers/WorkerContext.idl:
LayoutTests:
* fast/files/workers/resources/worker-apply-blob-url-to-xhr.js: Added.
* fast/files/workers/worker-apply-blob-url-to-xhr-expected.txt: Added.
* fast/files/workers/worker-apply-blob-url-to-xhr.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3fe913b..0ae743f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-31 Jian Li <jianli at chromium.org>
+
+ Reviewed by David Levin.
+
+ Expose WorkerContext.createBlobURL and WorkerContext.revokeBlobURL.
+ https://bugs.webkit.org/show_bug.cgi?id=44972
+
+ * fast/files/workers/resources/worker-apply-blob-url-to-xhr.js: Added.
+ * fast/files/workers/worker-apply-blob-url-to-xhr-expected.txt: Added.
+ * fast/files/workers/worker-apply-blob-url-to-xhr.html: Added.
+
2010-08-31 Ilya Tikhonovsky <loislo at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/LayoutTests/fast/files/workers/resources/worker-apply-blob-url-to-xhr.js b/LayoutTests/fast/files/workers/resources/worker-apply-blob-url-to-xhr.js
new file mode 100644
index 0000000..60e302d
--- /dev/null
+++ b/LayoutTests/fast/files/workers/resources/worker-apply-blob-url-to-xhr.js
@@ -0,0 +1,28 @@
+function log(message)
+{
+ postMessage(message);
+}
+
+onmessage = function(event)
+{
+ var file = event.data;
+ var fileURL = createBlobURL(file);
+
+ log("Test that XMLHttpRequest GET succeeds.");
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", fileURL, false);
+ xhr.send();
+ log(xhr.responseText);
+
+ log("Test that XMLHttpRequest POST fails.");
+ xhr = new XMLHttpRequest();
+ xhr.open("POST", fileURL, false);
+ try {
+ xhr.send();
+ } catch (error) {
+ log("Received exception " + error.code + ": " + error.name);
+ }
+ log(xhr.responseText);
+
+ log("DONE");
+}
diff --git a/LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt b/LayoutTests/fast/files/workers/worker-apply-blob-url-to-xhr-expected.txt
similarity index 100%
copy from LayoutTests/fast/files/apply-blob-url-to-xhr-expected.txt
copy to LayoutTests/fast/files/workers/worker-apply-blob-url-to-xhr-expected.txt
diff --git a/LayoutTests/fast/files/workers/worker-apply-blob-url-to-xhr.html b/LayoutTests/fast/files/workers/worker-apply-blob-url-to-xhr.html
new file mode 100644
index 0000000..ca0338a
--- /dev/null
+++ b/LayoutTests/fast/files/workers/worker-apply-blob-url-to-xhr.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<body>
+<input type="file" name="file" id="file" onchange="onInputFileChange()">
+<pre id='console'></pre>
+
+<script>
+function log(message)
+{
+ document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
+}
+
+function onInputFileChange()
+{
+ var file = document.getElementById("file").files[0];
+ var worker = new Worker("resources/worker-apply-blob-url-to-xhr.js");
+ worker.onmessage = function(event)
+ {
+ log(event.data);
+ if (event.data == "DONE") {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ }
+ worker.onerror = function(event)
+ {
+ log("Received error from worker: " + event.message);
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ worker.postMessage(file);
+}
+
+function runTests()
+{
+ eventSender.beginDragWithFiles(['../resources/UTF8.txt']);
+ eventSender.mouseMoveTo(10, 10);
+ eventSender.mouseUp();
+}
+
+if (window.eventSender) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ window.onload = runTests;
+}
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6074bf0..20ec293 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-31 Jian Li <jianli at chromium.org>
+
+ Reviewed by David Levin.
+
+ Expose WorkerContext.createBlobURL and WorkerContext.revokeBlobURL.
+ https://bugs.webkit.org/show_bug.cgi?id=44972
+
+ Test: fast/files/workers/worker-apply-blob-url-to-xhr.html
+
+ * page/SecurityOrigin.cpp:
+ (WebCore::SecurityOrigin::canRequest):
+ * workers/WorkerContext.cpp:
+ (WebCore::WorkerContext::createBlobURL):
+ (WebCore::WorkerContext::revokeBlobURL):
+ * workers/WorkerContext.h:
+ * workers/WorkerContext.idl:
+
2010-08-31 Darin Adler <darin at apple.com>
Reviewed by Anders Carlsson.
diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp
index 5b51501..6edf32a 100644
--- a/WebCore/page/SecurityOrigin.cpp
+++ b/WebCore/page/SecurityOrigin.cpp
@@ -236,7 +236,13 @@ bool SecurityOrigin::canRequest(const KURL& url) const
return false;
RefPtr<SecurityOrigin> targetOrigin = SecurityOrigin::create(url);
- if (targetOrigin->isUnique())
+
+ bool doUniqueOriginCheck = true;
+#if ENABLE(BLOB)
+ // For blob scheme, we want to ignore this check.
+ doUniqueOriginCheck = !url.protocolIs("blob");
+#endif
+ if (doUniqueOriginCheck && targetOrigin->isUnique())
return false;
// We call isSameSchemeHostPort here instead of canAccess because we want
diff --git a/WebCore/workers/WorkerContext.cpp b/WebCore/workers/WorkerContext.cpp
index 36a9f94..b52b285 100644
--- a/WebCore/workers/WorkerContext.cpp
+++ b/WebCore/workers/WorkerContext.cpp
@@ -43,6 +43,7 @@
#include "Event.h"
#include "EventException.h"
#include "InspectorController.h"
+#include "KURL.h"
#include "MessagePort.h"
#include "NotImplemented.h"
#include "ScriptSourceCode.h"
@@ -322,6 +323,18 @@ EventTargetData* WorkerContext::ensureEventTargetData()
return &m_eventTargetData;
}
+#if ENABLE(BLOB)
+String WorkerContext::createBlobURL(Blob* blob)
+{
+ return scriptExecutionContext()->createPublicBlobURL(blob).string();
+}
+
+void WorkerContext::revokeBlobURL(const String& blobURLString)
+{
+ scriptExecutionContext()->revokePublicBlobURL(KURL(ParsedURLString, blobURLString));
+}
+#endif
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h
index 9e9e54f..7fb8b46 100644
--- a/WebCore/workers/WorkerContext.h
+++ b/WebCore/workers/WorkerContext.h
@@ -43,6 +43,7 @@
namespace WebCore {
+ class Blob;
class Database;
class DatabaseCallback;
class DatabaseSync;
@@ -115,6 +116,10 @@ namespace WebCore {
virtual bool isContextThread() const;
virtual bool isJSExecutionTerminated() const;
+#if ENABLE(BLOB)
+ String createBlobURL(Blob*);
+ void revokeBlobURL(const String&);
+#endif
// These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in
// JSWorkerContextCustom.cpp.
diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl
index 81a681a..02aa4ad 100644
--- a/WebCore/workers/WorkerContext.idl
+++ b/WebCore/workers/WorkerContext.idl
@@ -101,6 +101,8 @@ module threads {
attribute BlobBuilderConstructor BlobBuilder;
attribute FileReaderConstructor FileReader;
attribute FileReaderSyncConstructor FileReaderSync;
+ DOMString createBlobURL(in Blob blob);
+ void revokeBlobURL(in DOMString blobURL);
#endif
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list