Last Comment Bug 691046 - worker.postMessage behaves like there is a hidden exception in Cloud9 Ace
: worker.postMessage behaves like there is a hidden exception in Cloud9 Ace
Status: VERIFIED FIXED
[qa!]
: regression
Product: Core
Classification: Components
Component: DOM (show other bugs)
: 8 Branch
: x86 Mac OS X
: -- normal (vote)
: mozilla8
Assigned To: Ben Turner (not reading bugmail, use the needinfo flag!)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-01 06:57 PDT by Fabian Jakobs
Modified: 2011-10-31 14:08 PDT (History)
10 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+
fixed
+
fixed
fixed


Attachments
kitchen-sink-uncompressed.js (1.04 MB, text/plain)
2011-10-01 06:57 PDT, Fabian Jakobs
no flags Details
Patch, v1 (2.13 KB, patch)
2011-10-02 13:37 PDT, Ben Turner (not reading bugmail, use the needinfo flag!)
jonas: review+
asa: approval‑mozilla‑aurora+
asa: approval‑mozilla‑beta+
Details | Diff | Review

Description Fabian Jakobs 2011-10-01 06:57:48 PDT
Created attachment 563961 [details]
kitchen-sink-uncompressed.js

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/535.5 (KHTML, like Gecko) Chrome/16.0.891.1 Safari/535.5

Steps to reproduce:

The latest FF 8 beta broke the Ace editor <http://ace.ajax.org>. I was able to trace it down to a problem with web workers and postMessage. The relevant code is:

console.log("before")
this.$worker.postMessage({event: event, data: data});
console.log("posted");

The last line is never executed, however there is no error shown and the callstack is rolled back just normal. It looks like an invisible exception is thrown.

Steps to reproduce:

1. go to <http://fjakobs.github.com/ace_ff8_bug/kitchen-sink.html>
2. execute fire() in the console.
3. Observe that "before" is printed but "posted" is not.

Setting a breakpoint in <http://fjakobs.github.com/ace_ff8_bug/demo/kitchen-sink-uncompressed.js> line 17245 and stepping over the postMessage shows this behavior.
Comment 1 Fabian Jakobs 2011-10-01 07:03:59 PDT
the related Ace bug is <https://github.com/ajaxorg/ace/issues/405>
Comment 2 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-10-02 13:34:25 PDT
Yeah, there's a bug here, in our code as well as yours I think. You're calling postMessage() on a worker after you call terminate() on it which is probably not what you mean to do. However, the bigger problem here is that we throw an uncatchable exception in this case.
Comment 3 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-10-02 13:37:37 PDT
Created attachment 564078 [details] [diff] [review]
Patch, v1

Patch should fix us.
Comment 4 Fabian Jakobs 2011-10-04 08:31:58 PDT
Calling postMessage() after terminate() is really not what I intended. Let me know once you have a build where I can test the fix. The bug is currently in FF 8beta and I think it is pretty severe.
Comment 5 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-10-05 16:40:06 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/74e93efada21
Comment 6 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-10-05 16:41:07 PDT
Comment on attachment 564078 [details] [diff] [review]
Patch, v1

This fixes a pretty bad bug in the new worker implementation (new in FF8) and it's a tiny change, well localized.
Comment 7 Ed Morley [:emorley] 2011-10-06 08:49:55 PDT
https://hg.mozilla.org/mozilla-central/rev/74e93efada21
Comment 9 Anthony Hughes (:ashughes) [GFX][QA][Mentor] 2011-10-13 11:24:54 PDT
qa+ for verification in Firefox 8, 9, and 10 using the testcase in comment 0.
Comment 10 AndreiD[QA] 2011-10-14 07:55:54 PDT
I tested to see if the issue is still reproducible since the fix landed on all channels (comment 7 and comment8); I followed the steps to reproduce in the description and got the following results:
WORKS:
-> Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20100101 Firefox/8.0 (Mac OS 10.6 - Beta)
-> Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0a2) Gecko/20111013 Firefox/9.0a2 (Mac OS 10.6 - Aurora)
-> Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0a1) Gecko/20111013 Firefox/10.0a1 (Mac OS 10.6 - Nightly)

Since it works on all channels setting this bug as Verified and changing the whiteboard entry qa+ to qa!
Comment 11 christian 2011-10-31 14:08:53 PDT
[triage comment]

We'll track this as it was a regression in a widely used library and we'll want to be aware if it breaks or wasn't fixed all the way. Because it is already fixed in beta, nothing to do currently.

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