Browse Source

Update window to version 4.2.6 (#75)

* Require window@4.2.6

* Set global properties as getters

Some properties will throw an error when accessed in certain conditions. We don't want to throw these errors, by accessing them when we setup the environemnt. Instead we should create getters for all window properties so they can throw the appropriate errors when accessed by user code.

* Update expectedProperties.json for window@4.2.6
greenkeeper/ava-1.3.0
Luke Childs 6 years ago
committed by GitHub
parent
commit
ffb7083cb2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package.json
  2. 5
      src/index.js
  3. 108
      test/fixtures/expectedProperties.json

2
package.json

@ -35,7 +35,7 @@
},
"homepage": "https://github.com/lukechilds/browser-env#readme",
"dependencies": {
"window": "4.2.5"
"window": "4.2.6"
},
"devDependencies": {
"ava": "^0.25.0",

5
src/index.js

@ -38,7 +38,10 @@ const browserEnv = function () {
// Copy what's left to the Node.js global scope
.forEach(prop => {
global[prop] = window[prop];
Object.defineProperty(global, prop, {
configurable: true,
get: () => window[prop]
});
});
// Return reference to original window object

108
test/fixtures/expectedProperties.json

@ -93,6 +93,7 @@
"HTMLQuoteElement",
"HTMLScriptElement",
"HTMLSelectElement",
"HTMLSlotElement",
"HTMLSourceElement",
"HTMLSpanElement",
"HTMLStyleElement",
@ -113,6 +114,7 @@
"HashChangeEvent",
"History",
"Image",
"InputEvent",
"Int16Array",
"Int32Array",
"Int8Array",
@ -120,7 +122,11 @@
"Location",
"MediaList",
"MessageEvent",
"MimeType",
"MimeTypeArray",
"MouseEvent",
"MutationObserver",
"MutationRecord",
"NamedNodeMap",
"Node",
"NodeFilter",
@ -128,6 +134,8 @@
"NodeList",
"Option",
"Performance",
"Plugin",
"PluginArray",
"PopStateEvent",
"ProcessingInstruction",
"ProgressEvent",
@ -137,7 +145,11 @@
"SVGNumber",
"SVGSVGElement",
"SVGStringList",
"SVGTitleElement",
"Screen",
"ShadowRoot",
"Storage",
"StorageEvent",
"StyleSheet",
"StyleSheetList",
"Text",
@ -150,6 +162,7 @@
"Uint32Array",
"Uint8Array",
"Uint8ClampedArray",
"ValidityState",
"WebSocket",
"WheelEvent",
"Window",
@ -157,21 +170,34 @@
"XMLHttpRequest",
"XMLHttpRequestEventTarget",
"XMLHttpRequestUpload",
"XMLSerializer",
"XPathEvaluator",
"XPathException",
"XPathExpression",
"XPathResult",
"__stopAllTimers",
"_commonForOrigin",
"_currentOriginData",
"_document",
"_eventHandlers",
"_frameElement",
"_getEventHandlerFor",
"_getEventHandlerTarget",
"_globalEventChanged",
"_globalProxy",
"_initGlobalEvents",
"_length",
"_localStorage",
"_parent",
"_pretendToBeVisual",
"_proxyWindowEventsToWindow",
"_registeredHandlers",
"_resourceLoader",
"_runScripts",
"_sessionHistory",
"_sessionStorage",
"_setEventHandlerFor",
"_storageQuota",
"_top",
"_virtualConsole",
"addEventListener",
@ -197,6 +223,7 @@
"innerHeight",
"innerWidth",
"length",
"localStorage",
"location",
"locationbar",
"menubar",
@ -204,6 +231,85 @@
"moveTo",
"name",
"navigator",
"onabort",
"onafterprint",
"onautocomplete",
"onautocompleteerror",
"onbeforeprint",
"onbeforeunload",
"onblur",
"oncancel",
"oncanplay",
"oncanplaythrough",
"onchange",
"onclick",
"onclose",
"oncontextmenu",
"oncuechange",
"ondblclick",
"ondrag",
"ondragend",
"ondragenter",
"ondragexit",
"ondragleave",
"ondragover",
"ondragstart",
"ondrop",
"ondurationchange",
"onemptied",
"onended",
"onerror",
"onfocus",
"onhashchange",
"oninput",
"oninvalid",
"onkeydown",
"onkeypress",
"onkeyup",
"onlanguagechange",
"onload",
"onloadeddata",
"onloadedmetadata",
"onloadstart",
"onmessage",
"onmessageerror",
"onmousedown",
"onmouseenter",
"onmouseleave",
"onmousemove",
"onmouseout",
"onmouseover",
"onmouseup",
"onoffline",
"ononline",
"onpagehide",
"onpageshow",
"onpause",
"onplay",
"onplaying",
"onpopstate",
"onprogress",
"onratechange",
"onrejectionhandled",
"onreset",
"onresize",
"onscroll",
"onsecuritypolicyviolation",
"onseeked",
"onseeking",
"onselect",
"onsort",
"onstalled",
"onstorage",
"onsubmit",
"onsuspend",
"ontimeupdate",
"ontoggle",
"onunhandledrejection",
"onunload",
"onvolumechange",
"onwaiting",
"onwheel",
"open",
"outerHeight",
"outerWidth",
@ -231,8 +337,10 @@
"scrollY",
"scrollbars",
"self",
"sessionStorage",
"setInterval",
"setTimeout",
"status",
"statusbar",
"stop",
"toolbar",

Loading…
Cancel
Save