jsdom
Advanced tools
Comparing version 11.11.0 to 11.12.0
@@ -244,2 +244,3 @@ "use strict"; | ||
pretendToBeVisual: false, | ||
storageQuota: 5000000, | ||
@@ -318,2 +319,6 @@ // Defaults filled in later | ||
if (options.storageQuota !== undefined) { | ||
transformed.windowOptions.storageQuota = Number(options.storageQuota); | ||
} | ||
// concurrentNodeIterators?? | ||
@@ -320,0 +325,0 @@ |
@@ -26,2 +26,3 @@ "use strict"; | ||
const Screen = require("../living/generated/Screen"); | ||
const Storage = require("../living/generated/Storage"); | ||
const createAbortController = require("../living/generated/AbortController").createInterface; | ||
@@ -145,3 +146,38 @@ const createAbortSignal = require("../living/generated/AbortSignal").createInterface; | ||
this._pretendToBeVisual = options.pretendToBeVisual; | ||
this._storageQuota = options.storageQuota; | ||
// Some properties (such as localStorage and sessionStorage) share data | ||
// between windows in the same origin. This object is intended | ||
// to contain such data. | ||
if (options.commonForOrigin && options.commonForOrigin[this._document.origin]) { | ||
this._commonForOrigin = options.commonForOrigin; | ||
} else { | ||
this._commonForOrigin = { | ||
[this._document.origin]: { | ||
localStorageArea: new Map(), | ||
sessionStorageArea: new Map(), | ||
windowsInSameOrigin: [this] | ||
} | ||
}; | ||
} | ||
this._currentOriginData = this._commonForOrigin[this._document.origin]; | ||
///// WEB STORAGE | ||
this._localStorage = Storage.create([], { | ||
associatedWindow: this, | ||
storageArea: this._currentOriginData.localStorageArea, | ||
type: "localStorage", | ||
url: this._document.documentURI, | ||
storageQuota: this._storageQuota | ||
}); | ||
this._sessionStorage = Storage.create([], { | ||
associatedWindow: this, | ||
storageArea: this._currentOriginData.sessionStorageArea, | ||
type: "sessionStorage", | ||
url: this._document.documentURI, | ||
storageQuota: this._storageQuota | ||
}); | ||
///// GETTERS | ||
@@ -220,2 +256,16 @@ | ||
return screen; | ||
}, | ||
get localStorage() { | ||
if (this._document.origin === "null") { | ||
throw new DOMException("localStorage is not available for opaque origins", "SecurityError"); | ||
} | ||
return this._localStorage; | ||
}, | ||
get sessionStorage() { | ||
if (this._document.origin === "null") { | ||
throw new DOMException("sessionStorage is not available for opaque origins", "SecurityError"); | ||
} | ||
return this._sessionStorage; | ||
} | ||
@@ -222,0 +272,0 @@ }); |
@@ -400,2 +400,21 @@ "use strict"; | ||
Element.prototype.closest = function closest(selectors) { | ||
if (!this || !module.exports.is(this)) { | ||
throw new TypeError("Illegal invocation"); | ||
} | ||
if (arguments.length < 1) { | ||
throw new TypeError( | ||
"Failed to execute 'closest' on 'Element': 1 argument required, but only " + arguments.length + " present." | ||
); | ||
} | ||
const args = []; | ||
{ | ||
let curArg = arguments[0]; | ||
curArg = conversions["DOMString"](curArg, { context: "Failed to execute 'closest' on 'Element': parameter 1" }); | ||
args.push(curArg); | ||
} | ||
return utils.tryWrapperForImpl(this[impl].closest(...args)); | ||
}; | ||
Element.prototype.matches = function matches(selectors) { | ||
@@ -402,0 +421,0 @@ if (!this || !module.exports.is(this)) { |
@@ -17,3 +17,5 @@ "use strict"; | ||
LOGERRORS: false, | ||
VERBOSITY: false | ||
VERBOSITY: false, | ||
IDS_DUPES: true, | ||
MIXEDCASE: true | ||
}); | ||
@@ -36,3 +38,5 @@ } | ||
document._nwsapi.configure({ | ||
LOGERRORS: false | ||
LOGERRORS: false, | ||
IDS_DUPES: true, | ||
MIXEDCASE: true | ||
}); | ||
@@ -39,0 +43,0 @@ } |
@@ -41,2 +41,3 @@ "use strict"; | ||
exports.ProgressEvent = require("./generated/ProgressEvent").interface; | ||
exports.StorageEvent = require("./generated/StorageEvent").interface; | ||
exports.CompositionEvent = require("./generated/CompositionEvent").interface; | ||
@@ -66,2 +67,4 @@ exports.WheelEvent = require("./generated/WheelEvent").interface; | ||
exports.Storage = require("./generated/Storage").interface; | ||
require("./register-elements")(exports); | ||
@@ -68,0 +71,0 @@ |
@@ -411,2 +411,7 @@ "use strict"; | ||
} | ||
closest(selectors) { | ||
const matcher = addNwsapi(this); | ||
return matcher.closest(selectors, idlUtils.wrapperForImpl(this)); | ||
} | ||
} | ||
@@ -413,0 +418,0 @@ |
@@ -48,3 +48,4 @@ "use strict"; | ||
proxy: parentDoc._proxy, | ||
runScripts: parentDoc._defaultView._runScripts | ||
runScripts: parentDoc._defaultView._runScripts, | ||
commonForOrigin: parentDoc._defaultView._commonForOrigin | ||
}); | ||
@@ -61,2 +62,6 @@ const contentDoc = frame._contentDocument = idlUtils.implForWrapper(wnd._document); | ||
if (parentDoc.origin === contentDoc.origin) { | ||
contentWindow._currentOriginData.windowsInSameOrigin.push(contentWindow); | ||
} | ||
// Handle about:blank with a simulated load of an empty document. | ||
@@ -63,0 +68,0 @@ if (serializedURL === "about:blank") { |
@@ -147,3 +147,3 @@ "use strict"; | ||
{ | ||
bubbles: true, | ||
bubbles: false, | ||
state | ||
@@ -160,3 +160,3 @@ } | ||
{ | ||
bubbles: true, | ||
bubbles: false, | ||
oldURL: whatwgURL.serializeURL(oldURL), | ||
@@ -163,0 +163,0 @@ newURL: whatwgURL.serializeURL(newURL) |
@@ -129,2 +129,4 @@ "use strict"; | ||
options.storageQuota = options.storageQuota || 5000000; | ||
// List options explicitly to be clear which are passed through | ||
@@ -153,3 +155,4 @@ const window = new Window({ | ||
runScripts: options.runScripts, | ||
pretendToBeVisual: options.pretendToBeVisual | ||
pretendToBeVisual: options.pretendToBeVisual, | ||
storageQuota: options.storageQuota | ||
}); | ||
@@ -244,24 +247,29 @@ | ||
} else if (canReadFilesFromFS) { | ||
req = resourceLoader.readFile( | ||
config.somethingToAutodetect, | ||
{ defaultEncoding: config.defaultEncoding, detectMetaCharset: true }, | ||
(err, text, res) => { | ||
if (err) { | ||
if (err.code === "ENOENT" || err.code === "ENAMETOOLONG" || err.code === "ERR_INVALID_ARG_TYPE") { | ||
config.html = config.somethingToAutodetect; | ||
try { | ||
req = resourceLoader.readFile( | ||
config.somethingToAutodetect, | ||
{ defaultEncoding: config.defaultEncoding, detectMetaCharset: true }, | ||
(err, text, res) => { | ||
if (err) { | ||
if (err.code === "ENOENT" || err.code === "ENAMETOOLONG" || err.code === "ERR_INVALID_ARG_TYPE") { | ||
config.html = config.somethingToAutodetect; | ||
processHTML(config); | ||
} else { | ||
reportInitError(err, config); | ||
} | ||
} else { | ||
const contentType = new MIMEType(res.headers["content-type"]); | ||
config.encoding = contentType.parameters.get("charset"); | ||
setParsingModeFromExtension(config, config.somethingToAutodetect); | ||
config.html = text; | ||
config.url = toFileUrl(config.somethingToAutodetect); | ||
processHTML(config); | ||
} else { | ||
reportInitError(err, config); | ||
} | ||
} else { | ||
const contentType = new MIMEType(res.headers["content-type"]); | ||
config.encoding = contentType.parameters.get("charset"); | ||
setParsingModeFromExtension(config, config.somethingToAutodetect); | ||
config.html = text; | ||
config.url = toFileUrl(config.somethingToAutodetect); | ||
processHTML(config); | ||
} | ||
} | ||
); | ||
); | ||
} catch (err) { | ||
config.html = config.somethingToAutodetect; | ||
processHTML(config); | ||
} | ||
} else { | ||
@@ -268,0 +276,0 @@ config.html = config.somethingToAutodetect; |
{ | ||
"name": "jsdom", | ||
"version": "11.11.0", | ||
"version": "11.12.0", | ||
"description": "A JavaScript implementation of many web standards", | ||
@@ -22,21 +22,21 @@ "keywords": [ | ||
"dependencies": { | ||
"abab": "^1.0.4", | ||
"acorn": "^5.3.0", | ||
"abab": "^2.0.0", | ||
"acorn": "^5.5.3", | ||
"acorn-globals": "^4.1.0", | ||
"array-equal": "^1.0.0", | ||
"cssom": ">= 0.3.2 < 0.4.0", | ||
"cssstyle": ">= 0.3.1 < 0.4.0", | ||
"cssstyle": "^1.0.0", | ||
"data-urls": "^1.0.0", | ||
"domexception": "^1.0.0", | ||
"escodegen": "^1.9.0", | ||
"domexception": "^1.0.1", | ||
"escodegen": "^1.9.1", | ||
"html-encoding-sniffer": "^1.0.2", | ||
"left-pad": "^1.2.0", | ||
"nwsapi": "^2.0.0", | ||
"left-pad": "^1.3.0", | ||
"nwsapi": "^2.0.7", | ||
"parse5": "4.0.0", | ||
"pn": "^1.1.0", | ||
"request": "^2.83.0", | ||
"request": "^2.87.0", | ||
"request-promise-native": "^1.0.5", | ||
"sax": "^1.2.4", | ||
"symbol-tree": "^3.2.2", | ||
"tough-cookie": "^2.3.3", | ||
"tough-cookie": "^2.3.4", | ||
"w3c-hr-time": "^1.0.1", | ||
@@ -47,3 +47,3 @@ "webidl-conversions": "^4.0.2", | ||
"whatwg-url": "^6.4.1", | ||
"ws": "^4.0.0", | ||
"ws": "^5.2.0", | ||
"xml-name-validator": "^3.0.0" | ||
@@ -55,8 +55,8 @@ }, | ||
"chai": "^4.1.2", | ||
"eslint": "^4.16.0", | ||
"eslint-find-rules": "^3.1.1", | ||
"eslint-plugin-html": "^4.0.1", | ||
"js-yaml": "^3.10.0", | ||
"eslint": "^4.19.1", | ||
"eslint-find-rules": "^3.2.3", | ||
"eslint-plugin-html": "^4.0.3", | ||
"js-yaml": "^3.11.0", | ||
"karma": "^1.7.1", | ||
"karma-browserify": "^5.1.3", | ||
"karma-browserify": "^5.2.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
@@ -75,4 +75,4 @@ "karma-mocha": "^1.3.0", | ||
"st": "^1.2.2", | ||
"watchify": "^3.9.0", | ||
"wd": "^1.5.0", | ||
"watchify": "^3.11.0", | ||
"wd": "^1.7.0", | ||
"webidl2js": "^9.0.0" | ||
@@ -79,0 +79,0 @@ }, |
@@ -50,3 +50,4 @@ <h1 align="center"> | ||
userAgent: "Mellblomenator/9000", | ||
includeNodeLocations: true | ||
includeNodeLocations: true, | ||
storageQuota: 10000000 | ||
}); | ||
@@ -60,2 +61,3 @@ ``` | ||
- `includeNodeLocations` preserves the location info produced by the HTML parser, allowing you to retrieve it with the `nodeLocation()` method (described below). It also ensures that line numbers reported in exception stack traces for code running inside `<script>` elements are correct. It defaults to `false` to give the best performance, and cannot be used with an XML content type since our XML parser does not support location info. | ||
- `storageQuota` is the maximum size in code units for the separate storage areas used by `localStorage` and `sessionStorage`. Attempts to store data larger than this limit will cause a `DOMException` to be thrown. By default, it is set to 5,000,000 code units per origin, as inspired by the HTML specification. | ||
@@ -62,0 +64,0 @@ Note that both `url` and `referrer` are canonicalized before they're used, so e.g. if you pass in `"https:example.com"`, jsdom will interpret that as if you had given `"https://example.com/"`. If you pass an unparseable URL, the call will throw. (URLs are parsed and serialized according to the [URL Standard](http://url.spec.whatwg.org/).) |
Sorry, the diff of this file is too big to display
2049604
402
59415
482
+ Addedcssstyle@1.4.0(transitive)
+ Addedws@5.2.3(transitive)
- Removedabab@1.0.4(transitive)
- Removedcssstyle@0.3.1(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedws@4.1.0(transitive)
Updatedabab@^2.0.0
Updatedacorn@^5.5.3
Updatedcssstyle@^1.0.0
Updateddomexception@^1.0.1
Updatedescodegen@^1.9.1
Updatedleft-pad@^1.3.0
Updatednwsapi@^2.0.7
Updatedrequest@^2.87.0
Updatedtough-cookie@^2.3.4
Updatedws@^5.2.0