Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 408257 - script timer not being reset when Microsoft Silverlight plug-in fires event callbacks to Javascript.
: script timer not being reset when Microsoft Silverlight plug-in fires event c...
: verified1.8.1.12
Product: Core
Classification: Components
Component: Plug-ins (show other bugs)
: unspecified
: x86 All
: P3 normal with 1 vote (vote)
: ---
Assigned To: Johnny Stenback (:jst,
: Benjamin Smedberg [:bsmedberg]
Depends on:
  Show dependency treegraph
Reported: 2007-12-13 13:39 PST by Jaime Rodriguez
Modified: 2008-02-28 17:10 PST (History)
13 users (show)
dsicore: blocking1.9+
dveditz: wanted1.8.1.x+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Untested fix. (2.15 KB, patch)
2008-01-07 16:59 PST, Johnny Stenback (:jst,
no flags Details | Diff | Splinter Review
Untested fix. (988 bytes, patch)
2008-01-07 17:01 PST, Johnny Stenback (:jst,
jonas: review+
jonas: superreview+
dveditz: approval1.8.1.12+
Details | Diff | Splinter Review
1.8 branch patch (1.52 KB, patch)
2008-01-25 14:35 PST, :Gavin Sharp [email:]
no flags Details | Diff | Splinter Review

Description Jaime Rodriguez 2007-12-13 13:39:08 PST
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2; .NET CLR 1.1.4322; MS-RTC LM 8; .NET CLR 3.5.21022)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:; .NET CLR 2.0.50727) Gecko/20071127 Firefox/

When user interacts with the Silverlight plug-in (mouse moves, clicks, etc.) the event handling is via Silverlight calls back onto firefox to execute some javascript. 
The problem is that firefox thinks of most of these callbacks as a single function. For example, 1000 mouse moves sent consecutively in a very short time-frame is timed by Firefox as one single call.. Firefox then times the length of the whole call and often fires "Warning: Unresponsive script".. 

Reproducible: Always

Steps to Reproduce:
Assuming you have default dom.max_script_runtime of 10 seconds
2.If you get a "Get Silverlight" icon, click on it and install Silverlight. 
3. Click very quickly 3 times on the red ugly button..
Actual Results:  
If you clicked 3 times very quickly you should see the status window run a 7 second loop once and half way through the second one you will see a "Warning Unresponsive script" message.. 

Expected Results:  
This is 3 separate clicks and 3 call backs from Silverlight to Javascript, so I was it not expecting to time out, since it is under the 10 seconds of dom.max_script runtime..
For example, if I do the same thing with the HTML button; it loops fine 3 times with 7 seconds loops, not firing the warning. 

The Microsoft silverlight folks tell me they are not doing any thing special; they detect the clicks and call on the javascript ( no coalescing ). 
As far as they know there is nothing they can set on Firefox to tell it 'this is a new/unique event'. 

Sorry to not submit a trace; I can't get the symbols from to work with my 2.0.011 firefox; I always get a version mismatch. 

I also tried getting a 3.0.5 from trunk, and there I can get symbols, but I can't install silverlight. It always tell me SL is not installed even though it is and even when I install it in the browswer, it does not load the plugin when I restart.
Comment 1 Brendan Eich [:brendan] 2007-12-13 14:56:34 PST
(In reply to comment #0)
> User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1;
> When user interacts with the Silverlight plug-in (mouse moves, clicks, etc.)
> the event handling is via Silverlight calls back onto firefox to execute some
> javascript. 

Calls back into Firefox how, using what API?

Comment 2 Jaime Rodriguez 2007-12-13 15:08:06 PST
Two scenarios:
If we're provided just the name, we call Invoke on our NPObject with the NPIdent converted from the name.
If we're provided the script object (NPObject), we call InvokeDefault on the NPObject.
Comment 3 Johnny Stenback (:jst, 2007-12-13 16:40:12 PST
This seems to be a problem with the plugin scriptability API implementation.
Comment 4 Damon Sicore (:damons) 2007-12-17 15:49:05 PST
+'ing and P3.  Johnny, please re-prioritize this bug appropriately.
Comment 5 Jaime Rodriguez 2007-12-19 10:58:14 PST
Hi all, 
Since you re-prioritized.. is there any workaround you can suggest for this? 

We have been trying to forward the work via setTimeout () .. that helps but it is not 100% reliable since we are only forwarding the longer requests, the overhead of forwarding every thing felt too high. 
Any thing else we can check to know how much script Mozilla thinks has been run? or any way to fake it so that timers are reset appopriately? 

Thanks in advance, 
Comment 6 Johnny Stenback (:jst, 2008-01-07 16:59:37 PST
Created attachment 295870 [details] [diff] [review]
Untested fix.

This should fix this problem, but I don't have Silverlight installed so I haven't been able to test this yet. Any help testing this would be greatly appreciated.
Comment 7 Johnny Stenback (:jst, 2008-01-07 17:01:04 PST
Created attachment 295871 [details] [diff] [review]
Untested fix.

Same untested fix excluding an unrelated change that was laying around in my tree.
Comment 8 Johnny Stenback (:jst, 2008-01-17 15:27:10 PST
Could someone (that means you, Jaime :) test this out for me? There are installable Firefox builds with this change applied available here:
Comment 9 Jaime Rodriguez 2008-01-18 16:27:31 PST
Hi JST, 
Fix looks great !!  Thanks for fixing.. 

{Apologies for delay, we found new issue w/ Silverlight and Minefield related to an 'optimization' we had made on instantiation of the plugin, will start new thread for that] 
Comment 10 Johnny Stenback (:jst, 2008-01-20 21:36:20 PST
Thanks for testing Jaime!

Fix checked in, will be shipped with Firefox 3 (beta3 onwards, plus nightlies starting tomorrow).
Comment 11 Mike Shaver (:shaver -- probably not reading bugmail closely) 2008-01-25 12:05:20 PST
Would be good to get this on the branch, it's a pretty minimal fix.  Still room on the train?
Comment 12 Timothee Besset 2008-01-25 12:46:13 PST
+1 fixing in - we are affected by this in our plugin as well
Comment 13 Samuel Sidler (old account; do not CC) 2008-01-25 13:09:26 PST
Comment on attachment 295871 [details] [diff] [review]
Untested fix.

Requesting approval to get this patch in our queues.
Comment 14 Daniel Veditz [:dveditz] 2008-01-25 13:47:07 PST
Comment on attachment 295871 [details] [diff] [review]
Untested fix.

approved for, a=dveditz for release-drivers
Comment 15 Daniel Veditz [:dveditz] 2008-01-25 13:49:13 PST
note: code-freeze is supposed to be today, please don't forget to land this.
Comment 16 :Gavin Sharp [email:] 2008-01-25 14:35:35 PST
Created attachment 299299 [details] [diff] [review]
1.8 branch patch

GetScriptContextFromJSContext is in nsIScriptContext.h on the branch (same impl).
Comment 17 :Gavin Sharp [email:] 2008-01-25 14:38:40 PST
Comment on attachment 299299 [details] [diff] [review]
1.8 branch patch

Er, except that include is already there, in the previous line. I will not duplicate it!
Comment 18 :Gavin Sharp [email:] 2008-01-25 14:59:59 PST
Landed on the branch for (Firefox Also tested a branch build with the testcase from comment 0.
Comment 19 Al Billings [:abillings] 2008-01-30 16:15:01 PST
Verified with Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv: Gecko/2008012822 Firefox/ using test case. No issues (and no unresponsive script prompt).
Comment 20 Al Billings [:abillings] 2008-01-30 16:17:57 PST
I did notice one issue when I went and checked in trunk. I installed Siverlight in order to test this. On this same machine, both Firefox and detected that I installed Silverlight and run the test at the url. If I go there in my trunk build, even after restarting the browser several times, it isn't detecting that I have Siverlight installed. It shows me the icon for installing Silverlight instead.

So, there may be a trunk issue.

Note You need to log in before you can comment on or make changes to this bug.