You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following basic Mocha test case that runs via Karma:
it.only("shouldn't fail when logging a DOM Document object",function(){varparser=newDOMParser();vardoc=parser.parseFromString("<test></test>","application/xml");console.log(doc);//Causes the test to fail});
Running the test under PhantomJS triggers a test failure with the following error:
PhantomJS 1.9.7 (Mac OS X) shouldn't fail when logging a DOM Document object FAILED
Error: SECURITY_ERR: DOM Exception 18
at stringify (http://localhost:9876/karma.js:327)
at stringify (http://localhost:9876/karma.js:327)
at stringify (http://localhost:9876/karma.js:327)
at http://localhost:9876/karma.js:107
at http://localhost:9876/karma.js:85
...
A similar but more informative error appears when running the same test in Chrome:
Chrome 35.0.1916 (Mac OS X 10.9.3) shouldn't fail when logging a DOM Document object FAILED
Error: Failed to read the 'cookie' property from 'Document': Access is denied for this document.
at Error (native)
at stringify (http://localhost:9876/karma.js:327:47)
at log (http://localhost:9876/karma.js:107:24)
at Console.localConsole.(anonymous function) [as log] (http://localhost:9876/karma.js:85:16)
...
I wouldn't expect doing a console.log() to cause a test failure, but it looks like Karma's internal stringify() function accesses the Document object's cookie property which the browsers don't allow, and hence causes the browsers to throw exceptions which then fail the test.
Is this correct behavior? Should Karma's stringify() function handle this better? Manually running the same code in Chrome's console shows an exception for cookie property alone but still shows the other properties in the object.
(Note: The test code as presented here was simplified, but I ran into this issue by trying to log a backone.js model that referenced a DOM Document object internally.)
The text was updated successfully, but these errors were encountered:
jmandel
added a commit
to FHIR/fhir.js
that referenced
this issue
Aug 29, 2014
I have the following basic Mocha test case that runs via Karma:
Running the test under PhantomJS triggers a test failure with the following error:
A similar but more informative error appears when running the same test in Chrome:
I wouldn't expect doing a
console.log()
to cause a test failure, but it looks like Karma's internalstringify()
function accesses the Document object'scookie
property which the browsers don't allow, and hence causes the browsers to throw exceptions which then fail the test.Is this correct behavior? Should Karma's
stringify()
function handle this better? Manually running the same code in Chrome's console shows an exception forcookie
property alone but still shows the other properties in the object.(Note: The test code as presented here was simplified, but I ran into this issue by trying to log a backone.js model that referenced a DOM Document object internally.)
The text was updated successfully, but these errors were encountered: