Changeset 233782 in webkit
- Timestamp:
- Jul 12, 2018, 2:34:35 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 23 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/contentextensions/injected-script-callback-expected.txt (added)
-
LayoutTests/http/tests/contentextensions/injected-script-callback.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/FrameLoaderClient.h (modified) (1 diff)
-
Source/WebCore/page/Frame.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h (modified) (1 diff)
-
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (modified) (1 diff)
-
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (modified) (2 diffs)
-
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (modified) (5 diffs)
-
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (modified) (2 diffs)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/TestController.h (modified) (1 diff)
-
Tools/WebKitTestRunner/TestInvocation.cpp (modified) (1 diff)
-
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r233776 r233782 1 2018-07-12 Youenn Fablet <youenn@apple.com> 2 3 Add a FrameLoaderClient willInjectUserScriptForFrame callback 4 https://bugs.webkit.org/show_bug.cgi?id=187565 5 6 Reviewed by Alex Christensen. 7 8 * http/tests/contentextensions/injected-script-callback-expected.txt: Added. 9 * http/tests/contentextensions/injected-script-callback.html: Added. 10 1 11 2018-07-11 Ross Kirsling <ross.kirsling@sony.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r233778 r233782 1 2018-07-12 Youenn Fablet <youenn@apple.com> 2 3 Add a FrameLoaderClient willInjectUserScriptForFrame callback 4 https://bugs.webkit.org/show_bug.cgi?id=187565 5 6 Reviewed by Alex Christensen. 7 8 Test: http/tests/contentextensions/injected-script-callback.html. 9 10 * loader/FrameLoaderClient.h: 11 * page/Frame.cpp: 12 (WebCore::Frame::injectUserScriptImmediately): 13 Calling the new callback whenever being about to inject a new script. 14 1 15 2018-07-12 Megan Gardner <megan_gardner@apple.com> 2 16 -
trunk/Source/WebCore/loader/FrameLoaderClient.h
r232814 r233782 333 333 virtual void dispatchWillDestroyGlobalObjectForDOMWindowExtension(DOMWindowExtension*) { } 334 334 335 virtual void willInjectUserScript(DOMWrapperWorld&) { } 336 335 337 #if ENABLE(WEB_RTC) 336 338 virtual void dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler*) { } -
trunk/Source/WebCore/page/Frame.cpp
r233752 r233782 752 752 if (m_page) 753 753 m_page->setAsRunningUserScripts(); 754 loader().client().willInjectUserScript(world); 754 755 m_script->evaluateInWorld(ScriptSourceCode(script.source(), script.url()), world); 755 756 } -
trunk/Source/WebKit/ChangeLog
r233781 r233782 1 2018-07-12 Youenn Fablet <youenn@apple.com> 2 3 Add a FrameLoaderClient willInjectUserScriptForFrame callback 4 https://bugs.webkit.org/show_bug.cgi?id=187565 5 6 Reviewed by Alex Christensen. 7 8 Introduce a new WKBundlePageLoaderClient callback that is called everytime a user script is injected. 9 Implement WebFrameLoaderClient::willInjectUserScript by calling this new callback. 10 11 * WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h: 12 (API::InjectedBundle::PageLoaderClient::willInjectUserScriptForFrame): 13 * WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h: 14 * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: 15 (setUpPageLoaderClient): 16 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: 17 (WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame): 18 (WebKit::InjectedBundlePageLoaderClient::willInjectUserScriptForFrame): 19 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: 20 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 21 (WebKit::WebFrameLoaderClient::willInjectUserScript): 22 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 23 1 24 2018-07-12 Said Abou-Hallawa <sabouhallawa@apple.com> 2 25 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundlePageLoaderClient.h
r228942 r233782 90 90 virtual void willDestroyGlobalObjectForDOMWindowExtension(WebKit::WebPage&, WebCore::DOMWindowExtension*) { } 91 91 92 virtual void willInjectUserScriptForFrame(WebKit::WebPage&, WebKit::WebFrame&, WebCore::DOMWrapperWorld&) { } 93 92 94 virtual bool shouldForceUniversalAccessFromLocalURL(WebKit::WebPage&, const WTF::String&) { return false; } 93 95 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePageLoaderClient.h
r205487 r233782 54 54 typedef bool (*WKBundlePageShouldGoToBackForwardListItemCallback)(WKBundlePageRef page, WKBundleBackForwardListItemRef item, WKTypeRef* userData, const void *clientInfo); 55 55 typedef void (*WKBundlePageGlobalObjectIsAvailableForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo); 56 typedef void (*WKBundlePageWillInjectUserScriptForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo); 56 57 typedef void (*WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); 57 58 typedef void (*WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback)(WKBundlePageRef page, WKBundleDOMWindowExtensionRef, const void* clientInfo); … … 465 466 } WKBundlePageLoaderClientV8; 466 467 468 typedef struct WKBundlePageLoaderClientV9 { 469 WKBundlePageLoaderClientBase base; 470 471 // Version 0. 472 WKBundlePageDidStartProvisionalLoadForFrameCallback didStartProvisionalLoadForFrame; 473 WKBundlePageDidReceiveServerRedirectForProvisionalLoadForFrameCallback didReceiveServerRedirectForProvisionalLoadForFrame; 474 WKBundlePageDidFailProvisionalLoadWithErrorForFrameCallback didFailProvisionalLoadWithErrorForFrame; 475 WKBundlePageDidCommitLoadForFrameCallback didCommitLoadForFrame; 476 WKBundlePageDidFinishDocumentLoadForFrameCallback didFinishDocumentLoadForFrame; 477 WKBundlePageDidFinishLoadForFrameCallback didFinishLoadForFrame; 478 WKBundlePageDidFailLoadWithErrorForFrameCallback didFailLoadWithErrorForFrame; 479 WKBundlePageDidSameDocumentNavigationForFrameCallback didSameDocumentNavigationForFrame; 480 WKBundlePageDidReceiveTitleForFrameCallback didReceiveTitleForFrame; 481 WKBundlePageDidFirstLayoutForFrameCallback didFirstLayoutForFrame; 482 WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback didFirstVisuallyNonEmptyLayoutForFrame; 483 WKBundlePageDidRemoveFrameFromHierarchyCallback didRemoveFrameFromHierarchy; 484 WKBundlePageDidDisplayInsecureContentForFrameCallback didDisplayInsecureContentForFrame; 485 WKBundlePageDidRunInsecureContentForFrameCallback didRunInsecureContentForFrame; 486 WKBundlePageDidClearWindowObjectForFrameCallback didClearWindowObjectForFrame; 487 WKBundlePageDidCancelClientRedirectForFrameCallback didCancelClientRedirectForFrame; 488 WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame; 489 WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame; 490 491 // Version 1. 492 WKBundlePageDidLayoutForFrameCallback didLayoutForFrame; 493 void * didNewFirstVisuallyNonEmptyLayout_unavailable; 494 WKBundlePageDidDetectXSSForFrameCallback didDetectXSSForFrame; 495 WKBundlePageShouldGoToBackForwardListItemCallback shouldGoToBackForwardListItem; 496 WKBundlePageGlobalObjectIsAvailableForFrameCallback globalObjectIsAvailableForFrame; 497 WKBundlePageWillDisconnectDOMWindowExtensionFromGlobalObjectCallback willDisconnectDOMWindowExtensionFromGlobalObject; 498 WKBundlePageDidReconnectDOMWindowExtensionToGlobalObjectCallback didReconnectDOMWindowExtensionToGlobalObject; 499 WKBundlePageWillDestroyGlobalObjectForDOMWindowExtensionCallback willDestroyGlobalObjectForDOMWindowExtension; 500 501 // Version 2 502 WKBundlePageDidFinishProgressCallback didFinishProgress; 503 WKBundlePageShouldForceUniversalAccessFromLocalURLCallback shouldForceUniversalAccessFromLocalURL; 504 505 // Version 3 506 void * didReceiveIntentForFrame_unavailable; 507 void * registerIntentServiceForFrame_unavailable; 508 509 // Version 4 510 WKBundlePageDidLayoutCallback didLayout; 511 512 // Version 5 513 WKBundlePageFeaturesUsedInPageCallback featuresUsedInPage; 514 515 // Version 6 516 WKBundlePageWillLoadURLRequestCallback willLoadURLRequest; 517 WKBundlePageWillLoadDataRequestCallback willLoadDataRequest; 518 519 // Version 7 520 void * willDestroyFrame_unavailable; 521 522 // Version 8 523 WKBundlePageUserAgentForURLCallback userAgentForURL; 524 525 // Version 9 526 WKBundlePageWillInjectUserScriptForFrameCallback willInjectUserScriptForFrame; 527 } WKBundlePageLoaderClientV9; 528 467 529 #endif // WKBundlePageLoaderClient_h -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
r233713 r233782 233 233 static void setUpPageLoaderClient(WKWebProcessPlugInBrowserContextController *contextController, WebPage& page) 234 234 { 235 WKBundlePageLoaderClientV 8client;235 WKBundlePageLoaderClientV9 client; 236 236 memset(&client, 0, sizeof(client)); 237 237 -
trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
r228942 r233782 304 304 if (!m_client.globalObjectIsAvailableForFrame) 305 305 return; 306 306 307 307 RefPtr<InjectedBundleScriptWorld> injectedWorld = InjectedBundleScriptWorld::getOrCreate(world); 308 308 m_client.globalObjectIsAvailableForFrame(toAPI(&page), toAPI(&frame), toAPI(injectedWorld.get()), m_client.base.clientInfo); 309 } 310 311 void InjectedBundlePageLoaderClient::willInjectUserScriptForFrame(WebPage& page, WebFrame& frame, DOMWrapperWorld& world) 312 { 313 if (!m_client.willInjectUserScriptForFrame) 314 return; 315 316 RefPtr<InjectedBundleScriptWorld> injectedWorld = InjectedBundleScriptWorld::getOrCreate(world); 317 m_client.willInjectUserScriptForFrame(toAPI(&page), toAPI(&frame), toAPI(injectedWorld.get()), m_client.base.clientInfo); 309 318 } 310 319 -
trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
r228942 r233782 38 38 39 39 template<> struct ClientTraits<WKBundlePageLoaderClientBase> { 40 typedef std::tuple<WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8 > Versions;40 typedef std::tuple<WKBundlePageLoaderClientV0, WKBundlePageLoaderClientV1, WKBundlePageLoaderClientV2, WKBundlePageLoaderClientV3, WKBundlePageLoaderClientV4, WKBundlePageLoaderClientV5, WKBundlePageLoaderClientV6, WKBundlePageLoaderClientV7, WKBundlePageLoaderClientV8, WKBundlePageLoaderClientV9> Versions; 41 41 }; 42 42 } … … 82 82 void willDestroyGlobalObjectForDOMWindowExtension(WebPage&, WebCore::DOMWindowExtension*) override; 83 83 84 void willInjectUserScriptForFrame(WebKit::WebPage&, WebKit::WebFrame&, WebCore::DOMWrapperWorld&) final; 85 84 86 bool shouldForceUniversalAccessFromLocalURL(WebPage&, const WTF::String&) override; 85 87 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r232814 r233782 1692 1692 } 1693 1693 1694 1695 1694 void WebFrameLoaderClient::dispatchGlobalObjectAvailable(DOMWrapperWorld& world) 1696 1695 { … … 1700 1699 1701 1700 webPage->injectedBundleLoaderClient().globalObjectIsAvailableForFrame(*webPage, *m_frame, world); 1701 } 1702 1703 void WebFrameLoaderClient::willInjectUserScript(DOMWrapperWorld& world) 1704 { 1705 WebPage* webPage = m_frame->page(); 1706 if (!webPage) 1707 return; 1708 1709 webPage->injectedBundleLoaderClient().willInjectUserScriptForFrame(*webPage, *m_frame, world); 1702 1710 } 1703 1711 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r232814 r233782 233 233 void dispatchDidReconnectDOMWindowExtensionToGlobalObject(WebCore::DOMWindowExtension*) final; 234 234 void dispatchWillDestroyGlobalObjectForDOMWindowExtension(WebCore::DOMWindowExtension*) final; 235 235 236 void willInjectUserScript(WebCore::DOMWrapperWorld&) final; 237 236 238 #if PLATFORM(COCOA) 237 239 RemoteAXObjectRef accessibilityRemoteObject() final; -
trunk/Tools/ChangeLog
r233777 r233782 1 2018-07-12 Youenn Fablet <youenn@apple.com> 2 3 Add a FrameLoaderClient willInjectUserScriptForFrame callback 4 https://bugs.webkit.org/show_bug.cgi?id=187565 5 6 Reviewed by Alex Christensen. 7 8 Added new test runner API to check for willInjectUserScriptForFrame callback. 9 10 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 11 * WebKitTestRunner/InjectedBundle/InjectedBundle.h: 12 (WTR::InjectedBundle::resetUserScriptInjectedCount): 13 (WTR::InjectedBundle::increaseUserScriptInjectedCount): 14 (WTR::InjectedBundle::userScriptInjectedCount const): 15 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 16 (WTR::InjectedBundlePage::InjectedBundlePage): 17 (WTR::InjectedBundlePage::resetAfterTest): 18 (WTR::InjectedBundlePage::willInjectUserScriptForFrame): 19 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: 20 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 21 (WTR::TestRunner::userScriptInjectedCount const): 22 (WTR::TestRunner::injectUserScript): 23 * WebKitTestRunner/InjectedBundle/TestRunner.h: 24 * WebKitTestRunner/TestController.cpp: 25 (WTR::TestController::injectUserScript): 26 * WebKitTestRunner/TestController.h: 27 * WebKitTestRunner/TestInvocation.cpp: 28 (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): 29 * WebKitTestRunner/cocoa/TestControllerCocoa.mm: 30 (WTR::TestController::injectUserScript): 31 1 32 2018-07-12 Sihui Liu <sihui_liu@apple.com> 2 33 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r233688 r233782 344 344 void removeMockMediaDevice(DOMString persistentId); 345 345 void resetMockMediaDevices(); 346 347 void injectUserScript(DOMString string); 348 readonly attribute unsigned long userScriptInjectedCount; 346 349 }; -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
r231222 r233782 141 141 void textFieldDidEndEditing(); 142 142 143 void resetUserScriptInjectedCount() { m_userScriptInjectedCount = 0; } 144 void increaseUserScriptInjectedCount() { ++m_userScriptInjectedCount; } 145 size_t userScriptInjectedCount() const { return m_userScriptInjectedCount; } 146 143 147 private: 144 148 InjectedBundle(); … … 200 204 201 205 Vector<String> m_allowedHosts; 206 207 size_t m_userScriptInjectedCount { 0 }; 202 208 }; 203 209 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r233239 r233782 275 275 , m_world(AdoptWK, WKBundleScriptWorldCreateWorld()) 276 276 { 277 WKBundlePageLoaderClientV 8loaderClient = {278 { 8, this },277 WKBundlePageLoaderClientV9 loaderClient = { 278 { 9, this }, 279 279 didStartProvisionalLoadForFrame, 280 280 didReceiveServerRedirectForProvisionalLoadForFrame, … … 313 313 0, // willDestroyFrame_unavailable 314 314 0, // userAgentForURL 315 willInjectUserScriptForFrame 315 316 }; 316 317 WKBundlePageSetPageLoaderClient(m_page, &loaderClient.base); … … 444 445 445 446 uninstallFakeHelvetica(); 447 448 InjectedBundle::singleton().resetUserScriptInjectedCount(); 446 449 } 447 450 … … 591 594 { 592 595 static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didFinishProgress(); 596 } 597 598 void InjectedBundlePage::willInjectUserScriptForFrame(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void* clientInfo) 599 { 600 static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willInjectUserScriptForFrame(); 593 601 } 594 602 … … 758 766 759 767 injectedBundle.outputText("postProgressFinishedNotification\n"); 768 } 769 770 void InjectedBundlePage::willInjectUserScriptForFrame() 771 { 772 InjectedBundle::singleton().increaseUserScriptInjectedCount(); 760 773 } 761 774 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
r230224 r233782 78 78 static void didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKErrorRef, const void*); 79 79 static bool shouldCacheResponse(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, const void*); 80 static void willInjectUserScriptForFrame(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void*); 80 81 81 82 void didStartProvisionalLoadForFrame(WKBundleFrameRef); … … 96 97 void didRunInsecureContentForFrame(WKBundleFrameRef); 97 98 void didDetectXSSForFrame(WKBundleFrameRef); 99 void willInjectUserScriptForFrame(); 98 100 99 101 // Resource Load Client -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r233688 r233782 2268 2268 } 2269 2269 2270 size_t TestRunner::userScriptInjectedCount() const 2271 { 2272 return InjectedBundle::singleton().userScriptInjectedCount(); 2273 } 2274 2275 void TestRunner::injectUserScript(JSStringRef script) 2276 { 2277 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("InjectUserScript")); 2278 WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(script)); 2279 WKTypeRef returnData = 0; 2280 WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get(), &returnData); 2281 } 2282 2270 2283 } // namespace WTR -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r233688 r233782 455 455 void resetMockMediaDevices(); 456 456 457 size_t userScriptInjectedCount() const; 458 void injectUserScript(JSStringRef); 459 457 460 private: 458 461 TestRunner(); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r233688 r233782 2913 2913 { 2914 2914 } 2915 2916 void TestController::injectUserScript(WKStringRef) 2917 { 2918 } 2919 2915 2920 #endif 2916 2921 -
trunk/Tools/WebKitTestRunner/TestController.h
r233563 r233782 219 219 void resetMockMediaDevices(); 220 220 221 void injectUserScript(WKStringRef); 222 221 223 private: 222 224 WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r233688 r233782 1415 1415 } 1416 1416 1417 if (WKStringIsEqualToUTF8CString(messageName, "InjectUserScript")) { 1418 ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID()); 1419 WKStringRef script = static_cast<WKStringRef>(messageBody); 1420 1421 TestController::singleton().injectUserScript(script); 1422 } 1423 1417 1424 if (WKStringIsEqualToUTF8CString(messageName, "GetApplicationManifest")) { 1418 1425 #ifdef __BLOCKS__ -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r233468 r233782 281 281 } 282 282 283 void TestController::injectUserScript(WKStringRef script) 284 { 285 #if WK_API_ENABLED 286 auto userScript = adoptNS([[WKUserScript alloc] initWithSource: toWTFString(script) injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO]); 287 288 [[globalWebViewConfiguration userContentController] addUserScript: userScript.get()]; 289 #endif 290 } 291 283 292 } // namespace WTR
Note:
See TracChangeset
for help on using the changeset viewer.