Bug 51969 - WebKit2: Should be able to call into injected bundle to ask if we should allow resource loads
Summary: WebKit2: Should be able to call into injected bundle to ask if we should allo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Brian Weinstein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-05 16:42 PST by Brian Weinstein
Modified: 2011-01-06 13:56 PST (History)
5 users (show)

See Also:


Attachments
[PATCH] Fix (5.45 KB, patch)
2011-01-05 17:00 PST, Brian Weinstein
no flags Details | Formatted Diff | Diff
[PATCH] Fix + WebKitTestRunner (9.11 KB, patch)
2011-01-05 17:39 PST, Brian Weinstein
adachan: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.