Bug 118330 - The callback for WKPageGetPlugInInformation needs info about whether or not there are any non-playing instances of the plug-in on the page
Summary: The callback for WKPageGetPlugInInformation needs info about whether or not t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jessie Berlin
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-07-02 15:41 PDT by Jessie Berlin
Modified: 2013-07-02 17:07 PDT (History)
6 users (show)

See Also:


Attachments
Patch (14.10 KB, patch)
2013-07-02 15:58 PDT, Jessie Berlin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jessie Berlin 2013-07-02 15:41:09 PDT
<rdar://problem/14320278>
Comment 1 Jessie Berlin 2013-07-02 15:58:11 PDT
Created attachment 205954 [details]
Patch
Comment 2 Dean Jackson 2013-07-02 16:14:03 PDT
Comment on attachment 205954 [details]
Patch

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

> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1000
> +        HTMLPlugInImageElement* plugInImageElement = toHTMLPlugInImageElement(node);
> +        mimeTypes.add(plugInImageElement->loadedMimeType());

Nit: merge into one line.

> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1022
> +        RefPtr<NodeList> plugIns = frame->document()->getElementsByTagName(WebCore::HTMLNames::embedTag.localName());

What about <object>?
Comment 3 Dean Jackson 2013-07-02 16:14:26 PDT
Comment on attachment 205954 [details]
Patch

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

>> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1022
>> +        RefPtr<NodeList> plugIns = frame->document()->getElementsByTagName(WebCore::HTMLNames::embedTag.localName());
> 
> What about <object>?

Duh! right below :)
Comment 4 Andy Estes 2013-07-02 16:15:28 PDT
Comment on attachment 205954 [details]
Patch

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

> Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp:106
> +    return ASCIILiteral("PluginInformationPageContainsNonPlayingInstanceOfPlugIn");

Plugin or PlugIn?

> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1024
> +        RefPtr<NodeList> plugIns = frame->document()->getElementsByTagName(WebCore::HTMLNames::embedTag.localName());
> +        if (plugIns)
> +            addPlugInMimeTypesFromNodeListForNonPlayingPlugIns(plugIns, nonPlayingPlugInMimeTypes);

Why keep a RefPtr here instead of just passing the PassRefPtr you got from getElementsByTagName() into addPlugInMimeTypesFromNodeListForNonPlayingPlugIns()? You seem to be adding some refcount churn that isn't necessary.

> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1028
> +        plugIns = frame->document()->getElementsByTagName(WebCore::HTMLNames::objectTag.localName());
> +        if (plugIns)
> +            addPlugInMimeTypesFromNodeListForNonPlayingPlugIns(plugIns, nonPlayingPlugInMimeTypes);

Ditto.

Also, should you be looking for <applet> elements?
Comment 5 Anders Carlsson 2013-07-02 16:20:36 PDT
Comment on attachment 205954 [details]
Patch

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

>> Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp:106
>> +    return ASCIILiteral("PluginInformationPageContainsNonPlayingInstanceOfPlugIn");
> 
> Plugin or PlugIn?

PlugIn!

> Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm:503
> +    for (const String& plugInMimeType : nonPlayingPlugInInstanceMimeTypes) {

No space before the colon.

>> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1028
>> +            addPlugInMimeTypesFromNodeListForNonPlayingPlugIns(plugIns, nonPlayingPlugInMimeTypes);
> 
> Ditto.
> 
> Also, should you be looking for <applet> elements?

Yes, should look for <applet>s.
Comment 6 Jessie Berlin 2013-07-02 16:33:33 PDT
(In reply to comment #5)
> (From update of attachment 205954 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=205954&action=review
> 
> >> Source/WebKit2/Shared/Plugins/Netscape/PluginInformation.cpp:106
> >> +    return ASCIILiteral("PluginInformationPageContainsNonPlayingInstanceOfPlugIn");
> > 
> > Plugin or PlugIn?
> 
> PlugIn!

Fixed!

> 
> > Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm:503
> > +    for (const String& plugInMimeType : nonPlayingPlugInInstanceMimeTypes) {
> 
> No space before the colon.

Fixed.

> 
> >> Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1028
> >> +            addPlugInMimeTypesFromNodeListForNonPlayingPlugIns(plugIns, nonPlayingPlugInMimeTypes);
> > 
> > Ditto.

I was mimicking HTMLPlugInImageElement::restartSimilarPlugIns a little too closely.

Fixed, and added an early return in addPlugInMimeTypesFromNodeListForNonPlayingPlugIns if !plugIns. 

> > 
> > Also, should you be looking for <applet> elements?
> 
> Yes, should look for <applet>s.

No, we do not snapshot Java.

Added an assertion in addPlugInMimeTypesFromNodeListForNonPlayingPlugIns:

ASSERT(!plugInElement->hasTagName(WebCore::HTMLNames::appletTag));
Comment 7 Jessie Berlin 2013-07-02 17:07:22 PDT
Comment on attachment 205954 [details]
Patch

Committed in http://trac.webkit.org/changeset/152328