Bug 51969

Summary: WebKit2: Should be able to call into injected bundle to ask if we should allow resource loads
Product: WebKit Reporter: Brian Weinstein <bweinstein>
Component: WebKit2Assignee: Brian Weinstein <bweinstein>
Status: RESOLVED FIXED    
Severity: Normal CC: aroben, sam, sfalken, webkit-ews, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
[PATCH] Fix
none
[PATCH] Fix + WebKitTestRunner adachan: review+

Description Brian Weinstein 2011-01-05 16:42:00 PST
WebKit2 needs a way to call into the injected bundle to ask whether or not we should load resources, and if the injected bundle says we should, we should cancel the resource load.
Comment 1 Brian Weinstein 2011-01-05 17:00:58 PST
Created attachment 78069 [details]
[PATCH] Fix
Comment 2 WebKit Review Bot 2011-01-05 17:02:54 PST
Attachment 78069 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'WebKit2/ChangeLog', u'WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h', u'WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp', u'WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h', u'WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp']" exit_code: 1
WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:90:  The parameter name "page" adds no information, so it should be removed.  [readability/parameter_name] [5]
WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:90:  The parameter name "frame" adds no information, so it should be removed.  [readability/parameter_name] [5]
WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h:90:  The parameter name "url" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 3 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Early Warning System Bot 2011-01-05 17:25:04 PST
Attachment 78069 [details] did not build on qt:
Build output: http://queues.webkit.org/results/7289428
Comment 4 Brian Weinstein 2011-01-05 17:39:26 PST
Created attachment 78080 [details]
[PATCH] Fix + WebKitTestRunner
Comment 5 Ada Chan 2011-01-06 10:52:08 PST
Comment on attachment 78080 [details]
[PATCH] Fix + WebKitTestRunner

Typo: 
// FIXME: We should problably ...
Comment 6 Alexey Proskuryakov 2011-01-06 13:25:04 PST
+bool InjectedBundlePageLoaderClient::shouldLoadResourceForFrame(WebPage* page, WebFrame* frame, const String& subResourceURL)
+{
+    if (!m_client.shouldLoadResourceForFrame)
+        return true;
+
+    return m_client.shouldLoadResourceForFrame(toAPI(page), toAPI(frame), toURLRef(subResourceURL.impl()), m_client.clientInfo);

Is it subResourceURL, or just resourceURL?
Comment 7 Brian Weinstein 2011-01-06 13:56:39 PST
Landed in r75174.
Comment 8 Brian Weinstein 2011-01-06 13:56:57 PST
(In reply to comment #6)
> +bool InjectedBundlePageLoaderClient::shouldLoadResourceForFrame(WebPage* page, WebFrame* frame, const String& subResourceURL)
> +{
> +    if (!m_client.shouldLoadResourceForFrame)
> +        return true;
> +
> +    return m_client.shouldLoadResourceForFrame(toAPI(page), toAPI(frame), toURLRef(subResourceURL.impl()), m_client.clientInfo);
> 
> Is it subResourceURL, or just resourceURL?

It should be resourceURL. I will fix this in a follow-up.