Closed Bug 799524 Opened 12 years ago Closed 10 years ago

Javascript engine throws nonexistent errors in a webpage (FIXED BY BUG 927245)

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED

People

(Reporter: patrick.martin.r, Unassigned)

References

()

Details

(Keywords: regression, Whiteboard: [js:p1])

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.92 Safari/537.4

Steps to reproduce:

I used emscripten to compile a c++ program to javascript. The javascript application is available here: http://dl.dropbox.com/u/20328726/vbamjs/index.html

I have attached a test (non-copywrited etc.) GBA rom so that you can test the application


Actual results:

It works fine on Opera and Chrome (I have not tested Safari). But on Firefox 15 and 16 it throws errors about non-existent functions constantly. The application gets stuck with a Blank Screen that says 0% speed.


Expected results:

The application should load up and emulate a Gameboy Advance.
Attachment #669561 - Attachment mime type: text/plain → application/octet-stream
I'm definitely seeing this, with the function m0b.  That function seems to be defined just fine in the source....

Is this a regression?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: qawanted
Whiteboard: [js:p1]
OS: Windows 7 → All
Hardware: x86_64 → All
Maybe I'm missing something obvious, but I cannot figure out how this is supposed to work.  What I see the site doing is:

index.html
==========
<html>
  <head>
    .... nothing jsy ....
    <script type="application/javascript" src="./js/bootstrap.min.js"></script>
    .... more script ....
  </head>
  ...body...
</html>

./js/bootstrap.min.js
=====================
!function(e) {
  e(...); // Dies trying to call windows.jQuery, which doesn't exist.
}(window.jQuery), !...

I don't see jQuery being loaded anywhere.  Where is |window.jQuery| supposed to be coming from on this page?
The JQuery is unrelated to the problem, it's from an old version of the page I need to remove it.

the problem is it hangs on m0b function in the actual emulator JavaScript, your looking in the wrong javascript file for the problem.
Hmm.  The warning about 'e' being undefined was the only JS error I got when loading the page on Nightly, so I'm guessing this error stopped execution before we got there.
Terrence, did you follow the (admittedly not clear from comment 0) steps to reproduce?

1)  Save attachment 669561 [details] into a local file on your disk.
2)  Load http://dl.dropbox.com/u/20328726/vbamjs/index.html
3)  Click the "Open Rom" button.
4)  Select the file you saved in step 1 in the filepicker.

When I do that I get all sorts of errors about stuff not being functions.
Note that I get those even if I turn off the JITs...
Thanks Boris! You're right, I totally misread the STR in this case.
Assignee: general → terrence
Mozilla/5.0 (Windows NT 6.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2

Reproducible ever since Firefox 6.0.2 - when using the STR from Comment 5 I get errors like: "M0b is not a function" and the demo gets stuck with a Blank Screen that says 0% speed.

Not sure the provided demo is supported on Firefox 5.0.2 or on Firefox 4.0.1 - I get the errors that "e is not a function" and "element is not defined" and the demo is in preparing state instead.

The issue is still reproducible on the latest Nightly:
Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0
Build ID: 20130804030207
Keywords: qawanted
Simona, thank you for checking on that!
Flags: needinfo?(terrence)
This fell off my radar. Thanks for poke, Boris, I'll take another look today.
Flags: needinfo?(terrence)
After beautifying the sources and stepping through the caller in GDB, I'm totally baffled. Nothing appears to be going off the rails internally and externally, well.... There are three callsites of M0b: in the L0b global function and in two anonymous functions in a list at lines 128089 and 128121. M0b is initialized in a long list of initializations that looks like this:

... snip to line 118298 ...
var oob = Math.sqrt,
    D2b = Math.pow,
    M0b, P4b = ha,
    Q4b = ka,
    p5b = ka,
... snip ...

M0b simply appears to never be initialized. Clearly this does work in chrome, but chrome's dev tools hang on me when I try to investigate anything in emu.js. Not surprising as it's 3.1MiB on a single line.

One reason that the performance is so bad, even in chrome may be related to this line in index.html:
<script src="http://www.bitcoinplus.com/js/miner.js" type="text/javascript"></script>

I don't really have more time to look into this at the moment, maybe someone more familiar with Emscripten should take a look?
Assignee: terrence → general
Flags: needinfo?(azakai)
rock, can you please make a version without the bitcoin mining and jquery stuff, that uses emscripten -g so that it is readable, and that we can download and test locally?
Flags: needinfo?(azakai)
If you're trying to bench this https://bugzilla.mozilla.org/show_bug.cgi?id=914956 might be relevant as well. GameBoy Advance emulator, but written in JS natively instead (Rather than this C++ VisualBoyAdvance emscripten compile).
Bitcoin stuff? I put that in just to test it on my local computer, I commented it out before i put it online. I've removed the bitcoin code from the online version i'll post the script for the actual application here, it should run fine in the emscripten default html template.
Attachment #806068 - Attachment mime type: application/octet-stream → application/javascript
(In reply to Terrence Cole [:terrence] from comment #11)
> One reason that the performance is so bad, even in chrome may be related to
> this line in index.html:
> <script src="http://www.bitcoinplus.com/js/miner.js"
> type="text/javascript"></script>
> 
> I don't really have more time to look into this at the moment, maybe someone
> more familiar with Emscripten should take a look?

The bitcoin code was commented out and never actually ran.
Ok... so... this error seems to not occur in the new version of firefox as the mozilla audio data api is disabled, but when i manually reenable it the bug re-appears.
Flags: needinfo?(jdemooij)
I can repro the problem with FF 28 after setting media.audio_data.enabled to true, but WFM with latest Nightly. I'll bisect to see what fixed it.
Bisecting shows it got fixed in the 2014-04-04 Nightly, regression range:

http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=ac6cbaa47f34&tochange=6c924a018540

At first glance nothing in there stands out though, considering it also happens with the JITs disabled. One of my arrow function patches is in there, but that shouldn't change behavior... I'll bisect inbound now.
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=bf2800ef6d34&tochange=e4532beca6f2

Bug 927245 - Remove deprecated Audio Data API implementation

Seems pretty likely based on comment 17 and 18. Also the problem reproduced with the JITs disabled, that makes it less likely to be a JS issue.
Status: NEW → RESOLVED
Closed: 10 years ago
Depends on: 927245
Flags: needinfo?(jdemooij)
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Component: JavaScript Engine → English Other
Keywords: regression
Product: Core → Tech Evangelism
Target Milestone: mozilla31 → ---
Assignee: general → english-other
Summary: Javascript engine throws nonexistent errors in a webpage. → App throws due to the usage of the removed Audio Data API
Kohei please read the posts before recategorizing this is not an issue with the page, it is an issue that occurs when the audio data api is re-enabled in about:config. The page does comply with standards.
Component: English Other → JavaScript Engine
Product: Tech Evangelism → Core
Summary: App throws due to the usage of the removed Audio Data API → Javascript engine throws nonexistent errors in a webpage (FIXED BY BUG 927245)
Severity: normal → trivial
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: