Changeset 75174 in webkit
- Timestamp:
- Jan 6, 2011 11:27:23 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r75169 r75174 1 2011-01-05 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Ada Chan. 4 5 WebKit2: Should be able to call into injected bundle to ask if we should allow resource loads 6 https://bugs.webkit.org/show_bug.cgi?id=51969 7 8 Add shouldLoadResourceForFrame to WTR::InjectedBundlePage. 9 10 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 11 (WTR::InjectedBundlePage::InjectedBundlePage): 12 (WTR::InjectedBundlePage::shouldLoadResourceForFrame): Stub implementation. 13 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h: 14 1 15 2011-01-06 James Robinson <jamesr@chromium.org> 2 16 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r73412 r75174 191 191 didCancelClientRedirectForFrame, 192 192 willPerformClientRedirectForFrame, 193 didHandleOnloadEventsForFrame 193 didHandleOnloadEventsForFrame, 194 shouldLoadResourceForFrame 194 195 }; 195 196 WKBundlePageSetLoaderClient(m_page, &loaderClient); … … 323 324 } 324 325 326 bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef, const void* clientInfo) 327 { 328 return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->shouldLoadResourceForFrame(frame); 329 } 330 325 331 326 332 void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame) … … 562 568 } 563 569 570 bool InjectedBundlePage::shouldLoadResourceForFrame(WKBundleFrameRef frame) 571 { 572 return true; 573 } 574 564 575 // UI Client Callbacks 565 576 -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
r73412 r75174 65 65 static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); 66 66 static void didRunInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*); 67 static bool shouldLoadResourceForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef, const void*); 67 68 void didStartProvisionalLoadForFrame(WKBundleFrameRef); 68 69 void didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef); … … 80 81 void didDisplayInsecureContentForFrame(WKBundleFrameRef); 81 82 void didRunInsecureContentForFrame(WKBundleFrameRef); 83 bool shouldLoadResourceForFrame(WKBundleFrameRef); 82 84 83 85 // UI Client -
trunk/WebKit2/ChangeLog
r75171 r75174 1 2011-01-05 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Ada Chan. 4 5 WebKit2: Should be able to call into injected bundle to ask if we should allow resource loads 6 https://bugs.webkit.org/show_bug.cgi?id=51969 7 8 Add the ability to call into the injected bundle to ask if we should allow resource loads. 9 If the injected bundle says we should cancel, we clear out the ResourceRequest that was 10 passed into willSendRequest, which cancels the resource load. 11 12 * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Add the new callback for allowing/cancelling 13 resource loads. 14 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp: 15 (WebKit::InjectedBundlePageLoaderClient::shouldLoadResourceForFrame): Calls through to the client. 16 * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h: 17 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 18 (WebKit::WebFrameLoaderClient::dispatchWillSendRequest): Ask the InjectedBundlePageLoaderClient if we 19 should load the resource or not. 20 1 21 2011-01-06 Jeff Miller <jeffm@apple.com> 2 22 -
trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
r74698 r75174 88 88 typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo); 89 89 typedef void (*WKBundlePageDidHandleOnloadEventsForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); 90 typedef bool (*WKBundlePageShouldLoadResourceForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, const void *clientInfo); 90 91 91 92 … … 113 114 WKBundlePageWillPerformClientRedirectForFrameCallback willPerformClientRedirectForFrame; 114 115 WKBundlePageDidHandleOnloadEventsForFrameCallback didHandleOnloadEventsForFrame; 116 WKBundlePageShouldLoadResourceForFrameCallback shouldLoadResourceForFrame; 115 117 }; 116 118 typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient; -
trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
r73412 r75174 176 176 } 177 177 178 bool InjectedBundlePageLoaderClient::shouldLoadResourceForFrame(WebPage* page, WebFrame* frame, const String& subResourceURL) 179 { 180 if (!m_client.shouldLoadResourceForFrame) 181 return true; 182 183 return m_client.shouldLoadResourceForFrame(toAPI(page), toAPI(frame), toURLRef(subResourceURL.impl()), m_client.clientInfo); 184 } 185 178 186 void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world) 179 187 { -
trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
r73412 r75174 61 61 void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData); 62 62 63 bool shouldLoadResourceForFrame(WebPage*, WebFrame*, const String&); 64 63 65 void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*); 64 66 void didCancelClientRedirectForFrame(WebPage*, WebFrame*); -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r75031 r75174 157 157 return; 158 158 159 if (!webPage->injectedBundleLoaderClient().shouldLoadResourceForFrame(webPage, m_frame, request.url().string())) { 160 request = ResourceRequest(); 161 // FIXME: We should probably send a message saying we cancelled the request for the resource. 162 return; 163 } 164 159 165 webPage->send(Messages::WebPageProxy::DidSendRequestForResource(m_frame->frameID(), identifier, request, redirectResponse)); 160 166 }
Note: See TracChangeset
for help on using the changeset viewer.