Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theseus and Jquery Throwing Errors on Live Preview #46

Open
pixelshaded opened this issue Dec 9, 2013 · 16 comments
Open

Theseus and Jquery Throwing Errors on Live Preview #46

pixelshaded opened this issue Dec 9, 2013 · 16 comments

Comments

@pixelshaded
Copy link

Sprint 34 experimental build 0.34.1-10733
Using bower installed jquery version 2.0.3.

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="scripts/bower_components/jquery/jquery.js"></script>
</head>
<body>

</body>
</html>

SyntaxError: Failed to execute query: '*,:x' is not a valid selector. (line 1482)
SyntaxError: Failed to execute query: '[s!='']:x' is not a valid selector. (line 1514)

It is happening in the assert functions in jquery that checks for browser support.

@alltom
Copy link
Member

alltom commented Dec 9, 2013

Do you know if the jQuery is minified?

@alltom
Copy link
Member

alltom commented Dec 9, 2013

When I try it with jQuery off the jQuery site, I get no exceptions just from loading jQuery, but I get 2 exceptions with minified jQuery:

[Error] TypeError: 'undefined' is not a function (near '...4-6267", vars: {} })(t))...') (j2.js, line 1650)
[Error] TypeError: 'undefined' is not a function (near '...4-2917", vars: {} })(o,[x]),x.fn.trigger...') (j2.js, line 1596)

Let's see where these are coming from...

@pixelshaded
Copy link
Author

It is not the minified version. Note that everything seems to run fine with theseus turned off. These errors arent getting thrown.

@pixelshaded
Copy link
Author

I downloaded the latest unmin'd version of jquery from their site at http://code.jquery.com/jquery-2.0.3.js and I'm still getting those errors.

@alltom
Copy link
Member

alltom commented Dec 9, 2013

That's weird. I'll see how closely I can recreate your setup.

@pixelshaded
Copy link
Author

Note that the extension downloaded by brackets is v.0.4.8 - 2013-09-03

@cthrax
Copy link

cthrax commented Jan 23, 2014

Was there any insight into this? I am also seeing this, though not with theseus, but other jquery plugins.

@alltom
Copy link
Member

alltom commented Jan 23, 2014

No, not yet, sorry. I think there was another report about jQuery 2 being broken but I haven't found the time to look into either yet.

It can be worked around by requesting jquery.js?theseus=no for the time being.

@cthrax
Copy link

cthrax commented Jan 23, 2014

No worries, thanks for the quick response!

@QuentinRoy
Copy link

Same problem here with the very last theseus version (0.4.13), very last bracket version (41) and very last unminified jquery version (2.1.1)..
Do you have new insights about this issue and where it comes from?
I cannot use the theseus=no trick as I'm using requirejs... :-/

@alltom
Copy link
Member

alltom commented Jul 31, 2014

Sorry. :\

If the problem is what I think it is, when fondue inserts the instrumentation code for Theseus, it unintentionally makes the JavaScript invalid. Before the initial release of Theseus, I spent several days just getting minified jQuery to work because it uses every trick it can to make the file as small as possible. It seems like they found a new trick for jQuery 2 that I haven't figured out.

If I'm correct, unminified jQuery ought to work, and inserting /*theseus instrument: false */ into jQuery somewhere ought to work.

I'm bumping this to the top of my todo list to look at today. :)

@alltom
Copy link
Member

alltom commented Aug 2, 2014

You all are getting the errors in Chrome, right?

@alltom
Copy link
Member

alltom commented Aug 2, 2014

All right, I can finally reproduce this!

@alltom
Copy link
Member

alltom commented Aug 2, 2014

It turns out that the exceptions are benign, if annoying. :)

jQuery's assert() returns false if the assertion throws an exception. However, Theseus logs all exceptions that cause a function to abort, even if they're caught somewhere else (such as in assert()). So even though the exceptions are part of the normal browser detection control flow, they show up in Theseus's events bar.

There are a couple of things that should be done:

  • Display caught exceptions differently from uncaught exceptions.
  • Show where caught exceptions were caught.

If you don't care what happens in jQuery, I recommend disabling Theseus for that file using one of the methods mentioned earlier (which also described here).

alltom added a commit to adobe-research/fondue that referenced this issue Aug 2, 2014
* report hits only for uncaught exceptions
* exceptions show up on all invocations from which they're thrown
* an exception log only shows uncaught exceptions

adobe-research/theseus#46
alltom added a commit to adobe-research/fondue that referenced this issue Aug 2, 2014
@alltom
Copy link
Member

alltom commented Aug 2, 2014

If an exception is caught, the stack will show where:

screen shot 2014-08-02 at 3 18 14 pm

If an exception is not caught, you can now see it propagate all the way up the stack:

screen shot 2014-08-02 at 3 18 58 pm

The log now only shows uncaught exceptions. However, the exception counter is now wrong because it's counting the number of invocations that exited with an exception instead of the number of times an exception made it all the way up the stack:

screen shot 2014-08-02 at 3 19 13 pm

alltom added a commit that referenced this issue Aug 2, 2014
Count the number of entries in an exceptions log query, instead of the exception hit count.

#46
@alltom
Copy link
Member

alltom commented Aug 2, 2014

With that commit to Theseus, I think this issue is resolved. Could someone (preferably everyone :) try this test build of Theseus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants