Bug 60568 - REGRESSION (WebKit2): Flash plugin doesn't appear on a hanes.com page
Summary: REGRESSION (WebKit2): Flash plugin doesn't appear on a hanes.com page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Nobody
URL: http://www.hanes.com/Hanes/Products/K...
Keywords: InRadar, PlatformOnly, Regression
Depends on:
Blocks:
 
Reported: 2011-05-10 11:55 PDT by Adam Roben (:aroben)
Modified: 2011-05-11 13:37 PDT (History)
3 users (show)

See Also:


Attachments
Don't notify the plugin when a targeted javascript: URL request completes (7.17 KB, patch)
2011-05-11 13:21 PDT, Adam Roben (:aroben)
sfalken: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2011-05-10 11:55:15 PDT
To reproduce:

1. Go to http://www.hanes.com/Hanes/Products/Kids-Hanes/Kids_Boys-Hanes/Kids_Boys_boysbottoms-Hanes/WD307.aspx

The picture of the product never appears. If you right-click in the blank area, you see "Movie not loaded..."
Comment 1 Adam Roben (:aroben) 2011-05-10 11:55:26 PDT
<rdar://problem/8610657>
Comment 2 Adam Roben (:aroben) 2011-05-10 11:56:39 PDT
The bug does not occur in WebKit1.
Comment 3 Adam Roben (:aroben) 2011-05-10 11:56:49 PDT
Nor does it occur on Mac.
Comment 4 Adam Roben (:aroben) 2011-05-10 11:57:42 PDT
Things seem to proceed about the same in WebKit1 and WebKit2 until we're asked to load this URL:

http://hanes.richfx.com.edgesuite.net/image/viewers/base/asp/getSettings.aspx?RFX_SettingsPath=settings/&RFX_Image=WD307_YT&RFX_DontCache=False&RFX_Client=hanes&RFX_Catalog=&RFX_Int=anyspot_hanes&RFX_Lang=

When we call NPP_NewStream in WebKit2, we get back an NPERR_STREAM_NOT_SEEKABLE error. When we call NPP_NewStream in WebKit1, we get back NPERR_NO_ERROR.
Comment 5 Adam Roben (:aroben) 2011-05-10 12:02:03 PDT
Looks like WebKit1 and WebKit2 are passing the same parameters to NPP_NewStream. Maybe Flash is calling back into WebKit from inside NPP_NewStream and we're doing something different in WebKit1 vs. WebKit2?
Comment 6 Adam Roben (:aroben) 2011-05-10 12:06:37 PDT
I don't see any calls being made back into WebKit from within NPP_NewStream. Maybe some earlier call is to blame.
Comment 7 Adam Roben (:aroben) 2011-05-10 12:19:30 PDT
Here are the NPP_NewStream calls we make:

NPP_NewStream("application/x-shockwave-flash", "http://hanes.richfx.com.edgesuite.net/image/viewers/base/loader.swf", false, NP_NORMAL)

NPP_NewStream("application/x-shockwave-flash", "http://hanes.richfx.com.edgesuite.net/image/viewers/base/Zeus.swf", false, NP_NORMAL)

NPP_NewStream("text/xml", "http://hanes.richfx.com.edgesuite.net/image/viewers/base/asp/getSettings.aspx?RFX_SettingsPath=settings/&RFX_Image=WD307_YT&RFX_DontCache=False&RFX_Client=hanes&RFX_Catalog=&RFX_Int=anyspot_hanes&RFX_Lang=", false, NP_NORMAL)
Comment 8 Adam Roben (:aroben) 2011-05-10 13:17:00 PDT
I tried using the Flash content debugger plugin. The only output that's generated is:

Warning: Reference to undeclared variable, 'disableBlocker'
Comment 9 Adam Roben (:aroben) 2011-05-10 15:14:54 PDT
It looks like WebKit2 calls NPP_URLNotify for the javascript: URLs the plugin loads, while WebKit1 does not. Maybe that's significant?
Comment 10 Adam Roben (:aroben) 2011-05-10 15:31:46 PDT
I tried making WebKit2 never call NPP_URLNotify for javascript: URLs (just for testing purposes), and this bug went away.
Comment 11 Adam Roben (:aroben) 2011-05-10 15:45:25 PDT
WebKit1 doesn't call NPP_URLNotify for javascript: URLs if the URL had a non-null target. The javascript: URLs in question here (which all have the form "javascript:geturl_FSCommand('debug', ...)") all have a target of "_self".
Comment 12 Adam Roben (:aroben) 2011-05-10 15:46:39 PDT
Relevant WebKit1 code: <http://trac.webkit.org/browser/trunk/Source/WebCore/plugins/PluginView.cpp?rev=84371#L474>
Comment 13 Adam Roben (:aroben) 2011-05-10 15:53:15 PDT
In WebKit2, we are telling the plugin that the javascript: load failed (because the result of the script evaluation is a null string).
Comment 14 Adam Roben (:aroben) 2011-05-10 15:55:46 PDT
Next I will try making WebKit2 always tell Flash that the javascript: load succeeded, to see whether that is sufficient to fix the bug.
Comment 15 Alexey Proskuryakov 2011-05-11 00:24:27 PDT
I wonder if this is related to bug 36721 at all.
Comment 16 Adam Roben (:aroben) 2011-05-11 04:40:03 PDT
(In reply to comment #14)
> Next I will try making WebKit2 always tell Flash that the javascript: load succeeded, to see whether that is sufficient to fix the bug.

That does seem to be sufficient.
Comment 18 Adam Roben (:aroben) 2011-05-11 05:10:45 PDT
Here's a summary of the behaviors of the various plugin implementations, from reading the code. (I've omitted the cases where no notification was requested.):

