Closed
Bug 478231
Opened 17 years ago
Closed 6 years ago
new Date() needs to be called on main thread before being functional on other threads
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: jerome.bugzilla, Unassigned)
Details
Attachments
(1 file)
|
4.04 KB,
application/octet-stream
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 YFF3 Firefox/3.0.6 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 YFF3 Firefox/3.0.6 (.NET CLR 3.5.30729)
new Date() hangs if called on worker thread before it has been called on main thread.
In the steps to reproduce section, you can find the main js file of a xulrunner app that reproduces the issue.
Comment out the line with var dateMain = new Date(); and the app won't exit.
Reproducible: Always
Steps to Reproduce:
const Cc = Components.classes;
const Ci = Components.interfaces;
const NS_HTML = 'http://www.w3.org/1999/xhtml';
var threads = {
// Hooks to threads
worker: null,
main: null,
// Create thread hooks and instantiate GraphicsMagick
init: function() {
// Threads themselves
var t = Cc['@mozilla.org/thread-manager;1'].getService();
threads.worker = t.newThread(0);
threads.main = t.mainThread;
document.getElementById('button_test').style.display = 'block';
document.getElementById('button_init').style.display = 'none';
},
test: function() {
document.getElementById('button_test').style.display = 'none';
var dateMain = new Date();
var img = document.createElementNS(NS_HTML, 'img');
img.setAttribute('width', 16);
img.setAttribute('height', 8);
img.src = 'chrome://xultest/content/balls-16x8-trans.gif';
var li = document.createElementNS(NS_HTML, 'li');
li.appendChild(img);
var list = document.getElementById('photos_list');
list.insertBefore(li, list.firstChild);
threads.worker.dispatch(new Testing(), threads.worker.DISPATCH_NORMAL);
},
quitting: function() {
if(threads.worker)
threads.worker.shutdown();
alert("successful exit");
}
};
var Testing = function() {
};
Testing.prototype = {
run: function() {
var dateThread = new Date();
threads.main.dispatch(new TestingCallback(), threads.main.DISPATCH_NORMAL);
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIRunnable) || iid.equals(Ci.nsISupports)) {
return this;
}
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
var TestingCallback = function() {
};
TestingCallback.prototype = {
run: function() {
alert('test passed');
document.getElementById('button_test').style.display = 'block';
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIRunnable) || iid.equals(Ci.nsISupports)) {
return this;
}
throw Components.results.NS_ERROR_NO_INTERFACE;
}
};
Component: General → JavaScript Engine
Product: Firefox → Core
Version: unspecified → 1.9.0 Branch
Sorry I left some useless code: remove these lines too:
var img = document.createElementNS(NS_HTML, 'img');
img.setAttribute('width', 16);
img.setAttribute('height', 8);
img.src = 'chrome://xultest/content/balls-16x8-trans.gif';
var li = document.createElementNS(NS_HTML, 'li');
li.appendChild(img);
var list = document.getElementById('photos_list');
list.insertBefore(li, list.firstChild);
Updated•17 years ago
|
Assignee: nobody → general
QA Contact: general → general
Updated•16 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
(removing "workers" from the subject line just so this won't be confused with HTML5 Web Workers)
Summary: new Date() needs to be called on main thread before being functional on workers threads → new Date() needs to be called on main thread before being functional on other threads
| Assignee | ||
Updated•12 years ago
|
Assignee: general → nobody
Comment 4•6 years ago
|
||
Closing this issue because it's unlikely it still applies today, given that there have been too many changes in the code involved.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•