Skip to main content

Bug Tracker

Side navigation

#6690 closed enhancement (fixed)

Opened June 18, 2010 10:59AM UTC

Closed April 16, 2011 09:19PM UTC

Last modified March 09, 2012 06:26AM UTC

Store references to location and navigator objects

Reported by: jos3000 Owned by: john
Priority: low Milestone: 1.6
Component: core Version: 1.4.3
Keywords: sandbox Cc:
Blocked by: Blocking:
Description

I'm using jsdom to run jQuery on node.js

In the main example:

http://github.com/tmpvar/jsdom/blob/master/example/jquery/run.js

the variables 'window', 'document', 'navigator' and 'location' are defined in the scope before query is run. For neatness I tried to remove all but 'window' since jQuery starts by wrapping all the code in a closure with only 'window' as an argument.

It turns out that it still requires 'navigator' and 'location' to be defined.

Would it be possible to add:

var navigator = window.navigator, location = window.location; to the core so that the sandbox is complete? This is already done with 'document'.

I know this should work, but wonder if there is a browser compatibility reason that this would break.

Attachments (0)
Change History (3)

Changed October 31, 2010 06:48PM UTC by snover comment:1

milestone: 1.4.31.5
priority: → low
status: newopen
summary: Sandbox leaksStore references to location and navigator objects
version: 1.4.21.4.3

This could also provide a small perf & filesize boost.

Changed April 16, 2011 09:19PM UTC by john comment:2

milestone: → 1.6
owner: → john
status: openassigned

Changed April 16, 2011 09:19PM UTC by John Resig comment:3

resolution: → fixed
status: assignedclosed

Cache references to navigator and location. Fixes #6690.

Changeset: 94ee3e9743c2cab24084ae24e02871f6df4aef13