WebKit1 Mac:
* If the target is null
   * If the result is non-empty
      * Send the result via a stream
         * NPP_URLNotify(NPRES_DONE)
   * Else
      * Do nothing
* Else
   * NPP_URLNotify(NPRES_DONE)

WebKit1 Windows (and Qt, GTK+, etc.):
* If the target is null
   * Send the result via a stream
      * If the result is null
         * NPP_URLNotify(NPRES_NETWORK_ERR)
      * Else
         * NPP_URLNotify(NPRES_DONE)
* Else
   Do nothing

WebKit2:
* If the target is null
   * Send the result via a stream
      * If the result is null
         * NPP_URLNotify(NPRES_NETWORK_ERR)
      * Else
         * NPP_URLNotify(NPRES_DONE)
* Else
   * If the result is null
      * NPP_URLNotify(NPRES_NETWORK_ERR)
   * Else
      * NPP_URLNotify(NPRES_DONE)
Comment 19 Adam Roben (:aroben) 2011-05-11 06:24:46 PDT
Found another implementation (of course!): <http://trac.webkit.org/browser/trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm?rev=83385#L688>

WebKit1 Mac OOP:
* If the target is null
   * Do nothing
* Else if the result is empty
   * Do nothing
* Else
   * Send the result via a stream
      * NPP_URLNotify(NPRES_DONE)
Comment 20 Adam Roben (:aroben) 2011-05-11 06:35:31 PDT
The requests that seem to matter on this page have the following attributes:

1) Target is not null ("_self")
2) Result is null

Based on the above pseudocode, this means the implementations have the following behavior on this page:

WebKit1 Mac:
* NPP_URLNotify(NPRES_DONE)

WebKit1 Mac OOP:
* Do nothing

WebKit1 Windows (/Qt/GTK/etc.):
* Do nothing

WebKit2:
* NPP_URLNotify(NPRES_NETWORK_ERR)
Comment 21 Adam Roben (:aroben) 2011-05-11 06:54:11 PDT
Another implementation:

http://google.com/codesearch/p#OAMlx_jo-ck/src/webkit/plugins/npapi/webplugin_impl.cc&l=1073
http://google.com/codesearch/p#OAMlx_jo-ck/src/webkit/plugins/npapi/plugin_instance.cc&l=360
http://google.com/codesearch/p#OAMlx_jo-ck/src/webkit/plugins/npapi/plugin_string_stream.cc&l=23

Chromium:
* If the result is null
   * NPP_URLNotify(NPRES_DONE)
* Else
   * Send the result via a stream
      * NPP_URLNotify(NPRES_DONE)

I've only included the behavior for javascript: requests above. Note that the target is ignored (other than an initial security check).
Comment 23 Adam Roben (:aroben) 2011-05-11 07:31:42 PDT
(In reply to comment #20)
> Based on the above pseudocode, this means the implementations have the following behavior on this page:
> 
> WebKit1 Mac:
> * NPP_URLNotify(NPRES_DONE)
> 
> WebKit1 Mac OOP:
> * Do nothing
> 
> WebKit1 Windows (/Qt/GTK/etc.):
> * Do nothing
> 
> WebKit2:
> * NPP_URLNotify(NPRES_NETWORK_ERR)

Chromium:
* NPP_URLNotify(NPRES_DONE)

Mozilla:
* Do nothing
Comment 24 Adam Roben (:aroben) 2011-05-11 07:39:20 PDT
(In reply to comment #15)
> I wonder if this is related to bug 36721 at all.

Yes, it is related. But it's only dealing with non-javascript: requests.
Comment 25 Adam Roben (:aroben) 2011-05-11 07:40:58 PDT
Mozilla and WebKit1 Windows/Qt/GTK+/etc. have the same behavior with respect to javascript: requests. Anders and I think we should make WebKit2 have this same behavior.
Comment 26 Adam Roben (:aroben) 2011-05-11 12:35:07 PDT
I confirmed that my analyses of the various implementations' behaviors were correct using a test page.
Comment 27 Adam Roben (:aroben) 2011-05-11 13:21:47 PDT
Created attachment 93164 [details]
Don't notify the plugin when a targeted javascript: URL request completes
Comment 28 Adam Roben (:aroben) 2011-05-11 13:37:09 PDT
Committed r86259: <http://trac.webkit.org/changeset/86259>