Title: [255640] branches/safari-610.1.1-branch
- Revision
- 255640
- Author
- [email protected]
- Date
- 2020-02-03 19:09:07 -0800 (Mon, 03 Feb 2020)
Log Message
Cherry-pick r254950. rdar://problem/58544942
REGRESSION (r253519): [WKWebView evaluateJavaScript:completionHandler:] gives a non-nil, non-Error result even when _javascript_ cannot be evaluated
<rdar://problem/58544942> and https://bugs.webkit.org/show_bug.cgi?id=206608
Reviewed by Alex Christensen.
Source/WebCore:
Covered by new API test.
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::executeScriptInWorld): Address a FIXME added in 253519 which had predicted this problem.
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:
(TEST):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-610.1.1-branch/Source/WebCore/ChangeLog (255639 => 255640)
--- branches/safari-610.1.1-branch/Source/WebCore/ChangeLog 2020-02-04 03:09:04 UTC (rev 255639)
+++ branches/safari-610.1.1-branch/Source/WebCore/ChangeLog 2020-02-04 03:09:07 UTC (rev 255640)
@@ -1,5 +1,40 @@
2020-02-03 Russell Epstein <[email protected]>
+ Cherry-pick r254950. rdar://problem/58544942
+
+ REGRESSION (r253519): [WKWebView evaluateJavaScript:completionHandler:] gives a non-nil, non-Error result even when _javascript_ cannot be evaluated
+ <rdar://problem/58544942> and https://bugs.webkit.org/show_bug.cgi?id=206608
+
+ Reviewed by Alex Christensen.
+
+ Source/WebCore:
+
+ Covered by new API test.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::executeScriptInWorld): Address a FIXME added in 253519 which had predicted this problem.
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:
+ (TEST):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-01-22 Brady Eidson <[email protected]>
+
+ REGRESSION (r253519): [WKWebView evaluateJavaScript:completionHandler:] gives a non-nil, non-Error result even when _javascript_ cannot be evaluated
+ <rdar://problem/58544942> and https://bugs.webkit.org/show_bug.cgi?id=206608
+
+ Reviewed by Alex Christensen.
+
+ Covered by new API test.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::executeScriptInWorld): Address a FIXME added in 253519 which had predicted this problem.
+
+2020-02-03 Russell Epstein <[email protected]>
+
Cherry-pick r255532. rdar://problem/57876140
Add support for specifying background colors when setting marked text
Modified: branches/safari-610.1.1-branch/Source/WebCore/bindings/js/ScriptController.cpp (255639 => 255640)
--- branches/safari-610.1.1-branch/Source/WebCore/bindings/js/ScriptController.cpp 2020-02-04 03:09:04 UTC (rev 255639)
+++ branches/safari-610.1.1-branch/Source/WebCore/bindings/js/ScriptController.cpp 2020-02-04 03:09:07 UTC (rev 255640)
@@ -576,9 +576,8 @@
{
UserGestureIndicator gestureIndicator(parameters.forceUserGesture == ForceUserGesture::Yes ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt);
- // FIXME: Instead of returning an empty JSValue, should return an ExceptionDetails.
if (!canExecuteScripts(AboutToExecuteScript) || isPaused())
- return { };
+ return makeUnexpected(ExceptionDetails { "Cannot execute _javascript_ in this document"_s });
switch (parameters.runAsAsyncFunction) {
case RunAsAsyncFunction::No: {
Modified: branches/safari-610.1.1-branch/Tools/ChangeLog (255639 => 255640)
--- branches/safari-610.1.1-branch/Tools/ChangeLog 2020-02-04 03:09:04 UTC (rev 255639)
+++ branches/safari-610.1.1-branch/Tools/ChangeLog 2020-02-04 03:09:07 UTC (rev 255640)
@@ -1,5 +1,38 @@
2020-02-03 Russell Epstein <[email protected]>
+ Cherry-pick r254950. rdar://problem/58544942
+
+ REGRESSION (r253519): [WKWebView evaluateJavaScript:completionHandler:] gives a non-nil, non-Error result even when _javascript_ cannot be evaluated
+ <rdar://problem/58544942> and https://bugs.webkit.org/show_bug.cgi?id=206608
+
+ Reviewed by Alex Christensen.
+
+ Source/WebCore:
+
+ Covered by new API test.
+
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::executeScriptInWorld): Address a FIXME added in 253519 which had predicted this problem.
+
+ Tools:
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:
+ (TEST):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-01-22 Brady Eidson <[email protected]>
+
+ REGRESSION (r253519): [WKWebView evaluateJavaScript:completionHandler:] gives a non-nil, non-Error result even when _javascript_ cannot be evaluated
+ <rdar://problem/58544942> and https://bugs.webkit.org/show_bug.cgi?id=206608
+
+ Reviewed by Alex Christensen.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:
+ (TEST):
+
+2020-02-03 Russell Epstein <[email protected]>
+
Cherry-pick r255532. rdar://problem/57876140
Add support for specifying background colors when setting marked text
Modified: branches/safari-610.1.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm (255639 => 255640)
--- branches/safari-610.1.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm 2020-02-04 03:09:04 UTC (rev 255639)
+++ branches/safari-610.1.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm 2020-02-04 03:09:07 UTC (rev 255640)
@@ -27,6 +27,7 @@
#import <WebKit/WKFoundation.h>
#import "PlatformUtilities.h"
+#import "TCPServer.h"
#import "Test.h"
#import "TestNavigationDelegate.h"
#import <WebKit/WKWebView.h>
@@ -111,3 +112,32 @@
isDone = false;
TestWebKitAPI::Util::run(&isDone);
}
+
+TEST(WebKit, EvaluateJavaScriptInAttachments)
+{
+ // Attachments displayed inline are in sandboxed documents.
+ // Evaluating _javascript_ in such a document should fail and result in an error.
+
+ using namespace TestWebKitAPI;
+ TCPServer server([](int socket) {
+ NSString *response = @"HTTP/1.1 200 OK\r\n"
+ "Content-Length: 12\r\n"
+ "Content-Disposition: attachment; filename=fromHeader.txt;\r\n\r\n"
+ "Hello world!";
+
+ TCPServer::read(socket);
+ TCPServer::write(socket, response.UTF8String, response.length);
+ });
+ auto webView = adoptNS([TestWKWebView new]);
+ [webView synchronouslyLoadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://127.0.0.1:%d/", server.port()]]]];
+
+ __block bool done = false;
+ [webView evaluateJavaScript:@"Hello" completionHandler:^(id result, NSError *error) {
+ EXPECT_NULL(result);
+ EXPECT_NOT_NULL(error);
+ EXPECT_TRUE([[error description] containsString:@"Cannot execute _javascript_ in this document"]);
+ done = true;
+ }];
+ TestWebKitAPI::Util::run(&done);
+}
+
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes