Bug 45770 - When a live frame is moved between pages, some plug-in DOM methods cease to function
Summary: When a live frame is moved between pages, some plug-in DOM methods cease to f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Frames (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jenn Braithwaite
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 12:28 PDT by Alexey Proskuryakov
Modified: 2011-01-07 16:45 PST (History)
12 users (show)

See Also:


Attachments
patch (18.26 KB, patch)
2010-12-23 15:38 PST, Jenn Braithwaite
levin: review-
Details | Formatted Diff | Diff
updated patch (17.96 KB, patch)
2011-01-04 11:35 PST, Jenn Braithwaite
dimich: review-
Details | Formatted Diff | Diff
updated patch (21.08 KB, patch)
2011-01-06 15:30 PST, Jenn Braithwaite
no flags Details | Formatted Diff | Diff
updated patch (21.21 KB, patch)
2011-01-06 16:32 PST, Jenn Braithwaite
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2010-09-14 12:28:33 PDT
There is a per-Page PluginData object which Plugin and MimeType reference. If a document moves to another pages, these references should all be updated.

On my test cases, this results in calls like navigator.plugins[0].item(0).enabledPlugin return null, but if we missed a null check somewhere, it can also crash once the other page is destroyed.
Comment 1 Jenn Braithwaite 2010-12-22 15:37:21 PST
Created test case that triggers this failure.  Still investigating a fix.
Comment 2 Jenn Braithwaite 2010-12-23 15:38:48 PST
Created attachment 77377 [details]
patch
Comment 3 WebKit Review Bot 2010-12-23 15:58:45 PST
Attachment 77377 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/7205142
Comment 4 WebKit Review Bot 2010-12-23 16:11:30 PST
Attachment 77377 [details] did not build on gtk:
Build output: http://queues.webkit.org/results/7313148
Comment 5 David Levin 2010-12-27 11:17:29 PST
Comment on attachment 77377 [details]
patch

r- This patch breaks several builds (and may have style issues as well).
Comment 6 Jenn Braithwaite 2011-01-04 11:35:47 PST
Created attachment 77913 [details]
updated patch

Fixed include ordering and restored initPlugins() to avoid breaking platform builds.
Comment 7 Dmitry Titov 2011-01-06 12:06:55 PST
Comment on attachment 77913 [details]
updated patch

View in context: https://bugs.webkit.org/attachment.cgi?id=77913&action=review

Few comments (r- to add description to the test)

> LayoutTests/fast/frames/iframe-reparenting-plugins.html:55
> +<body onload="test()">

It would be nice to have a short text description of the test here - what it does, what constitutes the failure and success.
Also, why we always expect to find a plugin there.

> WebCore/page/Frame.h:72
> +    class FrameObserver {

If this is only used to get a callback on frame destruction, it could be more specific and be called FrameDestructionObserver, with frameDestroyed() as a name of its callback function. So that it doesn't get an assortment of various callbacks in the future.

> WebCore/plugins/DOMMimeType.cpp:71
> +    if (!m_frame || !m_frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))

How important is the change in behavior here? Lets say I have a page on apple.com embedding an iframe from YouTube. Could it be possible that Flash is disabled for apple.com but not YouTube, and while old behavior would disable Flash in that combination (because it could use settings for apple.com), the new one would not.

> WebCore/plugins/PluginData.cpp:38
> +    m_page = 0; // Page only needed by initPlugins if USE(PLATFORM_STRATEGIES).

Is it possible to only have m_page if USE(PLATFORM_STRATEGIES)?
Comment 8 Jenn Braithwaite 2011-01-06 13:07:26 PST
(In reply to comment #7)
> (From update of attachment 77913 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=77913&action=review
> 
> Few comments (r- to add description to the test)
> 
> > LayoutTests/fast/frames/iframe-reparenting-plugins.html:55
> > +<body onload="test()">
> 
> It would be nice to have a short text description of the test here - what it does, what constitutes the failure and success.
> Also, why we always expect to find a plugin there.

Will change.

> 
> > WebCore/page/Frame.h:72
> > +    class FrameObserver {
> 
> If this is only used to get a callback on frame destruction, it could be more specific and be called FrameDestructionObserver, with frameDestroyed() as a name of its callback function. So that it doesn't get an assortment of various callbacks in the future.

Will change.

> 
> > WebCore/plugins/DOMMimeType.cpp:71
> > +    if (!m_frame || !m_frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiatePlugin))
> 
> How important is the change in behavior here? Lets say I have a page on apple.com embedding an iframe from YouTube. Could it be possible that Flash is disabled for apple.com but not YouTube, and while old behavior would disable Flash in that combination (because it could use settings for apple.com), the new one would not.

I don't know the answer to this one.  However, I can make it use m_frame->page()->mainFrame() instead to keep the old behavior.

> 
> > WebCore/plugins/PluginData.cpp:38
> > +    m_page = 0; // Page only needed by initPlugins if USE(PLATFORM_STRATEGIES).
> 
> Is it possible to only have m_page if USE(PLATFORM_STRATEGIES)?

I can do that.
Comment 9 Jenn Braithwaite 2011-01-06 15:30:36 PST
Created attachment 78179 [details]
updated patch
Comment 10 Dmitry Titov 2011-01-06 16:24:15 PST
Comment on attachment 78179 [details]
updated patch

View in context: https://bugs.webkit.org/attachment.cgi?id=78179&action=review

Great! A couple of nits:

> LayoutTests/fast/frames/resources/iframe-reparenting-plugins-iframe-content.html:11
> +      return "FAIL: Failed to find netscape test plugin\n";

could remove 'netscape'.

> WebCore/page/Frame.h:93
> +        void addObserver(FrameDestructionObserver*);

addObserver -> addDestructionObserver ? 
same for removeObserver and m_observers below.
Comment 11 Jenn Braithwaite 2011-01-06 16:32:13 PST
Created attachment 78187 [details]
updated patch

netscape text removed.
observer -> destructionObserver in method name and member var.
Comment 12 Dmitry Titov 2011-01-06 16:33:11 PST
Comment on attachment 78187 [details]
updated patch

r=me
Comment 13 WebKit Commit Bot 2011-01-06 17:59:05 PST
Comment on attachment 78187 [details]
updated patch

Clearing flags on attachment: 78187

Committed r75217: <http://trac.webkit.org/changeset/75217>
Comment 14 WebKit Commit Bot 2011-01-06 17:59:10 PST
All reviewed patches have been landed.  Closing bug.
Comment 16 WebKit Review Bot 2011-01-07 02:28:54 PST
http://trac.webkit.org/changeset/75217 might have broken GTK Linux 32-bit Debug
Comment 17 Dmitry Titov 2011-01-07 16:45:22 PST
The failure on Chrome Windows is tracked by bug 52062