Title: [169226] branches/safari-537.77-branch

Diff

Modified: branches/safari-537.77-branch/LayoutTests/ChangeLog (169225 => 169226)


--- branches/safari-537.77-branch/LayoutTests/ChangeLog	2014-05-22 22:43:07 UTC (rev 169225)
+++ branches/safari-537.77-branch/LayoutTests/ChangeLog	2014-05-22 23:34:16 UTC (rev 169226)
@@ -1,3 +1,18 @@
+2014-05-22  Lucas Forschler  <[email protected]>
+
+        Merge r168636
+
+    2014-05-12  Martin Hock  <[email protected]>
+
+            Disallow drag and drop of non-displayable resources.
+            https://bugs.webkit.org/show_bug.cgi?id=132745
+            <rdar://problem/10562662>
+
+            Reviewed by Alexey Proskuryakov.
+
+            * http/tests/security/drag-drop-local-file-expected.txt: Added.
+            * http/tests/security/drag-drop-local-file.html: Added.
+
 2014-05-22  Dana Burkart  <[email protected]>
 
         Merge r168641

Copied: branches/safari-537.77-branch/LayoutTests/http/tests/security/drag-drop-local-file-expected.txt (from rev 168636, trunk/LayoutTests/http/tests/security/drag-drop-local-file-expected.txt) (0 => 169226)


--- branches/safari-537.77-branch/LayoutTests/http/tests/security/drag-drop-local-file-expected.txt	                        (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/http/tests/security/drag-drop-local-file-expected.txt	2014-05-22 23:34:16 UTC (rev 169226)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: Not allowed to drag local resource: foobar
+ALERT: PASS
+Dragme 

Copied: branches/safari-537.77-branch/LayoutTests/http/tests/security/drag-drop-local-file.html (from rev 168636, trunk/LayoutTests/http/tests/security/drag-drop-local-file.html) (0 => 169226)


--- branches/safari-537.77-branch/LayoutTests/http/tests/security/drag-drop-local-file.html	                        (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/http/tests/security/drag-drop-local-file.html	2014-05-22 23:34:16 UTC (rev 169226)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function moveToCenter(element)
+{
+    x = element.offsetParent.offsetLeft + element.offsetLeft + element.offsetWidth / 2;
+    y = element.offsetParent.offsetTop + element.offsetTop + element.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+}
+
+function runTest() {
+
+    var x, y;
+    var span = document.getElementById("span");
+    moveToCenter(span);
+    eventSender.mouseDown();
+    eventSender.leapForward(500);
+    var input = document.getElementById("target");
+    moveToCenter(input);
+    eventSender.leapForward(500);
+    eventSender.mouseUp();
+
+    input.contentWindow.postMessage("go", "*");
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<span id="span"><a href=""
+<iframe id="target" src=""
+</body>
+</html>

Modified: branches/safari-537.77-branch/Source/WebCore/ChangeLog (169225 => 169226)


--- branches/safari-537.77-branch/Source/WebCore/ChangeLog	2014-05-22 22:43:07 UTC (rev 169225)
+++ branches/safari-537.77-branch/Source/WebCore/ChangeLog	2014-05-22 23:34:16 UTC (rev 169226)
@@ -1,5 +1,22 @@
 2014-05-22  Lucas Forschler  <[email protected]>
 
+        Merge r168636
+
+    2014-05-12  Martin Hock  <[email protected]>
+
+            Disallow drag and drop of non-displayable resources.
+            https://bugs.webkit.org/show_bug.cgi?id=132745
+            <rdar://problem/10562662>
+
+            Reviewed by Alexey Proskuryakov.
+
+            Test: http/tests/security/drag-drop-local-file.html
+
+            * page/DragController.cpp:
+            (WebCore::DragController::startDrag):
+
+2014-05-22  Lucas Forschler  <[email protected]>
+
         Merge r166741
 
     2014-04-02  Simon Fraser  <[email protected]>

Modified: branches/safari-537.77-branch/Source/WebCore/page/DragController.cpp (169225 => 169226)


--- branches/safari-537.77-branch/Source/WebCore/page/DragController.cpp	2014-05-22 22:43:07 UTC (rev 169225)
+++ branches/safari-537.77-branch/Source/WebCore/page/DragController.cpp	2014-05-22 23:34:16 UTC (rev 169226)
@@ -808,6 +808,9 @@
             m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
         }
         doSystemDrag(dragImage, dragLoc, dragOrigin, clipboard, src, false);
+    } else if (!src->document()->securityOrigin()->canDisplay(linkURL)) {
+         src->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, "Not allowed to drag local resource: " + linkURL.stringCenterEllipsizedToLength());
+         startedDrag = false;
     } else if (!imageURL.isEmpty() && element && image && !image->isNull()
                && (m_dragSourceAction & DragSourceActionImage)) {
         // We shouldn't be starting a drag for an image that can't provide an extension.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to