Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadowing of Image constructor #3268

Closed
alex35mil opened this issue Jan 10, 2019 · 7 comments
Closed

Shadowing of Image constructor #3268

alex35mil opened this issue Jan 10, 2019 · 7 comments
Labels

Comments

@alex35mil
Copy link
Contributor

This is basically the same issue as #3214 but with Image constructor.

@bobzhang
Copy link
Member

Indeed, do you have other in mind, so that we can do them in a single pass

@bobzhang bobzhang added the bug label Jan 11, 2019
@alex35mil
Copy link
Contributor Author

@bobzhang Not sure if this is complete list but should cover most of the cases.

I printed window object in Chrome console and

const COPIED_WINDOW_OBJECT_STRING = `
AppView: class extends
ExtensionOptions: class extends
ExtensionView: class extends
alert: ƒ alert()
...
`;

COPIED_WINDOW_OBJECT_STRING
  .split("\n")
  .map(x => x.split(":")[0])
  .filter(x => x && /^[A-Z]/.test(x[0]))
  .join("\n")
Result
AppView
ExtensionOptions
ExtensionView
WebView
Infinity
AbortController
AbortSignal
AbsoluteOrientationSensor
Accelerometer
AnalyserNode
AnimationEvent
ApplicationCache
ApplicationCacheErrorEvent
Array
ArrayBuffer
Atomics
Attr
Audio
AudioBuffer
AudioBufferSourceNode
AudioContext
AudioDestinationNode
AudioListener
AudioNode
AudioParam
AudioParamMap
AudioProcessingEvent
AudioScheduledSourceNode
AudioWorklet
AudioWorkletNode
AuthenticatorAssertionResponse
AuthenticatorAttestationResponse
AuthenticatorResponse
BarProp
BaseAudioContext
BatteryManager
BeforeInstallPromptEvent
BeforeUnloadEvent
BigInt
BigInt64Array
BigUint64Array
BiquadFilterNode
Blob
BlobEvent
Bluetooth
BluetoothCharacteristicProperties
BluetoothDevice
BluetoothRemoteGATTCharacteristic
BluetoothRemoteGATTDescriptor
BluetoothRemoteGATTServer
BluetoothRemoteGATTService
BluetoothUUID
Boolean
BroadcastChannel
ByteLengthQueuingStrategy
CDATASection
CSS
CSSConditionRule
CSSFontFaceRule
CSSGroupingRule
CSSImageValue
CSSImportRule
CSSKeyframeRule
CSSKeyframesRule
CSSKeywordValue
CSSMathInvert
CSSMathMax
CSSMathMin
CSSMathNegate
CSSMathProduct
CSSMathSum
CSSMathValue
CSSMatrixComponent
CSSMediaRule
CSSNamespaceRule
CSSNumericArray
CSSNumericValue
CSSPageRule
CSSPerspective
CSSPositionValue
CSSRotate
CSSRule
CSSRuleList
CSSScale
CSSSkew
CSSSkewX
CSSSkewY
CSSStyleDeclaration
CSSStyleRule
CSSStyleSheet
CSSStyleValue
CSSSupportsRule
CSSTransformComponent
CSSTransformValue
CSSTranslate
CSSUnitValue
CSSUnparsedValue
CSSVariableReferenceValue
Cache
CacheStorage
CanvasCaptureMediaStreamTrack
CanvasGradient
CanvasPattern
CanvasRenderingContext2D
ChannelMergerNode
ChannelSplitterNode
CharacterData
Clipboard
ClipboardEvent
CloseEvent
Comment
CompositionEvent
ConstantSourceNode
ConvolverNode
CountQueuingStrategy
Credential
CredentialsContainer
Crypto
CryptoKey
CustomElementRegistry
CustomEvent
DOMError
DOMException
DOMImplementation
DOMMatrix
DOMMatrixReadOnly
DOMParser
DOMPoint
DOMPointReadOnly
DOMQuad
DOMRect
DOMRectList
DOMRectReadOnly
DOMStringList
DOMStringMap
DOMTokenList
DataTransfer
DataTransferItem
DataTransferItemList
DataView
Date
DelayNode
DeviceMotionEvent
DeviceOrientationEvent
Document
DocumentFragment
DocumentType
DragEvent
DynamicsCompressorNode
Element
EnterPictureInPictureEvent
Error
ErrorEvent
EvalError
Event
EventSource
EventTarget
FederatedCredential
File
FileList
FileReader
Float32Array
Float64Array
FocusEvent
FontFace
FontFaceSetLoadEvent
FormData
Function
GainNode
Gamepad
GamepadButton
GamepadEvent
GamepadHapticActuator
Gyroscope
HTMLAllCollection
HTMLAnchorElement
HTMLAreaElement
HTMLAudioElement
HTMLBRElement
HTMLBaseElement
HTMLBodyElement
HTMLButtonElement
HTMLCanvasElement
HTMLCollection
HTMLContentElement
HTMLDListElement
HTMLDataElement
HTMLDataListElement
HTMLDetailsElement
HTMLDialogElement
HTMLDirectoryElement
HTMLDivElement
HTMLDocument
HTMLElement
HTMLEmbedElement
HTMLFieldSetElement
HTMLFontElement
HTMLFormControlsCollection
HTMLFormElement
HTMLFrameElement
HTMLFrameSetElement
HTMLHRElement
HTMLHeadElement
HTMLHeadingElement
HTMLHtmlElement
HTMLIFrameElement
HTMLImageElement
HTMLInputElement
HTMLLIElement
HTMLLabelElement
HTMLLegendElement
HTMLLinkElement
HTMLMapElement
HTMLMarqueeElement
HTMLMediaElement
HTMLMenuElement
HTMLMetaElement
HTMLMeterElement
HTMLModElement
HTMLOListElement
HTMLObjectElement
HTMLOptGroupElement
HTMLOptionElement
HTMLOptionsCollection
HTMLOutputElement
HTMLParagraphElement
HTMLParamElement
HTMLPictureElement
HTMLPreElement
HTMLProgressElement
HTMLQuoteElement
HTMLScriptElement
HTMLSelectElement
HTMLShadowElement
HTMLSlotElement
HTMLSourceElement
HTMLSpanElement
HTMLStyleElement
HTMLTableCaptionElement
HTMLTableCellElement
HTMLTableColElement
HTMLTableElement
HTMLTableRowElement
HTMLTableSectionElement
HTMLTemplateElement
HTMLTextAreaElement
HTMLTimeElement
HTMLTitleElement
HTMLTrackElement
HTMLUListElement
HTMLUnknownElement
HTMLVideoElement
HashChangeEvent
Headers
History
IDBCursor
IDBCursorWithValue
IDBDatabase
IDBFactory
IDBIndex
IDBKeyRange
IDBObjectStore
IDBOpenDBRequest
IDBRequest
IDBTransaction
IDBVersionChangeEvent
IIRFilterNode
IdleDeadline
Image
ImageBitmap
ImageBitmapRenderingContext
ImageCapture
ImageData
InputDeviceCapabilities
InputDeviceInfo
InputEvent
Int8Array
Int16Array
Int32Array
IntersectionObserver
IntersectionObserverEntry
Intl
JSON
Keyboard
KeyboardEvent
KeyboardLayoutMap
LinearAccelerationSensor
Location
Lock
LockManager
MIDIAccess
MIDIConnectionEvent
MIDIInput
MIDIInputMap
MIDIMessageEvent
MIDIOutput
MIDIOutputMap
MIDIPort
Map
Math
MediaCapabilities
MediaCapabilitiesInfo
MediaDeviceInfo
MediaDevices
MediaElementAudioSourceNode
MediaEncryptedEvent
MediaError
MediaKeyMessageEvent
MediaKeySession
MediaKeyStatusMap
MediaKeySystemAccess
MediaKeys
MediaList
MediaQueryList
MediaQueryListEvent
MediaRecorder
MediaSettingsRange
MediaSource
MediaStream
MediaStreamAudioDestinationNode
MediaStreamAudioSourceNode
MediaStreamEvent
MediaStreamTrack
MediaStreamTrackEvent
MessageChannel
MessageEvent
MessagePort
MimeType
MimeTypeArray
MouseEvent
MutationEvent
MutationObserver
MutationRecord
NaN
NamedNodeMap
NavigationPreloadManager
Navigator
NetworkInformation
Node
NodeFilter
NodeIterator
NodeList
Notification
Number
Object
OfflineAudioCompletionEvent
OfflineAudioContext
OffscreenCanvas
OffscreenCanvasRenderingContext2D
Option
OrientationSensor
OscillatorNode
OverconstrainedError
PageTransitionEvent
PannerNode
PasswordCredential
Path2D
PaymentAddress
PaymentInstruments
PaymentManager
PaymentRequest
PaymentRequestUpdateEvent
PaymentResponse
Performance
PerformanceEntry
PerformanceLongTaskTiming
PerformanceMark
PerformanceMeasure
PerformanceNavigation
PerformanceNavigationTiming
PerformanceObserver
PerformanceObserverEntryList
PerformancePaintTiming
PerformanceResourceTiming
PerformanceServerTiming
PerformanceTiming
PeriodicWave
PermissionStatus
Permissions
PhotoCapabilities
PictureInPictureWindow
Plugin
PluginArray
PointerEvent
PopStateEvent
Presentation
PresentationAvailability
PresentationConnection
PresentationConnectionAvailableEvent
PresentationConnectionCloseEvent
PresentationConnectionList
PresentationReceiver
PresentationRequest
ProcessingInstruction
ProgressEvent
Promise
PromiseRejectionEvent
Proxy
PublicKeyCredential
PushManager
PushSubscription
PushSubscriptionOptions
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCIceCandidate
RTCPeerConnection
RTCPeerConnectionIceEvent
RTCRtpContributingSource
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSessionDescription
RTCStatsReport
RTCTrackEvent
RadioNodeList
Range
RangeError
ReadableStream
ReferenceError
Reflect
RegExp
RelativeOrientationSensor
RemotePlayback
ReportingObserver
Request
ResizeObserver
ResizeObserverEntry
Response
SVGAElement
SVGAngle
SVGAnimateElement
SVGAnimateMotionElement
SVGAnimateTransformElement
SVGAnimatedAngle
SVGAnimatedBoolean
SVGAnimatedEnumeration
SVGAnimatedInteger
SVGAnimatedLength
SVGAnimatedLengthList
SVGAnimatedNumber
SVGAnimatedNumberList
SVGAnimatedPreserveAspectRatio
SVGAnimatedRect
SVGAnimatedString
SVGAnimatedTransformList
SVGAnimationElement
SVGCircleElement
SVGClipPathElement
SVGComponentTransferFunctionElement
SVGDefsElement
SVGDescElement
SVGDiscardElement
SVGElement
SVGEllipseElement
SVGFEBlendElement
SVGFEColorMatrixElement
SVGFEComponentTransferElement
SVGFECompositeElement
SVGFEConvolveMatrixElement
SVGFEDiffuseLightingElement
SVGFEDisplacementMapElement
SVGFEDistantLightElement
SVGFEDropShadowElement
SVGFEFloodElement
SVGFEFuncAElement
SVGFEFuncBElement
SVGFEFuncGElement
SVGFEFuncRElement
SVGFEGaussianBlurElement
SVGFEImageElement
SVGFEMergeElement
SVGFEMergeNodeElement
SVGFEMorphologyElement
SVGFEOffsetElement
SVGFEPointLightElement
SVGFESpecularLightingElement
SVGFESpotLightElement
SVGFETileElement
SVGFETurbulenceElement
SVGFilterElement
SVGForeignObjectElement
SVGGElement
SVGGeometryElement
SVGGradientElement
SVGGraphicsElement
SVGImageElement
SVGLength
SVGLengthList
SVGLineElement
SVGLinearGradientElement
SVGMPathElement
SVGMarkerElement
SVGMaskElement
SVGMatrix
SVGMetadataElement
SVGNumber
SVGNumberList
SVGPathElement
SVGPatternElement
SVGPoint
SVGPointList
SVGPolygonElement
SVGPolylineElement
SVGPreserveAspectRatio
SVGRadialGradientElement
SVGRect
SVGRectElement
SVGSVGElement
SVGScriptElement
SVGSetElement
SVGStopElement
SVGStringList
SVGStyleElement
SVGSwitchElement
SVGSymbolElement
SVGTSpanElement
SVGTextContentElement
SVGTextElement
SVGTextPathElement
SVGTextPositioningElement
SVGTitleElement
SVGTransform
SVGTransformList
SVGUnitTypes
SVGUseElement
SVGViewElement
Screen
ScreenOrientation
ScriptProcessorNode
SecurityPolicyViolationEvent
Selection
Sensor
SensorErrorEvent
ServiceWorker
ServiceWorkerContainer
ServiceWorkerRegistration
Set
ShadowRoot
SharedArrayBuffer
SharedWorker
SourceBuffer
SourceBufferList
SpeechSynthesisErrorEvent
SpeechSynthesisEvent
SpeechSynthesisUtterance
StaticRange
StereoPannerNode
Storage
StorageEvent
StorageManager
String
StylePropertyMap
StylePropertyMapReadOnly
StyleSheet
StyleSheetList
SubtleCrypto
Symbol
SyncManager
SyntaxError
TaskAttributionTiming
Text
TextDecoder
TextDecoderStream
TextEncoder
TextEncoderStream
TextEvent
TextMetrics
TextTrack
TextTrackCue
TextTrackCueList
TextTrackList
TimeRanges
Touch
TouchEvent
TouchList
TrackEvent
TransformStream
TransitionEvent
TreeWalker
TypeError
UIEvent
URIError
URL
URLSearchParams
USB
USBAlternateInterface
USBConfiguration
USBConnectionEvent
USBDevice
USBEndpoint
USBInTransferResult
USBInterface
USBIsochronousInTransferPacket
USBIsochronousInTransferResult
USBIsochronousOutTransferPacket
USBIsochronousOutTransferResult
USBOutTransferResult
Uint8Array
Uint8ClampedArray
Uint16Array
Uint32Array
VTTCue
ValidityState
VisualViewport
WaveShaperNode
WeakMap
WeakSet
WebAssembly
WebGL2RenderingContext
WebGLActiveInfo
WebGLBuffer
WebGLContextEvent
WebGLFramebuffer
WebGLProgram
WebGLQuery
WebGLRenderbuffer
WebGLRenderingContext
WebGLSampler
WebGLShader
WebGLShaderPrecisionFormat
WebGLSync
WebGLTexture
WebGLTransformFeedback
WebGLUniformLocation
WebGLVertexArrayObject
WebKitCSSMatrix
WebKitMutationObserver
WebSocket
WheelEvent
Window
Worker
Worklet
WritableStream
XMLDocument
XMLHttpRequest
XMLHttpRequestEventTarget
XMLHttpRequestUpload
XMLSerializer
XPathEvaluator
XPathExpression
XPathResult
XSLTProcessor

@bobzhang
Copy link
Member

bobzhang commented Jan 14, 2019

Thanks, this seems to be huge.
For the record, Object.getOwnProperties(window) will list a complete list of global names

@bobzhang
Copy link
Member

bobzhang commented Jan 14, 2019

@alexfedoseev It would be great that if you can verify it is fixed in master
I feel it is a bit extreme to avoid shadowing variables like name, JS users should write window.name instead, we might make some trade off here

@kamituel
Copy link

I've stumbled upon this issue today. Glenn has helped me already, but posting it here just for context on another browser API binding it affects: https://stackoverflow.com/questions/54803396/module-name-is-shadowing-global-name-used-in-binding#54803396

@bobzhang
Copy link
Member

I think this is solved, do you still find such issue in master or bs-platform@next?

@kamituel
Copy link

@bobzhang Just checked and indeed, with bs-platform@next it's all good. Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants