- Revision
- 233379
- Author
- [email protected]
- Date
- 2018-06-29 17:06:25 -0700 (Fri, 29 Jun 2018)
Log Message
[macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
https://bugs.webkit.org/show_bug.cgi?id=187183
Patch by Aditya Keerthi <[email protected]> on 2018-06-29
Reviewed by Wenson Hsieh.
Source/WebKit:
r210683 introduced logic to prevent file URLs from being copied to the clipboard
in unexpected cases. The current logic always crashes the WebProcess if
webProcessProxy->checkURLReceivedFromWebProcess returns false. Instead of
crashing, we can fail silently and not copy anything to the clipboard.
* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::setPasteboardPathnamesForType): Removed call to markCurrentlyDispatchedMessageAsInvalid() which was causing the process to crash.
Tools:
Added a 'runSingly' option to the TestOptions struct. Setting this option to true
will force a new PlatformWebView to be created before running a test. This ensures
that any state set by previous tests are not preserved.
One example of the importance of having this ability is in the case where we want
to test functionality that deals with read access to files. If a test were to
load a valid file URL, universal read access will be granted in WebProcessProxy.
This prevents us from testing cases that rely on us not have universal read
access. Now, if we write the test using the 'runSingly' option, any state set
by previous tests is cleared. Consequently, our test will behave as expected.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):
LayoutTests:
Added a test to ensure that the WebProcess does not crash if we attempt to copy a
file URL to the clipboard. The test also ensures the clipboard content remains
unchanged.
* TestExpectations:
* http/tests/security/pasteboard-file-url-expected.txt: Added.
* http/tests/security/pasteboard-file-url.html: Added.
* platform/mac-wk2/TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (233378 => 233379)
--- trunk/LayoutTests/ChangeLog 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/LayoutTests/ChangeLog 2018-06-30 00:06:25 UTC (rev 233379)
@@ -1,3 +1,19 @@
+2018-06-29 Aditya Keerthi <[email protected]>
+
+ [macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
+ https://bugs.webkit.org/show_bug.cgi?id=187183
+
+ Reviewed by Wenson Hsieh.
+
+ Added a test to ensure that the WebProcess does not crash if we attempt to copy a
+ file URL to the clipboard. The test also ensures the clipboard content remains
+ unchanged.
+
+ * TestExpectations:
+ * http/tests/security/pasteboard-file-url-expected.txt: Added.
+ * http/tests/security/pasteboard-file-url.html: Added.
+ * platform/mac-wk2/TestExpectations:
+
2018-06-29 Nan Wang <[email protected]>
AX: [iOS] VoiceOver scroll position is jumpy in frames
Modified: trunk/LayoutTests/TestExpectations (233378 => 233379)
--- trunk/LayoutTests/TestExpectations 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/LayoutTests/TestExpectations 2018-06-30 00:06:25 UTC (rev 233379)
@@ -2184,3 +2184,5 @@
webkit.org/b/179176 svg/wicd/test-rightsizing-a.xhtml [ Pass Failure ]
webkit.org/b/172864 imported/blink/storage/indexeddb/blob-delete-objectstore-db.html [ Pass Timeout ]
+
+webkit.org/b/187183 http/tests/security/pasteboard-file-url.html [ Skip ]
Added: trunk/LayoutTests/http/tests/security/pasteboard-file-url-expected.txt (0 => 233379)
--- trunk/LayoutTests/http/tests/security/pasteboard-file-url-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/security/pasteboard-file-url-expected.txt 2018-06-30 00:06:25 UTC (rev 233379)
@@ -0,0 +1,3 @@
+File URLs should not be copied to the clipboard. There should be no pasted content below.
+
+
Added: trunk/LayoutTests/http/tests/security/pasteboard-file-url.html (0 => 233379)
--- trunk/LayoutTests/http/tests/security/pasteboard-file-url.html (rev 0)
+++ trunk/LayoutTests/http/tests/security/pasteboard-file-url.html 2018-06-30 00:06:25 UTC (rev 233379)
@@ -0,0 +1,38 @@
+<!DOCTYPE html><!-- webkit-test-runner [ runSingly=true ] -->
+<html>
+<head>
+<script>
+function runTest()
+{
+ if (window.testRunner && window.eventSender) {
+ testRunner.dumpAsText();
+
+ const link = document.getElementById("link");
+ const x = link.offsetLeft + link.offsetWidth / 2;
+ const y = link.offsetTop + link.offsetHeight / 2;
+
+ eventSender.mouseMoveTo(x, y);
+ items = eventSender.contextClick();
+
+ link.href = '';
+
+ for (var i = 0; i < items.length; i++)
+ {
+ if (items[i].title.match("Copy Link")) {
+ items[i].click();
+ }
+ }
+
+ const pastedContent = document.getElementById("pasted-content");
+ pastedContent.focus();
+ document.execCommand("paste");
+ }
+}
+</script>
+</head>
+<body _onload_="runTest();">
+ <a id="link" href='' style='background: #000000; display: block; width: 200px; height: 200px;'></a>
+ <p id="description">File URLs should not be copied to the clipboard. There should be no pasted content below.</p>
+ <input id="pasted-content"/>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (233378 => 233379)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2018-06-30 00:06:25 UTC (rev 233379)
@@ -62,6 +62,8 @@
http/tests/security/contentSecurityPolicy/manifest-src-blocked.html [ Pass ]
applicationmanifest/ [ Pass ]
+webkit.org/b/187183 http/tests/security/pasteboard-file-url.html [ Pass ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
#//////////////////////////////////////////////////////////////////////////////////////////
Modified: trunk/Source/WebKit/ChangeLog (233378 => 233379)
--- trunk/Source/WebKit/ChangeLog 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/Source/WebKit/ChangeLog 2018-06-30 00:06:25 UTC (rev 233379)
@@ -1,3 +1,18 @@
+2018-06-29 Aditya Keerthi <[email protected]>
+
+ [macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
+ https://bugs.webkit.org/show_bug.cgi?id=187183
+
+ Reviewed by Wenson Hsieh.
+
+ r210683 introduced logic to prevent file URLs from being copied to the clipboard
+ in unexpected cases. The current logic always crashes the WebProcess if
+ webProcessProxy->checkURLReceivedFromWebProcess returns false. Instead of
+ crashing, we can fail silently and not copy anything to the clipboard.
+
+ * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+ (WebKit::WebPasteboardProxy::setPasteboardPathnamesForType): Removed call to markCurrentlyDispatchedMessageAsInvalid() which was causing the process to crash.
+
2018-06-29 Chris Dumez <[email protected]>
Regression(r233359): Caused ITP tests to be flaky
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (233378 => 233379)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm 2018-06-30 00:06:25 UTC (rev 233379)
@@ -128,7 +128,6 @@
for (const auto& pathname : pathnames) {
if (!webProcessProxy->checkURLReceivedFromWebProcess(pathname)) {
- connection.markCurrentlyDispatchedMessageAsInvalid();
newChangeCount = 0;
return;
}
Modified: trunk/Tools/ChangeLog (233378 => 233379)
--- trunk/Tools/ChangeLog 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/Tools/ChangeLog 2018-06-30 00:06:25 UTC (rev 233379)
@@ -1,3 +1,28 @@
+2018-06-29 Aditya Keerthi <[email protected]>
+
+ [macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
+ https://bugs.webkit.org/show_bug.cgi?id=187183
+
+ Reviewed by Wenson Hsieh.
+
+ Added a 'runSingly' option to the TestOptions struct. Setting this option to true
+ will force a new PlatformWebView to be created before running a test. This ensures
+ that any state set by previous tests are not preserved.
+
+ One example of the importance of having this ability is in the case where we want
+ to test functionality that deals with read access to files. If a test were to
+ load a valid file URL, universal read access will be granted in WebProcessProxy.
+ This prevents us from testing cases that rely on us not have universal read
+ access. Now, if we write the test using the 'runSingly' option, any state set
+ by previous tests is cleared. Consequently, our test will behave as expected.
+
+ * WebKitTestRunner/PlatformWebView.h:
+ (WTR::PlatformWebView::viewSupportsOptions const):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::updateTestOptionsFromTestHeader):
+ * WebKitTestRunner/TestOptions.h:
+ (WTR::TestOptions::hasSameInitializationOptions const):
+
2018-06-29 Daniel Bates <[email protected]>
[lldb-webkit] Non-empty strings may be pretty-printed as empty
Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (233378 => 233379)
--- trunk/Tools/WebKitTestRunner/PlatformWebView.h 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h 2018-06-30 00:06:25 UTC (rev 233379)
@@ -97,7 +97,7 @@
void removeFromWindow();
void addToWindow();
- bool viewSupportsOptions(const TestOptions& options) const { return m_options.hasSameInitializationOptions(options); }
+ bool viewSupportsOptions(const TestOptions& options) const { return !options.runSingly && m_options.hasSameInitializationOptions(options); }
PlatformImage windowSnapshotImage();
const TestOptions& options() const { return m_options; }
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (233378 => 233379)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2018-06-30 00:06:25 UTC (rev 233379)
@@ -1134,6 +1134,8 @@
testOptions.enableColorFilter = parseBooleanTestHeaderValue(value);
else if (key == "jscOptions")
testOptions.jscOptions = value;
+ else if (key == "runSingly")
+ testOptions.runSingly = parseBooleanTestHeaderValue(value);
pairStart = pairEnd + 1;
}
}
Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (233378 => 233379)
--- trunk/Tools/WebKitTestRunner/TestOptions.h 2018-06-30 00:05:36 UTC (rev 233378)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h 2018-06-30 00:06:25 UTC (rev 233379)
@@ -59,6 +59,7 @@
bool enableProcessSwapOnNavigation { false };
bool enableProcessSwapOnWindowOpen { false };
bool enableColorFilter { false };
+ bool runSingly { false };
float deviceScaleFactor { 1 };
Vector<String> overrideLanguages;
@@ -94,7 +95,8 @@
|| enableProcessSwapOnNavigation != options.enableProcessSwapOnNavigation
|| enableProcessSwapOnWindowOpen != options.enableProcessSwapOnWindowOpen
|| enableColorFilter != options.enableColorFilter
- || jscOptions != options.jscOptions)
+ || jscOptions != options.jscOptions
+ || runSingly != options.runSingly)
return false;
return true;