WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
77766
Need a WK2 API to filter which subframes go into WebArchives as they are created
https://bugs.webkit.org/show_bug.cgi?id=77766
Summary
Need a WK2 API to filter which subframes go into WebArchives as they are created
Brady Eidson
Reported
2012-02-03 12:57:50 PST
Need a WK2 API to filter which subframes go into WebArchives as they are created In radar as <
rdar://problem/10742441
>
Attachments
Patch v1 - Add filtering capability to WebCore::LegacyWebArchive and expose as a new WK2 API
(13.29 KB, patch)
2012-02-03 13:09 PST
,
Brady Eidson
no flags
Details
Formatted Diff
Diff
Patch v2 - Use a callback object for the WebCore -> WebKit interface
(14.09 KB, patch)
2012-02-03 14:30 PST
,
Brady Eidson
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Brady Eidson
Comment 1
2012-02-03 13:09:51 PST
Created
attachment 125394
[details]
Patch v1 - Add filtering capability to WebCore::LegacyWebArchive and expose as a new WK2 API
Anders Carlsson
Comment 2
2012-02-03 13:39:51 PST
Comment on
attachment 125394
[details]
Patch v1 - Add filtering capability to WebCore::LegacyWebArchive and expose as a new WK2 API Instead of having a callback + context pointer, the more common way to do this in WebCore is to have an abstract class with a pure virtual member function and then make a subclass inside WebKit2. I think that would be more clear.
Brady Eidson
Comment 3
2012-02-03 14:30:00 PST
Created
attachment 125415
[details]
Patch v2 - Use a callback object for the WebCore -> WebKit interface
Darin Adler
Comment 4
2012-02-03 14:37:59 PST
Comment on
attachment 125415
[details]
Patch v2 - Use a callback object for the WebCore -> WebKit interface View in context:
https://bugs.webkit.org/attachment.cgi?id=125415&action=review
> Source/WebCore/loader/archive/cf/LegacyWebArchive.h:40 > +class LegacyWebArchiveSubframeFilterCallback {
Could just call this FrameFilter. There’s nothing here that is specific to LegacyWebArchive.
> Source/WebCore/loader/archive/cf/LegacyWebArchive.h:43 > + virtual bool shouldIncludeSubframe(Frame*) = 0;
I think this should be const.
> Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h:77 > +typedef bool (*WKBundleFrameCopyWebArchiveSubframeFilterCallback)(WKBundleFrameRef frame, WKBundleFrameRef subframe, void* context);
I don’t think the type needs to include the name of the function it’s used in. I would call this a WKBundleFrameFilterFunction.
> Source/WebKit2/WebProcess/WebPage/WebFrame.cpp:744 > + virtual bool shouldIncludeSubframe(Frame*);
This should be private rather than public. This should use the override keyword.
> Source/WebKit2/WebProcess/WebPage/WebFrame.cpp:761 > + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
Might want to restructure this to use an early return so we don’t do all this work if m_callback is 0.
> Source/WebKit2/WebProcess/WebPage/WebFrame.cpp:763 > + return m_callback ? m_callback(toAPI(m_topLevelWebFrame), toAPI(webFrame), m_context) : true;
I sometimes write this as: return !m_callback || m_callback(xxx); Eliminates that thing where ": true" is so far from the "?".
> Source/WebKit2/WebProcess/WebPage/WebFrame.h:141 > + typedef bool (*WebFrameCopyWebArchiveSubframeFilterCallback)(WKBundleFrameRef, WKBundleFrameRef subframe, void* context);
Since this type is a member, I suggest keeping its name much smaller. Maybe FrameFilterFunction.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug