Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@locker/shared-dom

Package Overview
Dependencies
Maintainers
6
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@locker/shared-dom - npm Package Compare versions

Comparing version 0.12.13 to 0.12.14

types/SVGElement.d.ts

48

dist/index.cjs.js

@@ -95,3 +95,3 @@ /**

const datasetGetterUtil = shared.unapply(shared.ObjectLookupOwnGetter(HTMLElement.prototype, 'dataset'));
const HTMLElementDatasetGetter = shared.ObjectLookupOwnGetter(HTMLElement.prototype, 'dataset');
const HTMLElementStyleGetterUtil = shared.unapply(shared.ObjectLookupOwnGetter(HTMLElement.prototype, 'style'));

@@ -132,2 +132,4 @@

const SVGElementDatasetGetter = shared.ObjectLookupOwnGetter(SVGElement.prototype, 'dataset');
const { createObjectURL: URLCreateObjectURL, revokeObjectURL: URLRevokeObjectURL } = URL;

@@ -140,7 +142,9 @@

}
const allowlist = ['close', 'closed', 'focus', 'postMessage', 'opener', 'parent'];
const allowListRaw = ['close', 'closed', 'focus', 'postMessage'];
const allowlistPatched = ['opener', 'parent'];
const patchedWindowMap = new shared.WeakMapCtor();
const createPatchedWindow = (rawWindow) => {
const patchedWindow = {};
for (let i = 0; i < allowlist.length; i += 1) {
const key = allowlist[i];
for (let i = 0; i < allowListRaw.length; i += 1) {
const key = allowListRaw[i];
const originalDescriptor = shared.ReflectGetOwnPropertyDescriptor(rawWindow, key);

@@ -163,2 +167,29 @@ if (originalDescriptor) {

}
for (let i = 0; i < allowlistPatched.length; i += 1) {
const key = allowlistPatched[i];
const patchedDescriptor = shared.ObjectCreate(null);
const originalDescriptor = shared.ReflectGetOwnPropertyDescriptor(rawWindow, key);
if (originalDescriptor) {
const originalDescriptorGetter = originalDescriptor.get;
if (typeof originalDescriptorGetter === 'function') {
patchedDescriptor.get = function get() {
const rawWindowParent = shared.ReflectApply(originalDescriptorGetter, rawWindow, shared.emptyArray);
let patchedWindow = shared.WeakMapGet(patchedWindowMap, rawWindowParent);
if (patchedWindow) {
return patchedWindow;
}
patchedWindow = createPatchedWindow(rawWindowParent);
shared.WeakMapSet(patchedWindowMap, patchedWindow);
return patchedWindow;
};
}
const originalDescriptorSetter = originalDescriptor.set;
if (typeof originalDescriptorSetter === 'function') {
patchedDescriptor.set = function set() {
return shared.ReflectApply(originalDescriptorSetter, rawWindow, shared.emptyArray);
};
}
}
shared.ReflectDefineProperty(patchedWindow, key, patchedDescriptor);
}
return patchedWindow;

@@ -168,3 +199,3 @@ };

// prototype https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
const { fetch: WindowFetch, open: WindowOpen } = window;
const { encodeURIComponent: WindowEncodeURIComponent, fetch: WindowFetch, open: WindowOpen, } = window;
const WindowSetIntervalUtil = shared.unapply(window.setInterval);

@@ -233,2 +264,3 @@ const WindowClearIntervalUtil = shared.unapply(window.clearInterval);

exports.HTMLAnchorElementHrefSetterUtil = HTMLAnchorElementHrefSetterUtil;
exports.HTMLElementDatasetGetter = HTMLElementDatasetGetter;
exports.HTMLElementStyleGetterUtil = HTMLElementStyleGetterUtil;

@@ -249,2 +281,3 @@ exports.HTMLFrameElementContentWindowGetterUtil = HTMLFrameElementContentWindowGetterUtil;

exports.RangeCreateContextualFragmentUtil = RangeCreateContextualFragmentUtil;
exports.SVGElementDatasetGetter = SVGElementDatasetGetter;
exports.StorageGetItem = StorageGetItem;

@@ -261,2 +294,3 @@ exports.StorageGetItemUtil = StorageGetItemUtil;

exports.WindowClearIntervalUtil = WindowClearIntervalUtil;
exports.WindowEncodeURIComponent = WindowEncodeURIComponent;
exports.WindowFetch = WindowFetch;

@@ -278,6 +312,6 @@ exports.WindowFetchUtil = WindowFetchUtil;

exports.createPatchedWindow = createPatchedWindow;
exports.datasetGetterUtil = datasetGetterUtil;
exports.isEqualDomString = isEqualDomString;
exports.isSharedElement = isSharedElement;
exports.patchedWindowMap = patchedWindowMap;
exports.requestURLGetterUtil = requestURLGetterUtil;
/** version: 0.12.13 */
/** version: 0.12.14 */
/**
* Copyright (C) 2019 salesforce.com, inc.
*/
import { unapply, ObjectLookupOwnGetter, ReflectGetOwnPropertyDescriptor, ObjectLookupOwnSetter, ReflectSetPrototypeOf, ReflectDefineProperty, FunctionBind, ReflectApply, emptyArray } from '@locker/shared';
import { unapply, ObjectLookupOwnGetter, ReflectGetOwnPropertyDescriptor, ObjectLookupOwnSetter, WeakMapCtor, ReflectSetPrototypeOf, ReflectDefineProperty, ObjectCreate, ReflectApply, emptyArray, WeakMapGet, WeakMapSet, FunctionBind } from '@locker/shared';

@@ -91,3 +91,3 @@ const DocumentCreateElement = unapply(Document.prototype.createElement);

const datasetGetterUtil = unapply(ObjectLookupOwnGetter(HTMLElement.prototype, 'dataset'));
const HTMLElementDatasetGetter = ObjectLookupOwnGetter(HTMLElement.prototype, 'dataset');
const HTMLElementStyleGetterUtil = unapply(ObjectLookupOwnGetter(HTMLElement.prototype, 'style'));

@@ -128,2 +128,4 @@

const SVGElementDatasetGetter = ObjectLookupOwnGetter(SVGElement.prototype, 'dataset');
const { createObjectURL: URLCreateObjectURL, revokeObjectURL: URLRevokeObjectURL } = URL;

@@ -136,7 +138,9 @@

}
const allowlist = ['close', 'closed', 'focus', 'postMessage', 'opener', 'parent'];
const allowListRaw = ['close', 'closed', 'focus', 'postMessage'];
const allowlistPatched = ['opener', 'parent'];
const patchedWindowMap = new WeakMapCtor();
const createPatchedWindow = (rawWindow) => {
const patchedWindow = {};
for (let i = 0; i < allowlist.length; i += 1) {
const key = allowlist[i];
for (let i = 0; i < allowListRaw.length; i += 1) {
const key = allowListRaw[i];
const originalDescriptor = ReflectGetOwnPropertyDescriptor(rawWindow, key);

@@ -159,2 +163,29 @@ if (originalDescriptor) {

}
for (let i = 0; i < allowlistPatched.length; i += 1) {
const key = allowlistPatched[i];
const patchedDescriptor = ObjectCreate(null);
const originalDescriptor = ReflectGetOwnPropertyDescriptor(rawWindow, key);
if (originalDescriptor) {
const originalDescriptorGetter = originalDescriptor.get;
if (typeof originalDescriptorGetter === 'function') {
patchedDescriptor.get = function get() {
const rawWindowParent = ReflectApply(originalDescriptorGetter, rawWindow, emptyArray);
let patchedWindow = WeakMapGet(patchedWindowMap, rawWindowParent);
if (patchedWindow) {
return patchedWindow;
}
patchedWindow = createPatchedWindow(rawWindowParent);
WeakMapSet(patchedWindowMap, patchedWindow);
return patchedWindow;
};
}
const originalDescriptorSetter = originalDescriptor.set;
if (typeof originalDescriptorSetter === 'function') {
patchedDescriptor.set = function set() {
return ReflectApply(originalDescriptorSetter, rawWindow, emptyArray);
};
}
}
ReflectDefineProperty(patchedWindow, key, patchedDescriptor);
}
return patchedWindow;

@@ -164,3 +195,3 @@ };

// prototype https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
const { fetch: WindowFetch, open: WindowOpen } = window;
const { encodeURIComponent: WindowEncodeURIComponent, fetch: WindowFetch, open: WindowOpen, } = window;
const WindowSetIntervalUtil = unapply(window.setInterval);

@@ -182,3 +213,3 @@ const WindowClearIntervalUtil = unapply(window.clearInterval);

export { AttrNameGetter, AttrNameGetterUtil, AttrNamespaceURIGetter, AttrNamespaceURIGetterUtil, AttrOwnerElementGetter, AttrOwnerElementGetterUtil, AttrValueGetter, AttrValueGetterUtil, AttrValueSetter, AttrValueSetterUtil, BlobCtor, BlobSizeGetterUtil, BlobSliceValueUtil, BlobTypeGetterUtil, CustomElementRegistryDefineValue, CustomElementRegistryGet, DocumentBodyGetter, DocumentBodyGetterUtil, DocumentCookieGetterUtil, DocumentCookieSetterUtil, DocumentCreateElement, DocumentExecCommandUtil, DocumentFragmentGetElementById, DocumentGetElementById, DocumentHeadGetter, DocumentHeadGetterUtil, ElementAttachShadow, ElementAttachShadowUtil, ElementAttributesGetterUtil, ElementGetAttributeNodeNSUtil, ElementGetAttributeNodeUtil, ElementInnerHtmlSetterUtil, ElementInsertAdjacentHTMLUtil, ElementOuterHTMLSetterUtil, ElementQuerySelectorUtil, ElementRemoveAttributeNodeUtil, ElementSetAttribute, ElementSetAttributeNS, ElementSetAttributeNSUtil, ElementSetAttributeNode, ElementSetAttributeNodeNS, ElementSetAttributeNodeNSUtil, ElementSetAttributeNodeUtil, ElementSetAttributeUtil, HTMLAnchorElementHostnameGetterUtil, HTMLAnchorElementHrefGetterUtil, HTMLAnchorElementHrefSetterUtil, HTMLElementStyleGetterUtil, HTMLFrameElementContentWindowGetterUtil, HTMLIframeElementContentWindowGetterUtil, HTMLLinkElementRelListSetterUtil, HTMLObjectElementContentWindowGetterUtil, MessageEventSourceGetterUtil, NamedNodeMapSetNamedItem, NamedNodeMapSetNamedItemUtil, NodeAppendChild, NodeChildNodesGetter, NodeIsEqualNode, NodeNodeNameGetter, NodeTextContentSetterUtil, RangeCreateContextualFragment, RangeCreateContextualFragmentUtil, StorageGetItem, StorageGetItemUtil, StorageKey, StorageKeyUtil, StorageRemoveItem, StorageRemoveItemUtil, StorageSetItem, StorageSetItemUtil, URLCreateObjectURL, URLRevokeObjectURL, WindowClearIntervalUtil, WindowFetch, WindowFetchUtil, WindowOpen, WindowOpenUtil, WindowSetIntervalUtil, XhrCtor, XhrOnReadyStateChangeSetter, XhrOpen, XhrProtoOpen, XhrProtoSend, XhrReadyStateGetter, XhrResponseTextGetter, XhrSend, XhrStatusGetter, XhrWithCredentialsSetter, createPatchedWindow, datasetGetterUtil, isEqualDomString, isSharedElement, requestURLGetterUtil };
/** version: 0.12.13 */
export { AttrNameGetter, AttrNameGetterUtil, AttrNamespaceURIGetter, AttrNamespaceURIGetterUtil, AttrOwnerElementGetter, AttrOwnerElementGetterUtil, AttrValueGetter, AttrValueGetterUtil, AttrValueSetter, AttrValueSetterUtil, BlobCtor, BlobSizeGetterUtil, BlobSliceValueUtil, BlobTypeGetterUtil, CustomElementRegistryDefineValue, CustomElementRegistryGet, DocumentBodyGetter, DocumentBodyGetterUtil, DocumentCookieGetterUtil, DocumentCookieSetterUtil, DocumentCreateElement, DocumentExecCommandUtil, DocumentFragmentGetElementById, DocumentGetElementById, DocumentHeadGetter, DocumentHeadGetterUtil, ElementAttachShadow, ElementAttachShadowUtil, ElementAttributesGetterUtil, ElementGetAttributeNodeNSUtil, ElementGetAttributeNodeUtil, ElementInnerHtmlSetterUtil, ElementInsertAdjacentHTMLUtil, ElementOuterHTMLSetterUtil, ElementQuerySelectorUtil, ElementRemoveAttributeNodeUtil, ElementSetAttribute, ElementSetAttributeNS, ElementSetAttributeNSUtil, ElementSetAttributeNode, ElementSetAttributeNodeNS, ElementSetAttributeNodeNSUtil, ElementSetAttributeNodeUtil, ElementSetAttributeUtil, HTMLAnchorElementHostnameGetterUtil, HTMLAnchorElementHrefGetterUtil, HTMLAnchorElementHrefSetterUtil, HTMLElementDatasetGetter, HTMLElementStyleGetterUtil, HTMLFrameElementContentWindowGetterUtil, HTMLIframeElementContentWindowGetterUtil, HTMLLinkElementRelListSetterUtil, HTMLObjectElementContentWindowGetterUtil, MessageEventSourceGetterUtil, NamedNodeMapSetNamedItem, NamedNodeMapSetNamedItemUtil, NodeAppendChild, NodeChildNodesGetter, NodeIsEqualNode, NodeNodeNameGetter, NodeTextContentSetterUtil, RangeCreateContextualFragment, RangeCreateContextualFragmentUtil, SVGElementDatasetGetter, StorageGetItem, StorageGetItemUtil, StorageKey, StorageKeyUtil, StorageRemoveItem, StorageRemoveItemUtil, StorageSetItem, StorageSetItemUtil, URLCreateObjectURL, URLRevokeObjectURL, WindowClearIntervalUtil, WindowEncodeURIComponent, WindowFetch, WindowFetchUtil, WindowOpen, WindowOpenUtil, WindowSetIntervalUtil, XhrCtor, XhrOnReadyStateChangeSetter, XhrOpen, XhrProtoOpen, XhrProtoSend, XhrReadyStateGetter, XhrResponseTextGetter, XhrSend, XhrStatusGetter, XhrWithCredentialsSetter, createPatchedWindow, isEqualDomString, isSharedElement, patchedWindowMap, requestURLGetterUtil };
/** version: 0.12.14 */

6

package.json
{
"name": "@locker/shared-dom",
"version": "0.12.13",
"version": "0.12.14",
"license": "Salesforce Developer Agreement",

@@ -22,5 +22,5 @@ "author": "Salesforce UI Security Team",

"dependencies": {
"@locker/shared": "0.12.13"
"@locker/shared": "0.12.14"
},
"gitHead": "773c88ecf9df8aae0fb438aba23605f10950dff0"
"gitHead": "a0e8c0ffb3c54c7fc57b0f21d10898251e2f632c"
}

@@ -1,3 +0,3 @@

export declare const datasetGetterUtil: Function;
export declare const HTMLElementDatasetGetter: Function;
export declare const HTMLElementStyleGetterUtil: Function;
//# sourceMappingURL=HTMLElement.d.ts.map

@@ -20,2 +20,3 @@ export * from './basic';

export * from './Storage';
export * from './SVGElement';
export * from './URL';

@@ -22,0 +23,0 @@ export * from './Window';

@@ -0,3 +1,4 @@

export declare const patchedWindowMap: WeakMap<object, any>;
export declare const createPatchedWindow: (rawWindow: WindowProxy) => Window | null;
export declare const WindowFetch: ((input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>) & typeof fetch, WindowOpen: ((url?: string | undefined, target?: string | undefined, features?: string | undefined, replace?: boolean | undefined) => Window | null) & typeof open;
export declare const WindowEncodeURIComponent: typeof encodeURIComponent, WindowFetch: ((input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>) & typeof fetch, WindowOpen: ((url?: string | undefined, target?: string | undefined, features?: string | undefined, replace?: boolean | undefined) => Window | null) & typeof open;
export declare const WindowSetIntervalUtil: Function;

@@ -4,0 +5,0 @@ export declare const WindowClearIntervalUtil: Function;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc