Changeset 261718 in webkit
- Timestamp:
- May 14, 2020 4:11:52 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r261709 r261718 1 2020-05-14 Timothy Hatcher <timothy@apple.com> 2 3 Add sourceURL to _evaluateJavaScript: so the scripts appear in Web Inspector. 4 https://bugs.webkit.org/show_bug.cgi?id=211904 5 rdar://problem/62074376 6 7 Reviewed by Devin Rousso. 8 9 Added sourceURL to RunJavaScriptParameters. Use it instead of the frame's document URL. 10 11 * bindings/js/RunJavaScriptParameters.h: 12 (WebCore::RunJavaScriptParameters::RunJavaScriptParameters): 13 (WebCore::RunJavaScriptParameters::encode const): 14 (WebCore::RunJavaScriptParameters::decode): 15 * bindings/js/ScriptController.cpp: 16 (WebCore::ScriptController::executeScriptInWorldIgnoringException): 17 (WebCore::ScriptController::executeScriptInWorld): 18 (WebCore::ScriptController::callInWorld): 19 (WebCore::ScriptController::executeUserAgentScriptInWorld): 20 1 21 2020-05-14 Eric Carlson <eric.carlson@apple.com> 2 22 -
trunk/Source/WebCore/bindings/js/RunJavaScriptParameters.h
r253950 r261718 27 27 28 28 #include <wtf/HashMap.h> 29 #include <wtf/URL.h> 29 30 #include <wtf/Vector.h> 30 31 #include <wtf/text/WTFString.h> … … 38 39 39 40 struct RunJavaScriptParameters { 40 RunJavaScriptParameters(String&& source, RunAsAsyncFunction runAsAsyncFunction, Optional<ArgumentWireBytesMap>&& arguments, ForceUserGesture forceUserGesture)41 RunJavaScriptParameters(String&& source, URL&& sourceURL, RunAsAsyncFunction runAsAsyncFunction, Optional<ArgumentWireBytesMap>&& arguments, ForceUserGesture forceUserGesture) 41 42 : source(WTFMove(source)) 43 , sourceURL(WTFMove(sourceURL)) 42 44 , runAsAsyncFunction(runAsAsyncFunction) 43 45 , arguments(WTFMove(arguments)) … … 46 48 } 47 49 48 RunJavaScriptParameters(const String& source, bool runAsAsyncFunction, Optional<ArgumentWireBytesMap>&& arguments, bool forceUserGesture)50 RunJavaScriptParameters(const String& source, URL&& sourceURL, bool runAsAsyncFunction, Optional<ArgumentWireBytesMap>&& arguments, bool forceUserGesture) 49 51 : source(source) 52 , sourceURL(WTFMove(sourceURL)) 50 53 , runAsAsyncFunction(runAsAsyncFunction ? RunAsAsyncFunction::Yes : RunAsAsyncFunction::No) 51 54 , arguments(WTFMove(arguments)) … … 54 57 } 55 58 56 RunJavaScriptParameters(String&& source, bool runAsAsyncFunction, Optional<ArgumentWireBytesMap>&& arguments, bool forceUserGesture)59 RunJavaScriptParameters(String&& source, URL&& sourceURL, bool runAsAsyncFunction, Optional<ArgumentWireBytesMap>&& arguments, bool forceUserGesture) 57 60 : source(WTFMove(source)) 61 , sourceURL(WTFMove(sourceURL)) 58 62 , runAsAsyncFunction(runAsAsyncFunction ? RunAsAsyncFunction::Yes : RunAsAsyncFunction::No) 59 63 , arguments(WTFMove(arguments)) … … 63 67 64 68 String source; 69 URL sourceURL; 65 70 RunAsAsyncFunction runAsAsyncFunction; 66 71 Optional<ArgumentWireBytesMap> arguments; … … 69 74 template<typename Encoder> void encode(Encoder& encoder) const 70 75 { 71 encoder << source << runAsAsyncFunction << arguments << forceUserGesture;76 encoder << source << sourceURL << runAsAsyncFunction << arguments << forceUserGesture; 72 77 } 73 78 … … 76 81 String source; 77 82 if (!decoder.decode(source)) 83 return WTF::nullopt; 84 85 URL sourceURL; 86 if (!decoder.decode(sourceURL)) 78 87 return WTF::nullopt; 79 88 … … 90 99 return WTF::nullopt; 91 100 92 return { RunJavaScriptParameters { WTFMove(source), runAsAsyncFunction, WTFMove(arguments), forceUserGesture } };101 return { RunJavaScriptParameters { WTFMove(source), WTFMove(sourceURL), runAsAsyncFunction, WTFMove(arguments), forceUserGesture } }; 93 102 } 94 103 }; -
trunk/Source/WebCore/bindings/js/ScriptController.cpp
r261506 r261718 574 574 JSC::JSValue ScriptController::executeScriptInWorldIgnoringException(DOMWrapperWorld& world, const String& script, bool forceUserGesture) 575 575 { 576 auto result = executeScriptInWorld(world, RunJavaScriptParameters { script, false, WTF::nullopt, forceUserGesture });576 auto result = executeScriptInWorld(world, { script, URL { }, false, WTF::nullopt, forceUserGesture }); 577 577 return result ? result.value() : JSC::JSValue { }; 578 578 } … … 593 593 return makeUnexpected(ExceptionDetails { "Cannot execute JavaScript in this document"_s }); 594 594 595 auto sourceURL = parameters.sourceURL; 596 if (!sourceURL.isValid()) { 597 // FIXME: This is gross, but when setTimeout() and setInterval() are passed JS strings, the thrown errors should use the frame document URL (according to WPT). 598 sourceURL = m_frame.document()->url(); 599 } 600 595 601 switch (parameters.runAsAsyncFunction) { 596 case RunAsAsyncFunction::No: { 597 ScriptSourceCode sourceCode(parameters.source, URL(m_frame.document()->url()), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset())); 598 return evaluateInWorld(sourceCode, world); 599 } 602 case RunAsAsyncFunction::No: 603 return evaluateInWorld({ parameters.source, WTFMove(sourceURL), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset()) }, world); 600 604 case RunAsAsyncFunction::Yes: 601 605 return callInWorld(WTFMove(parameters), world); … … 641 645 functionStringBuilder.append("){", parameters.source, "})"); 642 646 643 auto sourceCode = ScriptSourceCode { functionStringBuilder.toString(), URL(m_frame.document()->url()), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset()) };647 auto sourceCode = ScriptSourceCode { functionStringBuilder.toString(), WTFMove(parameters.sourceURL), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset()) }; 644 648 const auto& jsSourceCode = sourceCode.jsSourceCode(); 645 649 … … 699 703 ValueOrException ScriptController::executeUserAgentScriptInWorld(DOMWrapperWorld& world, const String& script, bool forceUserGesture) 700 704 { 701 return executeUserAgentScriptInWorldInternal(world, { script, false, WTF::nullopt, forceUserGesture });705 return executeUserAgentScriptInWorldInternal(world, { script, URL { }, false, WTF::nullopt, forceUserGesture }); 702 706 } 703 707 -
trunk/Source/WebKit/ChangeLog
r261717 r261718 1 2020-05-14 Timothy Hatcher <timothy@apple.com> 2 3 Add sourceURL to _evaluateJavaScript: so the scripts appear in Web Inspector. 4 https://bugs.webkit.org/show_bug.cgi?id=211904 5 rdar://problem/62074376 6 7 Reviewed by Devin Rousso. 8 9 Added sourceURL version of _evaluateJavaScript: that passes the sourceURL to RunJavaScriptParameters. 10 If the sourceURL is invalid, generate a unique user script URL so the source code errors are not showing 11 up with the frame's document URL and bogus locations. 12 13 * UIProcess/API/C/WKPage.cpp: 14 (WKPageRunJavaScriptInMainFrame): pass API::UserScript::generateUniqueURL() for the sourceURL. 15 * UIProcess/API/Cocoa/WKUserScript.mm: 16 (-[WKUserScript initWithSource:injectionTime:forMainFrameOnly:]): Clean up WebCore::UserScript initializer. 17 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:userContentWorld:]): Ditto. 18 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:userContentWorld:]): Ditto. 19 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:contentWorld:]): Ditto. 20 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:]): Ditto. 21 (-[WKUserScript _initWithSource:injectionTime:forMainFrameOnly:legacyWhitelist:legacyBlacklist:associatedURL:contentWorld:deferRunningUntilNotification:]): Ditto. 22 * UIProcess/API/Cocoa/WKWebView.mm: 23 (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Renamed to add sourceURL. 24 (-[WKWebView _evaluateJavaScript:asAsyncFunction:withSourceURL:withArguments:forceUserGesture:inFrame:inWorld:completionHandler:]): Added sourceURL. 25 (-[WKWebView _evaluateJavaScript:withSourceURL:inFrame:inContentWorld:completionHandler:]): Added. Pass sourceURL through. 26 (-[WKWebView evaluateJavaScript:completionHandler:]): Call new method with sourceURL as nil. 27 (-[WKWebView evaluateJavaScript:inContentWorld:completionHandler:]): Ditto. 28 (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]): Ditto. 29 (-[WKWebView _callAsyncJavaScript:arguments:inFrame:inContentWorld:completionHandler:]): Ditto. 30 (-[WKWebView _evaluateJavaScript:inFrame:inContentWorld:completionHandler:]): Ditto. 31 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 32 1 33 2020-05-14 Chris Dumez <cdumez@apple.com> 2 34 -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r261586 r261718 2496 2496 void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) 2497 2497 { 2498 toImpl(pageRef)->runJavaScriptInMainFrame({ toImpl(scriptRef)->string(), false, WTF::nullopt, true }, [context, callback](API::SerializedScriptValue* returnValue, Optional<WebCore::ExceptionDetails>, CallbackBase::Error error) {2498 toImpl(pageRef)->runJavaScriptInMainFrame({ toImpl(scriptRef)->string(), URL { }, false, WTF::nullopt, true }, [context, callback](API::SerializedScriptValue* returnValue, Optional<WebCore::ExceptionDetails>, CallbackBase::Error error) { 2499 2499 callback(toAPI(returnValue), (error != CallbackBase::Error::None) ? toAPI(API::Error::create().ptr()) : 0, context); 2500 2500 }); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUserScript.mm
r259843 r261718 37 37 return nil; 38 38 39 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), { }, { }, API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, API::ContentWorld::pageContentWorld());39 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { source, API::UserScript::generateUniqueURL(), { }, { }, API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, API::ContentWorld::pageContentWorld()); 40 40 41 41 return self; … … 86 86 return nil; 87 87 88 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *userContentWorld->_contentWorld->_contentWorld);88 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { source, API::UserScript::generateUniqueURL(), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *userContentWorld->_contentWorld->_contentWorld); 89 89 90 90 return self; … … 96 96 return nil; 97 97 98 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), URL(associatedURL), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *userContentWorld->_contentWorld->_contentWorld);98 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { source, associatedURL, makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *userContentWorld->_contentWorld->_contentWorld); 99 99 100 100 return self; … … 112 112 return nil; 113 113 114 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), API::UserScript::generateUniqueURL(), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *contentWorld->_contentWorld);114 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { source, API::UserScript::generateUniqueURL(), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *contentWorld->_contentWorld); 115 115 116 116 return self; … … 122 122 return nil; 123 123 124 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), URL(associatedURL), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *contentWorld->_contentWorld);124 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { source, associatedURL, makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, WebCore::WaitForNotificationBeforeInjecting::No }, *contentWorld->_contentWorld); 125 125 126 126 return self; … … 132 132 return nil; 133 133 134 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { WTF::String(source), URL(associatedURL), makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, deferRunningUntilNotification ? WebCore::WaitForNotificationBeforeInjecting::Yes : WebCore::WaitForNotificationBeforeInjecting::No }, *contentWorld->_contentWorld);134 API::Object::constructInWrapper<API::UserScript>(self, WebCore::UserScript { source, associatedURL, makeVector<String>(legacyWhitelist), makeVector<String>(legacyBlacklist), API::toWebCoreUserScriptInjectionTime(injectionTime), forMainFrameOnly ? WebCore::UserContentInjectedFrames::InjectInTopFrameOnly : WebCore::UserContentInjectedFrames::InjectInAllFrames, deferRunningUntilNotification ? WebCore::WaitForNotificationBeforeInjecting::Yes : WebCore::WaitForNotificationBeforeInjecting::No }, *contentWorld->_contentWorld); 135 135 136 136 return self; -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r260962 r261718 817 817 - (void)evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler 818 818 { 819 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO with Arguments:nil forceUserGesture:YES inFrame:nil inWorld:WKContentWorld.pageWorld completionHandler:completionHandler];819 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO withSourceURL:nil withArguments:nil forceUserGesture:YES inFrame:nil inWorld:WKContentWorld.pageWorld completionHandler:completionHandler]; 820 820 } 821 821 822 822 - (void)evaluateJavaScript:(NSString *)javaScriptString inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *))completionHandler 823 823 { 824 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO with Arguments:nil forceUserGesture:YES inFrame:nil inWorld:contentWorld completionHandler:completionHandler];824 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO withSourceURL:nil withArguments:nil forceUserGesture:YES inFrame:nil inWorld:contentWorld completionHandler:completionHandler]; 825 825 } 826 826 827 827 - (void)callAsyncJavaScript:(NSString *)javaScriptString arguments:(NSDictionary<NSString *, id> *)arguments inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler 828 828 { 829 [self _evaluateJavaScript:javaScriptString asAsyncFunction:YES with Arguments:arguments forceUserGesture:YES inFrame:nil inWorld:contentWorld completionHandler:completionHandler];829 [self _evaluateJavaScript:javaScriptString asAsyncFunction:YES withSourceURL:nil withArguments:arguments forceUserGesture:YES inFrame:nil inWorld:contentWorld completionHandler:completionHandler]; 830 830 } 831 831 … … 864 864 } 865 865 866 - (void)_evaluateJavaScript:(NSString *)javaScriptString asAsyncFunction:(BOOL)asAsyncFunction with Arguments:(NSDictionary<NSString *, id> *)arguments forceUserGesture:(BOOL)forceUserGesture inFrame:(WKFrameInfo *)frame inWorld:(WKContentWorld *)world completionHandler:(void (^)(id, NSError *))completionHandler866 - (void)_evaluateJavaScript:(NSString *)javaScriptString asAsyncFunction:(BOOL)asAsyncFunction withSourceURL:(NSURL *)sourceURL withArguments:(NSDictionary<NSString *, id> *)arguments forceUserGesture:(BOOL)forceUserGesture inFrame:(WKFrameInfo *)frame inWorld:(WKContentWorld *)world completionHandler:(void (^)(id, NSError *))completionHandler 867 867 { 868 868 auto handler = adoptNS([completionHandler copy]); … … 905 905 } 906 906 907 _page->runJavaScriptInFrameInScriptWorld( WebCore::RunJavaScriptParameters { javaScriptString, !!asAsyncFunction, WTFMove(argumentsMap), !!forceUserGesture }, frameID, *world->_contentWorld.get(), [handler](API::SerializedScriptValue* serializedScriptValue, Optional<WebCore::ExceptionDetails> details, WebKit::ScriptValueCallback::Error errorCode) {907 _page->runJavaScriptInFrameInScriptWorld({ javaScriptString, sourceURL, !!asAsyncFunction, WTFMove(argumentsMap), !!forceUserGesture }, frameID, *world->_contentWorld.get(), [handler](API::SerializedScriptValue* serializedScriptValue, Optional<WebCore::ExceptionDetails> details, WebKit::ScriptValueCallback::Error errorCode) { 908 908 if (!handler) 909 909 return; … … 2201 2201 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler 2202 2202 { 2203 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO with Arguments:nil forceUserGesture:NO inFrame:nil inWorld:WKContentWorld.pageWorld completionHandler:completionHandler];2203 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO withSourceURL:nil withArguments:nil forceUserGesture:NO inFrame:nil inWorld:WKContentWorld.pageWorld completionHandler:completionHandler]; 2204 2204 } 2205 2205 2206 2206 - (void)_callAsyncJavaScript:(NSString *)functionBody arguments:(NSDictionary<NSString *, id> *)arguments inFrame:(WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler 2207 2207 { 2208 [self _evaluateJavaScript:functionBody asAsyncFunction:YES with Arguments:arguments forceUserGesture:YES inFrame:frame inWorld:contentWorld completionHandler:completionHandler];2208 [self _evaluateJavaScript:functionBody asAsyncFunction:YES withSourceURL:nil withArguments:arguments forceUserGesture:YES inFrame:frame inWorld:contentWorld completionHandler:completionHandler]; 2209 2209 } 2210 2210 2211 2211 - (void)_evaluateJavaScript:(NSString *)javaScriptString inFrame:(WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler 2212 2212 { 2213 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO withArguments:nil forceUserGesture:YES inFrame:frame inWorld:contentWorld completionHandler:completionHandler]; 2213 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO withSourceURL:nil withArguments:nil forceUserGesture:YES inFrame:frame inWorld:contentWorld completionHandler:completionHandler]; 2214 } 2215 2216 - (void)_evaluateJavaScript:(NSString *)javaScriptString withSourceURL:(NSURL *)url inFrame:(WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler 2217 { 2218 [self _evaluateJavaScript:javaScriptString asAsyncFunction:NO withSourceURL:url withArguments:nil forceUserGesture:YES inFrame:frame inWorld:contentWorld completionHandler:completionHandler]; 2214 2219 } 2215 2220 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
r260962 r261718 212 212 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)javaScriptString completionHandler:(void (^)(id, NSError *))completionHandler WK_API_AVAILABLE(macos(10.13), ios(11.0)); 213 213 - (void)_evaluateJavaScript:(NSString *)javaScriptString inFrame:(WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError * error))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 214 - (void)_evaluateJavaScript:(NSString *)javaScriptString withSourceURL:(NSURL *)sourceURL inFrame:(WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError * error))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 214 215 - (void)_callAsyncJavaScript:(NSString *)functionBody arguments:(NSDictionary<NSString *, id> *)arguments inFrame:(WKFrameInfo *)frame inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 215 216 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
r261370 r261718 3696 3696 3697 3697 GRefPtr<GTask> task = adoptGRef(g_task_new(webView, cancellable, callback, userData)); 3698 getPage(webView).runJavaScriptInMainFrame({ String::fromUTF8(script), false, WTF::nullopt, true }, [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) {3698 getPage(webView).runJavaScriptInMainFrame({ String::fromUTF8(script), URL { }, false, WTF::nullopt, true }, [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) { 3699 3699 ExceptionDetails exceptionDetails; 3700 3700 if (details) … … 3798 3798 GRefPtr<GTask> task = adoptGRef(g_task_new(webView, cancellable, callback, userData)); 3799 3799 auto world = API::ContentWorld::sharedWorldWithName(String::fromUTF8(worldName)); 3800 getPage(webView).runJavaScriptInFrameInScriptWorld({ String::fromUTF8(script), false, WTF::nullopt, true }, WTF::nullopt, world.get(), [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) {3800 getPage(webView).runJavaScriptInFrameInScriptWorld({ String::fromUTF8(script), URL { }, false, WTF::nullopt, true }, WTF::nullopt, world.get(), [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) { 3801 3801 ExceptionDetails exceptionDetails; 3802 3802 if (details) … … 3840 3840 WebKitWebView* webView = WEBKIT_WEB_VIEW(g_task_get_source_object(task.get())); 3841 3841 gpointer outputStreamData = g_memory_output_stream_get_data(G_MEMORY_OUTPUT_STREAM(object)); 3842 getPage(webView).runJavaScriptInMainFrame({ String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)), false, WTF::nullopt, true},3842 getPage(webView).runJavaScriptInMainFrame({ String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)), URL { }, false, WTF::nullopt, true }, 3843 3843 [task](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details, WebKit::CallbackBase::Error) { 3844 3844 ExceptionDetails exceptionDetails; -
trunk/Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp
r260350 r261718 119 119 void RemoteInspectorProtocolHandler::runScript(const String& script) 120 120 { 121 m_page.runJavaScriptInMainFrame({ script, false, WTF::nullopt, false },121 m_page.runJavaScriptInMainFrame({ script, URL { }, false, WTF::nullopt, false }, 122 122 [](API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails> exceptionDetails, CallbackBase::Error) { 123 123 if (exceptionDetails)
Note: See TracChangeset
for help on using the changeset viewer.