Closed
Bug 1061278
Opened 11 years ago
Closed 11 years ago
console.log is asynchronous
Categories
(DevTools :: Console, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 754861
People
(Reporter: nick, Unassigned)
References
()
Details
So if I have a block of code like:
```javascript
var worker = new Worker('whatever.js');
var xhr = new XMLHttpRequest;
xhr.open('GET', 'whatever.txt');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
console.log(xhr.response);
worker.postMessage(xhr.response, [xhr.response]);
console.log(xhr.response);
};
xhr.send();
```
I would expect the first logged ArrayBuffer to have a byteLength of whatever.txt, and the second logged Array buffer to have a byteLength property of 0. Instead both are 0. How is it zero before I invoke postMessage?
| Reporter | ||
Updated•11 years ago
|
Comment 1•11 years ago
|
||
console.log works asynchronously. You can see this trivially with a testcase like this:
var obj = { a: 5 };
console.log(obj);
obj.a = 6;
Component: JavaScript Engine → Developer Tools: Console
Product: Core → Firefox
Comment 2•11 years ago
|
||
Also, note that the behavior was added pretty purposefully.
Summary: Transferrable Objects cleared too soon? → console.log is asynchronous
| Reporter | ||
Comment 3•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #2)
> Also, note that the behavior was added pretty purposefully.
So is this bug a non issue?
Comment 4•11 years ago
|
||
I would say it's a known issue (bug 754861). Fixing this would likely make games and other apps that use console.log in a tight loop appear very slow in Firefox. I don't have enough data to have an informed opinion on which is more important. I'll see if our product folks do.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Comment 5•11 years ago
|
||
Couldn't we take the performance hit only when the developer tools are being used?
Updated•8 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•