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

Commit

Permalink
upgrading jsdom to 11.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vladgurgov committed Aug 8, 2018
1 parent 5245de7 commit 4b0fce8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"debug": "^3.1.0",
"eventsource": "^1.0.5",
"iconv-lite": "^0.4.21",
"jsdom": "11.5.1",
"jsdom": "11.12.0",
"lodash": "^4.17.10",
"mime": "^2.3.1",
"ms": "^2.1.1",
Expand Down
7 changes: 6 additions & 1 deletion src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ function setupWindow(window, args) {
window.MouseEvent = DOM.MouseEvent;
window.MutationEvent = DOM.MutationEvent;
window.UIEvent = DOM.UIEvent;
window.screen = new Screen();
const screen = new Screen();
Object.defineProperty(window, 'screen',{
get(){
return screen;
}
});

// for inline event handlers
window._globalProxy.Function = Function;
Expand Down
7 changes: 7 additions & 0 deletions src/dom/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ Object.defineProperty(HTMLScriptElementImpl, 'init', {
}

}
obj._poppedOffStackOfOpenElements = function(){
//not being used, causing double js execution
}
}
});


function _eval(text, filename) {
if (this._alreadyStarted)
return;

this._alreadyStarted = true;
const typeString = this._getTypeString();
const _defaultView = this._ownerDocument._defaultView;
if (_defaultView && _defaultView._runScripts === 'dangerously' && jsMIMETypes.has(typeString.toLowerCase())) {
Expand Down
8 changes: 3 additions & 5 deletions src/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,12 @@ class XMLHttpRequest {
// CORS request, check origin, may lead to new error
if (this._cors) {
const allowedOrigin = response.headers.get('Access-Control-Allow-Origin');
if (!(allowedOrigin === '*' || allowedOrigin === this._cors)) {
this._error = new DOMException(DOMException.SECURITY_ERR, 'Cannot make request to different domain');
}
if (!(allowedOrigin === '*' || allowedOrigin === this._cors))
this._error = new DOMException(DOMException.SECURITY_ERR, 'Cannot make request to different domain')
else if (!/^(GET|HEAD|POST)$/.test(this._method)) {
const allowedMethods = response.headers.get('Access-Control-Allow-Methods');
if (!allowedMethods || allowedMethods.indexOf(request.method) == -1) {
if (!allowedMethods || allowedMethods.indexOf(request.method) == -1)
this._error = new DOMException(DOMException.SECURITY_ERR, 'Cannot make request with not-allowed method('+this._method+')');
}
}
if (this._error) {
this._browser.errors.push(this._error);
Expand Down

0 comments on commit 4b0fce8

Please sign in to comment.