Diff
Modified: trunk/LayoutTests/ChangeLog (120493 => 120494)
--- trunk/LayoutTests/ChangeLog 2012-06-15 21:34:52 UTC (rev 120493)
+++ trunk/LayoutTests/ChangeLog 2012-06-15 21:45:08 UTC (rev 120494)
@@ -1,5 +1,17 @@
2012-06-15 Jian Li <[email protected]>
+ [File API] FileReader should work in sandbox iframe
+ https://bugs.webkit.org/show_bug.cgi?id=89242
+
+ Reviewed by Adam Barth.
+
+ * fast/files/file-reader-file-url.html:
+ * fast/files/file-reader-sandbox-iframe-expected.txt: Added.
+ * fast/files/file-reader-sandbox-iframe.html: Added.
+ * fast/files/resources/file-reader-real.html: Renamed from LayoutTests/fast/files/resources/file-reader-file-url-iframe.html.
+
+2012-06-15 Jian Li <[email protected]>
+
http/tests/fileapi/create-blob-url-from-data-url.html fails
https://bugs.webkit.org/show_bug.cgi?id=89149
Modified: trunk/LayoutTests/fast/files/file-reader-file-url.html (120493 => 120494)
--- trunk/LayoutTests/fast/files/file-reader-file-url.html 2012-06-15 21:34:52 UTC (rev 120493)
+++ trunk/LayoutTests/fast/files/file-reader-file-url.html 2012-06-15 21:45:08 UTC (rev 120494)
@@ -10,7 +10,7 @@
</script>
</head>
<body>
-<iframe src=""
+<iframe src=""
<div id="results"></div>
Test that FileReader works under the file URL with file path separation enforced.
</body>
Added: trunk/LayoutTests/fast/files/file-reader-sandbox-iframe-expected.txt (0 => 120494)
--- trunk/LayoutTests/fast/files/file-reader-sandbox-iframe-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/files/file-reader-sandbox-iframe-expected.txt 2012-06-15 21:45:08 UTC (rev 120494)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 9: Received data: 0123456789
+
+Test that FileReader works under the sandboxed iframe.
Copied: trunk/LayoutTests/fast/files/file-reader-sandbox-iframe.html (from rev 120493, trunk/LayoutTests/fast/files/file-reader-file-url.html) (0 => 120494)
--- trunk/LayoutTests/fast/files/file-reader-sandbox-iframe.html (rev 0)
+++ trunk/LayoutTests/fast/files/file-reader-sandbox-iframe.html 2012-06-15 21:45:08 UTC (rev 120494)
@@ -0,0 +1,17 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.setAllowUniversalAccessFromFileURLs(false);
+ layoutTestController.setAllowFileAccessFromFileURLs(false);
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+</script>
+</head>
+<body>
+<iframe src="" sandbox="allow-scripts"></iframe>
+<div id="results"></div>
+Test that FileReader works under the sandboxed iframe.
+</body>
+</html>
Deleted: trunk/LayoutTests/fast/files/resources/file-reader-file-url-iframe.html (120493 => 120494)
--- trunk/LayoutTests/fast/files/resources/file-reader-file-url-iframe.html 2012-06-15 21:34:52 UTC (rev 120493)
+++ trunk/LayoutTests/fast/files/resources/file-reader-file-url-iframe.html 2012-06-15 21:45:08 UTC (rev 120494)
@@ -1,25 +0,0 @@
-<html>
-<head>
-<script>
-function runTest()
-{
- var blob = new Blob(["0123456789"]);
- var reader = new FileReader();
- reader._onload_ = function(event) {
- console.log("Received data: " + event.target.result);
- }
- reader._onloadend_ = function() {
- if (window.layoutTestController)
- layoutTestController.notifyDone();
- }
- reader._onerror_ = function(event) {
- console.log("Received error event: " + event.target.error.code);
- };
- reader.readAsText(blob);
-}
-
-</script>
-</head>
-<body _onload_="runTest()">
-</body>
-</html>
Copied: trunk/LayoutTests/fast/files/resources/file-reader-real.html (from rev 120493, trunk/LayoutTests/fast/files/resources/file-reader-file-url-iframe.html) (0 => 120494)
--- trunk/LayoutTests/fast/files/resources/file-reader-real.html (rev 0)
+++ trunk/LayoutTests/fast/files/resources/file-reader-real.html 2012-06-15 21:45:08 UTC (rev 120494)
@@ -0,0 +1,25 @@
+<html>
+<head>
+<script>
+function runTest()
+{
+ var blob = new Blob(["0123456789"]);
+ var reader = new FileReader();
+ reader._onload_ = function(event) {
+ console.log("Received data: " + event.target.result);
+ }
+ reader._onloadend_ = function() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ reader._onerror_ = function(event) {
+ console.log("Received error event: " + event.target.error.code);
+ };
+ reader.readAsText(blob);
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (120493 => 120494)
--- trunk/Source/WebCore/ChangeLog 2012-06-15 21:34:52 UTC (rev 120493)
+++ trunk/Source/WebCore/ChangeLog 2012-06-15 21:45:08 UTC (rev 120494)
@@ -1,3 +1,17 @@
+2012-06-15 Jian Li <[email protected]>
+
+ [File API] FileReader should work in sandbox iframe
+ https://bugs.webkit.org/show_bug.cgi?id=89242
+
+ Reviewed by Adam Barth.
+
+ Test: fast/files/file-reader-sandbox-iframe.html
+
+ * fileapi/ThreadableBlobRegistry.cpp: Should remove from map for all threads.
+ (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
+ * page/SecurityOrigin.cpp:
+ (WebCore::SecurityOrigin::canRequest): Check and use cached origin for blob URL first.
+
2012-06-15 David Barton <[email protected]>
Inherit style changes in MathML anonymous renderers
Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (120493 => 120494)
--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp 2012-06-15 21:34:52 UTC (rev 120493)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp 2012-06-15 21:45:08 UTC (rev 120494)
@@ -123,10 +123,12 @@
void ThreadableBlobRegistry::unregisterBlobURL(const KURL& url)
{
- if (isMainThread()) {
+ if (BlobURL::getOrigin(url) == "null")
originMap()->remove(url.string());
+
+ if (isMainThread())
blobRegistry().unregisterBlobURL(url);
- } else {
+ else {
OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url));
callOnMainThread(&unregisterBlobURLTask, context.leakPtr());
}
Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (120493 => 120494)
--- trunk/Source/WebCore/page/SecurityOrigin.cpp 2012-06-15 21:34:52 UTC (rev 120493)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp 2012-06-15 21:45:08 UTC (rev 120494)
@@ -299,6 +299,9 @@
if (m_universalAccess)
return true;
+ if (getCachedOrigin(url) == this)
+ return true;
+
if (isUnique())
return false;