Skip to main content

Bug Tracker

Side navigation

#6796 closed bug (fixed)

Opened July 17, 2010 06:16PM UTC

Closed October 17, 2010 07:31PM UTC

Last modified March 13, 2012 11:09PM UTC

Error 'script stack space quota is exhausted' when parsing 3MB XML file on Firefox

Reported by: petewarden Owned by: petewarden
Priority: undecided Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: xml firefox Cc:
Blocked by: Blocking:

I'm running into 'script stack space quota is exhausted' when loading a 3.4MB XML file using JQuery, and have created a minimal example that reproduces the problem at

Steps to Reproduce:

1 - Open in Firefox

2 - After a few seconds check the error console

Actual Results:

The code fails with the message

Error: script stack space quota is exhausted

Source File:

Line: 21

Expected Results:

The XML file should be loaded and parsed

The same page runs with no problems in Safari 5.0 and Chrome 6.0.

My full Firefox version is

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20100625 Firefox/3.6.6

You can download a zip of the source files at

I've filed the following bug with the Firefox team since there's no problem when running on other platforms, but since it's JQuery code that's causing the error I'm filing one here too, in case there's a fix I could use in the framework, rather than waiting for a Mozilla patch.

Attachments (0)
Change History (10)

Changed July 17, 2010 06:38PM UTC by petewarden comment:1

I've just tried it on IE 8, and the test page runs successfully, if slowly, so it appears to be a Firefox-specific issue.

Changed July 21, 2010 02:30AM UTC by dmethvin comment:2

component: unfiledcore

It looks like you're trying to parse an XML string with

and that's not supported. Only HTML strings can be passed. If I've interpreted the test case incorrectly, reply with an explanation of what's going on.

Firefox seems to be dying on the constructor check for HTML, which uses a RegExp:

match = quickExpr.exec( selector );

The string you're passing in is long and html-ish, and I suspect Firefox is backtracking heavily trying to match the huge string. We can either assume a long (>1K chars) string must be HTML or come up with a RegExp that doesn't need to backtrack so much.

Changed July 24, 2010 07:07PM UTC by petewarden comment:3

Should I move this to the documentation component then? It looks like I'm not the only one who mistakenly thinks XML parsing is supported, see these tutorials listed on the main JQuery site at

The only documentation I can find by doing a Google query of ' xml parsing not supported' is this forum thread mentioning it at the end.

Changed September 23, 2010 09:22PM UTC by ridgerunner comment:4

This bug may now be fixed. The recent Regex improvements (see #7062) included a change to the quickExpr regex which dramatically reduced the backtracking it required for the case of non-matches.

Changed September 27, 2010 10:44AM UTC by uwgandalf comment:5

I checked out the newest version from git, and I still have the same problems as the TS.

@ridgerunner: Were the changes committed to git, or were you talking about a non-git patch to reduce the backtracking?

Changed October 14, 2010 03:13AM UTC by addyosmani comment:6

priority: → undecided

Can anyone confirm for sure whether this issue is still being experienced using the new 1.4.3 RC2?

Changed October 15, 2010 10:16PM UTC by snover comment:7

owner: → petewarden
status: newpending

Please confirm whether or not this issue still occurs with jQuery 1.4.3. Thank you!

Changed October 17, 2010 06:59PM UTC by petewarden comment:8

status: pendingnew

I've confirmed that the problem doesn't occur with 1.4.3, so this bug can be closed

Changed October 17, 2010 07:31PM UTC by snover comment:9

resolution: → fixed
status: newclosed

Changed January 06, 2011 12:54PM UTC by comment:10

The low limit still exists in Firefox. Given this, I think dmethvin's suggestion to assume anything over 1K is HTML is reasonable.

In my case, I'm using the jstree plugin which is taking a rather large XML document and using XSLT to turn it to a string containing an HTML nested list, which it then passes to jQuery's constructor to create DOM objects. I get the "stack quota" error in the same RegExp call mentioned in this ticket.

To reproduce, open with Firefox (in my case 3.6.13) with Firebug enabled. The script simply dynamically creates a large string containing the html for an unordered list. I've tweaked the len variable to be right over the edge of Firefox's limit. Set len to 71859 and the script will work.

In Chrome, I was able to set len to several hundred thousand before I started having issues.