Skip to content
This repository has been archived by the owner on Dec 9, 2017. It is now read-only.

XMLHttpRequest is not a function under JavaScriptCore / Safari #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

msridhar
Copy link
Contributor

Currently, record-replay of jQuery 2.0.2 works fine on Chrome, but not in PhantomJS. The issue in PhantomJS is that for Safari's Webkit (JavaScriptCore), typeof XMLHttpRequest (and various other native functions) is object rather than function. (This behavior remains even for the most recent version of Safari.) This leads to replay errors for scripts like:

var xhrSupported = new XMLHttpRequest();

During replay, we get the error:

/Users/m.sridharan/git-repos/jalangi/src/js/analysis.js:703
                throw tmp;
                      ^
TypeError: object is not a function
    at callAsNativeConstructor (/Users/m.sridharan/git-repos/jalangi/src/js/analysis.js:441:24)
    at callAsConstructor (/Users/m.sridharan/git-repos/jalangi/src/js/analysis.js:463:27)
    at invokeFun (/Users/m.sridharan/git-repos/jalangi/src/js/analysis.js:525:31)
    at /Users/m.sridharan/git-repos/jalangi/src/js/analysis.js:618:24
    at Object.<anonymous> (/private/tmp/foo2_jalangi_.js:13:257)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

The code change attached to this pull request "fixes" the problem, by special-casing the function test for XMLHttpRequest. But, it's a total hack. Unfortunately, I can't think of a more general way to detect and address this issue.

Is there a better way to fix this problem?

@msridhar
Copy link
Contributor Author

msridhar commented Jan 2, 2014

Updated the pull request title to reflect the underlying issue with JavaScriptCore. This one is lower priority for the moment since we mostly gave up on PhantomJS, but it may bite us again in the future.

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

Successfully merging this pull request may close these issues.

1 participant