#12357 closed bug (fixed)
jQuery 1.8.0 Not parseable by XUL Runner Applications
Reported by: | Owned by: | gibson042 | |
---|---|---|---|
Priority: | low | Milestone: | 1.8.3 |
Component: | support | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery 1.8.0 usage of <tag> and other unescaped "<" character combinations has resulted in the inability for XUL Runner Applications to parse the jQuery core code and insert it into the dom.
up until jQuery 1.7.2 XUL Runner Apps were able to parse the javascript normally.
You can test this by setting up a simple xul runner window and including jQuery, then alert the typeof jQuery or $ which will result in a response of undefined.
If you paste the jQuery code into a script tag in the XUL main window, you will be able to see all the various parsing issues that have been released in this build.
Change History (27)
comment:1 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 10 years ago by
Resolution: | → duplicate |
---|---|
Status: | pending → closed |
comment:3 Changed 10 years ago by
This is not a duplicate the issue is completely different than #12359 also this issue does stop execution. I am compiling package of screen shots for you along with a compiled xul app which will pull in an external jQuery file for debugging.
comment:4 Changed 10 years ago by
I think it may have the same root cause, which is that our use of .innerHTML
in several places is not valid XHTML at the moment. Which lines are causing trouble?
Also see #10198 where we are trying to figure out a way to test this to prevent future regressions. Maybe your app could be used in our test suite if we can figure a way to integrate it.
comment:5 Changed 10 years ago by
Starts with this line
Parsing Error: Location: chrome://myapp/content/main.xul
Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
once removed it moves on to :
Parsing Error: not well-formed Location: chrome://myapp/content/main.xul rquickExpr = /(?:[#<]*(<[\w\W]+>)[>]*$|#([\w\-]*)$)/,
once updated to = moves on to :
Parsing Error: not well-formed Location: chrome://myapp/content/main.xul rsingleTag = /<(\w+)\s*\/?>(?:<\/\1>|)$/,
once updated to = moves on to :
Parsing Error: not well-formed Location: chrome://myapp/content/main.xul if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
The common issue seems to be the tag open close chars, however this was not an issue in 1.7.2
comment:6 Changed 10 years ago by
here is a version of what I am working with, sorry, it is built for windows right now.
http://uploadbin.net/502d8a88ebc311e1baaad1d1a5c7f576/Digi+Now+Jukebox.rar
the main.xul exsists in the chrome/content/ dir
comment:7 Changed 10 years ago by
@brandon, can you try your code with http://code.jquery.com/jquery-git.js and let us know if the problem has been fixed? Thanks!
comment:8 Changed 10 years ago by
No, still the same issue, I believe it has something to do with the use of the open and close tag character. Has this changed since 1.7.2?
Specifically in the comments in areas like "<tag>" and or in regex's like /[<|>]/
comment:9 Changed 10 years ago by
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
Oh I see comment 5 now and agree it's not a dup. This seems like XUL Runner is totally wrong. Why is it trying to parse comments and RegExp in the Javascript source? Many of those were in 1.7.2 as well.
comment:10 Changed 10 years ago by
Status: | reopened → pending |
---|
I'm looking at that main.xul file and it looks incorrect. Shouldn't real XML have CDATA wrapping the script?
<window id="main" title="DigiNow Jukebox" width="900" height="700" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> /*! * jQuery JavaScript Library v1.8.0 * http://jquery.com/ ... etc ...
comment:11 Changed 10 years ago by
Status: | pending → new |
---|
CDATA still does not fix the issue :(, even if it did it would mean private hosting of CDATA wrapped jQuery would have been needed not public CDN hosted.
Notice here with a script include, you can not use CDATA, however, this is jQuery 1.7.2 and you will get to the alert($);
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="DigiNow Jukebox" width="900" height="700" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> alert(1); </script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script> alert($); </script> </window>
on the other hand :
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="DigiNow Jukebox" width="900" height="700" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> alert(1); </script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> alert($); </script> </window>
loading in the newest version, or specifying 1.8.0 you will cause a fatal error.
SUPER INTERESTINGLY ENOUGH I did wrap in 1.8 in CDATA and added an error handler
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="DigiNow Jukebox" width="900" height="700" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> window.onerror=function(e){ alert(e) } alert(1); </script> <script> <![CDATA[ /*! jQuery [email protected] jquery.com | jquery.org/license */ blah blah blah jquery mumbo jumbo magic stuff here .... ]]> </script> <script> alert($); </script> </window>
and I got the error : d is not defined followed by the expected $ is not defined since jQuery failed to initialize.
comment:12 Changed 10 years ago by
Status: | new → pending |
---|
It seems like there are multiple confusing things here.
Your example file in the .rar had jquery source dumped into the XML. That would seem to require a CDATA wrapper to work. If you can use script tags please do that so we can eliminate that variable.
If you take your XUL app that includes jquery-1.7.2 via a script tag, and edit that script tag to use jquery-git instead, does it work? If not, what is the error message you receive?
comment:13 Changed 10 years ago by
Status: | pending → new |
---|
using the following example is the only way to get to the root of the issue, if you update your main.xul and then run the .exe in the root of that folder structure, you will also be able to see the errors :
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="DigiNow Jukebox" width="900" height="700" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> window.onerror=function(e){ alert(e) } </script> <script> <![CDATA[ /*! jQuery [email protected] you want jquery.com | jquery.org/license */ blah blah blah jquery mumbo jumbo magic stuff here .... ]]> </script> <script> alert($); </script> </window>
Using the jQuery-git I still get the d is undefined
comment:14 Changed 10 years ago by
Status: | new → pending |
---|
Include the script by reference as I requested, not by copy-pasta. Does that work?
comment:15 Changed 10 years ago by
Status: | pending → new |
---|
No. It fails silently. As stated, the above method will be the way to debug this. The error is that d is undefined.
comment:16 follow-up: 20 Changed 10 years ago by
the jquery-git provides the error a is undefined now
comment:17 Changed 10 years ago by
Status: | new → pending |
---|
Can you use an unminified copy of the source and provide us with the line number and text of the error?
comment:18 Changed 10 years ago by
Status: | pending → new |
---|
That is what I have been doing. I unfortunately do not know the line number. As I debug the code and declare the various variables, the error trail moves onto the next variable. It seems there is either a scoping issue which does not conform to strict javascript rules, or not all variables are declared according to strict javascript rules.
I have provided a link of everything needed to do so on a windows machine here:
http://uploadbin.net/502d8a88ebc311e1baaad1d1a5c7f576/Digi+Now+Jukebox.rar
once installed, in the folder structure you will find chrome/main.xul
you can modify it like this to have a start to begin debugging from.
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="DigiNow Jukebox" width="900" height="700" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> window.onerror=function(e){ alert(e) } </script> <script> <![CDATA[ /*! jQuery [email protected] you want jquery.com | jquery.org/license */ non minified jQuery here ]]> </script> <script> alert($); </script> </window>
comment:19 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | new → closed |
Sorry, we are just not getting any other reports so I have to think this is an issue with the way you're building your application. We're not experts on that and don't have the time to become experts on it. Find an expert on a forum somewhere, ask them what is going on, and report back if there are any things that jQuery can do to help.
comment:20 Changed 10 years ago by
Replying to [email protected]…:
the jquery-git provides the error a is undefined now
a is undefined because of --
1) https://github.com/jquery/jquery/commit/dc83072878ed9636c8158a014bd9fa4acc1ccce3
2) [Tangentially] https://github.com/jquery/jquery/commit/c79a533ffd3e063a498fde6bdb1b934c7b4b47ab
Something like the following in support.js might avoid that error --
// Preliminary tests div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; // Can't get basic test support if ( !all || !all.length || !a) { return {}; } a.style.cssText = "top:1px;float:left;opacity:.5";
Not sure what it would do for any other errors.
comment:21 Changed 10 years ago by
Component: | unfiled → support |
---|---|
Milestone: | None → 1.next |
Resolution: | notabug |
Status: | closed → reopened |
Thanks for the sleuthing!
comment:22 Changed 10 years ago by
Owner: | changed from [email protected]… to gibson042 |
---|---|
Status: | reopened → assigned |
comment:23 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fix #12357: be more kind to non-browser environments. Close gh-938.
Changeset: 22fac5c2e40b00911933040afaf9adcdd2c00ac2
comment:24 Changed 10 years ago by
Milestone: | 1.next → 1.8.3 |
---|
comment:25 Changed 10 years ago by
Priority: | undecided → low |
---|
comment:26 Changed 10 years ago by
@pint.glass, can you test with jquery-git and see if this problem is resolved?
Can you provide an example of what you're talking about? We're kind of busy here at jQuery Central and https://www.google.com/search?q=setting+up+a+simple+xul+runner+window doesn't seem like a five-minute job.