🏡 index : quine-global/electron-link.git

// Identify global functions that are present in an Electron runtime, but not at snapshot generation time.
// The resulting list is used in blueprint.js to create shim functions.
//
// Run with: npx @smashwilson/run-in-snapshot test/samples/list-globals.js

/*
This Array is generated by opening this project with "atom --safe" and running the following in a dev console:

const editor = atom.workspace.getActiveTextEditor()
let globalNames = Object
  .getOwnPropertyNames(global)
  .filter(globalName => typeof global[globalName] === 'function')
  .map(globalName => `"${globalName}"`)
  .join(', ')
editor.insertText(`const globalNames = [${globalNames}]`)
*/
const globalNames = [
  "Object", "Function", "Array", "Number", "parseFloat", "parseInt", "Boolean", "String", "Symbol", "Date", "Promise",
  "RegExp", "Error", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "ArrayBuffer",
  "Uint8Array", "Int8Array", "Uint16Array", "Int16Array", "Uint32Array", "Int32Array", "Float32Array", "Float64Array",
  "Uint8ClampedArray", "DataView", "Map", "Set", "WeakMap", "WeakSet", "Proxy", "decodeURI", "decodeURIComponent",
  "encodeURI", "encodeURIComponent", "escape", "unescape", "eval", "isFinite", "isNaN", "ByteLengthQueuingStrategy",
  "CountQueuingStrategy", "ReadableStream", "WritableStream", "USBOutTransferResult", "USBIsochronousOutTransferResult",
  "USBIsochronousOutTransferPacket", "USBIsochronousInTransferResult", "USBIsochronousInTransferPacket",
  "USBInTransferResult", "USBInterface", "USBEndpoint", "USBDevice", "USBConnectionEvent", "USBConfiguration",
  "USBAlternateInterface", "USB", "NFC", "BluetoothUUID", "BluetoothRemoteGATTService", "BluetoothRemoteGATTServer",
  "BluetoothRemoteGATTDescriptor", "BluetoothRemoteGATTCharacteristic", "BluetoothDevice",
  "BluetoothCharacteristicProperties", "Bluetooth", "WebAuthentication", "PublicKeyCredential", "AuthenticatorResponse",
  "AuthenticatorAttestationResponse", "AuthenticatorAssertionResponse", "WebGLRenderingContext",
  "WebGL2RenderingContext", "Path2D", "CanvasPattern", "CanvasGradient", "TextDetector", "FaceDetector", "DetectedText",
  "DetectedFace", "DetectedBarcode", "BarcodeDetector", "NavigationPreloadManager", "SensorErrorEvent", "Sensor",
  "RelativeOrientationSensor", "OrientationSensor", "Magnetometer", "LinearAccelerationSensor", "Gyroscope",
  "AmbientLightSensor", "Accelerometer", "AbsoluteOrientationSensor", "webkitSpeechRecognitionEvent",
  "webkitSpeechRecognitionError", "webkitSpeechRecognition", "webkitSpeechGrammarList", "webkitSpeechGrammar",
  "SpeechSynthesisUtterance", "SpeechSynthesisEvent", "RemotePlayback", "RTCRtpSender", "PushSubscriptionOptions",
  "PushSubscription", "PushManager", "PresentationReceiver", "PresentationConnectionList", "PresentationRequest",
  "PresentationConnectionCloseEvent", "PresentationConnectionAvailableEvent", "PresentationConnection",
  "PresentationAvailability", "Presentation", "PermissionStatus", "Permissions", "PaymentResponse",
  "PaymentRequestUpdateEvent", "PaymentRequest", "PaymentAddress", "PaymentManager", "Notification",
  "VideoPlaybackQuality", "TrackDefaultList", "TrackDefault", "CanvasCaptureMediaStreamTrack", "PhotoCapabilities",
  "MediaSettingsRange", "ImageCapture", "IDBObserverChanges", "IDBObserver", "IDBObservation", "StorageManager",
  "CompositorWorker", "BudgetService", "BroadcastChannel", "SyncManager", "BackgroundFetchRegistration",
  "BackgroundFetchManager", "BackgroundFetchFetch", "AudioParamMap", "XSLTProcessor", "Worklet", "VTTRegion",
  "KeyframeEffectReadOnly", "KeyframeEffect", "DocumentTimeline", "AnimationTimeline", "AnimationPlaybackEvent",
  "AnimationEffectTimingReadOnly", "AnimationEffectTiming", "AnimationEffectReadOnly", "Animation", "VisualViewport",
  "SharedWorker", "PerformanceServerTiming", "SVGMPathElement", "SVGDiscardElement", "SVGAnimationElement",
  "ResizeObserverEntry", "ResizeObserver", "PerformancePaintTiming", "PerformanceObserverEntryList",
  "PerformanceObserver", "PerformanceNavigationTiming", "IntersectionObserverEntry", "IntersectionObserver",
  "StaticRange", "InputEvent", "DOMRectReadOnly", "DOMRect", "DOMQuad", "DOMPointReadOnly", "DOMPoint",
  "DOMMatrixReadOnly", "DOMMatrix", "ScrollTimeline", "StylePropertyMapReadonly", "StylePropertyMap",
  "CSSVariableReferenceValue", "CSSURLImageValue", "CSSUnparsedValue", "CSSUnitValue", "CSSTranslation",
  "CSSTransformValue", "CSSTransformComponent", "CSSStyleValue", "CSSSkew", "CSSScale", "CSSRotation",
  "CSSResourceValue", "CSSPositionValue", "CSSPerspective", "CSSNumericValue", "CSSMatrixComponent", "CSSKeywordValue",
  "CSSImageValue", "VideoTrackList", "VideoTrack", "AudioTrackList", "AudioTrack", "AccessibleNodeList",
  "AccessibleNode", "webkitRTCPeerConnection", "webkitMediaStream", "WebSocket", "WebGLVertexArrayObject",
  "WebGLUniformLocation", "WebGLTransformFeedback", "WebGLTexture", "WebGLSync", "WebGLShaderPrecisionFormat",
  "WebGLShader", "WebGLSampler", "WebGLRenderbuffer", "WebGLQuery", "WebGLProgram", "WebGLFramebuffer",
  "WebGLContextEvent", "WebGLBuffer", "WebGLActiveInfo", "WaveShaperNode", "TextEncoder", "TextDecoder", "SubtleCrypto",
  "StorageEvent", "Storage", "StereoPannerNode", "SourceBufferList", "SourceBuffer", "ServiceWorkerRegistration",
  "ServiceWorkerContainer", "ServiceWorker", "ScriptProcessorNode", "ScreenOrientation", "Response", "Request",
  "RTCStatsReport", "RTCSessionDescription", "RTCRtpReceiver", "RTCRtpContributingSource", "RTCPeerConnectionIceEvent",
  "RTCPeerConnection", "RTCIceCandidate", "RTCDataChannelEvent", "RTCDataChannel", "RTCCertificate", "Plugin",
  "PluginArray", "PeriodicWave", "PasswordCredential", "PannerNode", "OscillatorNode", "OfflineAudioContext",
  "OfflineAudioCompletionEvent", "NetworkInformation", "MimeType", "MimeTypeArray", "MediaStreamTrackEvent",
  "MediaStreamTrack", "MediaStreamEvent", "MediaStream", "MediaStreamAudioSourceNode",
  "MediaStreamAudioDestinationNode", "MediaSource", "MediaRecorder", "MediaKeys", "MediaKeySystemAccess",
  "MediaKeyStatusMap", "MediaKeySession", "MediaKeyMessageEvent", "MediaEncryptedEvent", "MediaElementAudioSourceNode",
  "MediaDevices", "MediaDeviceInfo", "MIDIPort", "MIDIOutputMap", "MIDIOutput", "MIDIMessageEvent", "MIDIInputMap",
  "MIDIInput", "MIDIConnectionEvent", "MIDIAccess", "ImageBitmapRenderingContext", "IIRFilterNode",
  "IDBVersionChangeEvent", "IDBTransaction", "IDBRequest", "IDBOpenDBRequest", "IDBObjectStore", "IDBKeyRange",
  "IDBIndex", "IDBFactory", "IDBDatabase", "IDBCursorWithValue", "IDBCursor", "Headers", "GamepadEvent", "Gamepad",
  "GamepadButton", "GainNode", "FederatedCredential", "EventSource", "DynamicsCompressorNode", "DeviceOrientationEvent",
  "DeviceMotionEvent", "DelayNode", "DOMError", "CryptoKey", "Crypto", "CredentialsContainer", "Credential",
  "ConvolverNode", "ConstantSourceNode", "CloseEvent", "ChannelSplitterNode", "ChannelMergerNode",
  "CanvasRenderingContext2D", "CacheStorage", "Cache", "BlobEvent", "BiquadFilterNode", "BeforeInstallPromptEvent",
  "BatteryManager", "BaseAudioContext", "AudioScheduledSourceNode", "AudioProcessingEvent", "AudioParam", "AudioNode",
  "AudioListener", "AudioDestinationNode", "AudioContext", "AudioBufferSourceNode", "AudioBuffer",
  "AppBannerPromptResult", "AnalyserNode", "postMessage", "blur", "focus", "close", "XPathResult", "XPathExpression",
  "XPathEvaluator", "XMLSerializer", "XMLHttpRequestUpload", "XMLHttpRequestEventTarget", "XMLHttpRequest",
  "XMLDocument", "Worker", "Window", "WheelEvent", "ValidityState", "VTTCue", "URLSearchParams", "URL", "UIEvent",
  "TreeWalker", "TransitionEvent", "TrackEvent", "TouchList", "TouchEvent", "Touch", "TimeRanges", "TextTrackList",
  "TextTrackCueList", "TextTrackCue", "TextTrack", "TextMetrics", "TextEvent", "Text", "TaskAttributionTiming",
  "StyleSheetList", "StyleSheet", "ShadowRoot", "Selection", "SecurityPolicyViolationEvent", "Screen", "SVGViewElement",
  "SVGUseElement", "SVGUnitTypes", "SVGTransformList", "SVGTransform", "SVGTitleElement", "SVGTextPositioningElement",
  "SVGTextPathElement", "SVGTextElement", "SVGTextContentElement", "SVGTSpanElement", "SVGSymbolElement",
  "SVGSwitchElement", "SVGStyleElement", "SVGStringList", "SVGStopElement", "SVGSetElement", "SVGScriptElement",
  "SVGSVGElement", "SVGRectElement", "SVGRect", "SVGRadialGradientElement", "SVGPreserveAspectRatio",
  "SVGPolylineElement", "SVGPolygonElement", "SVGPointList", "SVGPoint", "SVGPatternElement", "SVGPathElement",
  "SVGNumberList", "SVGNumber", "SVGMetadataElement", "SVGMatrix", "SVGMaskElement", "SVGMarkerElement",
  "SVGLinearGradientElement", "SVGLineElement", "SVGLengthList", "SVGLength", "SVGImageElement", "SVGGraphicsElement",
  "SVGGradientElement", "SVGGeometryElement", "SVGGElement", "SVGForeignObjectElement", "SVGFilterElement",
  "SVGFETurbulenceElement", "SVGFETileElement", "SVGFESpotLightElement", "SVGFESpecularLightingElement",
  "SVGFEPointLightElement", "SVGFEOffsetElement", "SVGFEMorphologyElement", "SVGFEMergeNodeElement",
  "SVGFEMergeElement", "SVGFEImageElement", "SVGFEGaussianBlurElement", "SVGFEFuncRElement", "SVGFEFuncGElement",
  "SVGFEFuncBElement", "SVGFEFuncAElement", "SVGFEFloodElement", "SVGFEDropShadowElement", "SVGFEDistantLightElement",
  "SVGFEDisplacementMapElement", "SVGFEDiffuseLightingElement", "SVGFEConvolveMatrixElement", "SVGFECompositeElement",
  "SVGFEComponentTransferElement", "SVGFEColorMatrixElement", "SVGFEBlendElement", "SVGEllipseElement", "SVGElement",
  "SVGDescElement", "SVGDefsElement", "SVGComponentTransferFunctionElement", "SVGClipPathElement", "SVGCircleElement",
  "SVGAnimatedTransformList", "SVGAnimatedString", "SVGAnimatedRect", "SVGAnimatedPreserveAspectRatio",
  "SVGAnimatedNumberList", "SVGAnimatedNumber", "SVGAnimatedLengthList", "SVGAnimatedLength", "SVGAnimatedInteger",
  "SVGAnimatedEnumeration", "SVGAnimatedBoolean", "SVGAnimatedAngle", "SVGAnimateTransformElement",
  "SVGAnimateMotionElement", "SVGAnimateElement", "SVGAngle", "SVGAElement", "Range", "RadioNodeList",
  "PromiseRejectionEvent", "ProgressEvent", "ProcessingInstruction", "PopStateEvent", "PointerEvent",
  "PerformanceTiming", "PerformanceResourceTiming", "PerformanceNavigation", "PerformanceMeasure", "PerformanceMark",
  "PerformanceLongTaskTiming", "PerformanceEntry", "Performance", "PageTransitionEvent", "NodeList", "NodeIterator",
  "NodeFilter", "Node", "Navigator", "NamedNodeMap", "MutationRecord", "MutationObserver", "MutationEvent",
  "MouseEvent", "MessagePort", "MessageEvent", "MessageChannel", "MediaQueryListEvent", "MediaQueryList", "MediaList",
  "MediaError", "Location", "KeyboardEvent", "InputDeviceCapabilities", "ImageData", "ImageBitmap", "IdleDeadline",
  "History", "HashChangeEvent", "HTMLVideoElement", "HTMLUnknownElement", "HTMLUListElement", "HTMLTrackElement",
  "HTMLTitleElement", "HTMLTextAreaElement", "HTMLTemplateElement", "HTMLTableSectionElement", "HTMLTableRowElement",
  "HTMLTableElement", "HTMLTableColElement", "HTMLTableCellElement", "HTMLTableCaptionElement", "HTMLStyleElement",
  "HTMLSpanElement", "HTMLSourceElement", "HTMLSlotElement", "HTMLShadowElement", "HTMLSelectElement",
  "HTMLScriptElement", "HTMLQuoteElement", "HTMLProgressElement", "HTMLPreElement", "HTMLPictureElement",
  "HTMLParamElement", "HTMLParagraphElement", "HTMLOutputElement", "HTMLOptionsCollection", "Option",
  "HTMLOptionElement", "HTMLOptGroupElement", "HTMLObjectElement", "HTMLOListElement", "HTMLModElement",
  "HTMLMeterElement", "HTMLMetaElement", "HTMLMenuElement", "HTMLMediaElement", "HTMLMarqueeElement", "HTMLMapElement",
  "HTMLLinkElement", "HTMLLegendElement", "HTMLLabelElement", "HTMLLIElement", "HTMLInputElement", "Image",
  "HTMLImageElement", "HTMLIFrameElement", "HTMLHtmlElement", "HTMLHeadingElement", "HTMLHeadElement", "HTMLHRElement",
  "HTMLFrameSetElement", "HTMLFrameElement", "HTMLFormElement", "HTMLFormControlsCollection", "HTMLFontElement",
  "HTMLFieldSetElement", "HTMLEmbedElement", "HTMLElement", "HTMLDocument", "HTMLDivElement", "HTMLDirectoryElement",
  "HTMLDialogElement", "HTMLDetailsElement", "HTMLDataListElement", "HTMLDListElement", "HTMLContentElement",
  "HTMLCollection", "HTMLCanvasElement", "HTMLButtonElement", "HTMLBodyElement", "HTMLBaseElement", "HTMLBRElement",
  "Audio", "HTMLAudioElement", "HTMLAreaElement", "HTMLAnchorElement", "HTMLAllCollection", "FormData",
  "FontFaceSetLoadEvent", "FontFace", "FocusEvent", "FileReader", "FileList", "File", "EventTarget", "Event",
  "ErrorEvent", "Element", "DragEvent", "DocumentType", "DocumentFragment", "Document", "DataTransferItemList",
  "DataTransferItem", "DataTransfer", "DOMTokenList", "DOMStringMap", "DOMStringList", "DOMParser", "DOMImplementation",
  "DOMException", "CustomEvent", "CustomElementRegistry", "CompositionEvent", "Comment", "ClipboardEvent", "Clipboard",
  "CharacterData", "CSSViewportRule", "CSSSupportsRule", "CSSStyleSheet", "CSSStyleRule", "CSSStyleDeclaration",
  "CSSRuleList", "CSSRule", "CSSPageRule", "CSSNamespaceRule", "CSSMediaRule", "CSSKeyframesRule", "CSSKeyframeRule",
  "CSSImportRule", "CSSGroupingRule", "CSSFontFaceRule", "CSS", "CSSConditionRule", "CDATASection", "Blob",
  "BeforeUnloadEvent", "BarProp", "Attr", "ApplicationCacheErrorEvent", "ApplicationCache", "AnimationEvent",
  "WebKitCSSMatrix", "WebKitMutationObserver", "webkitURL", "WebKitAnimationEvent", "WebKitTransitionEvent", "onerror",
  "onload", "stop", "open", "alert", "confirm", "prompt", "print", "requestAnimationFrame", "cancelAnimationFrame",
  "requestIdleCallback", "cancelIdleCallback", "captureEvents", "releaseEvents", "getComputedStyle", "matchMedia",
  "moveTo", "moveBy", "resizeTo", "resizeBy", "getSelection", "find", "getMatchedCSSRules",
  "webkitRequestAnimationFrame", "webkitCancelAnimationFrame", "btoa", "atob", "setTimeout", "clearTimeout",
  "setInterval", "clearInterval", "createImageBitmap", "scroll", "scrollTo", "scrollBy", "fetch", "getComputedStyleMap",
  "webkitRequestFileSystem", "webkitResolveLocalFileSystemURL", "openDatabase", "SharedArrayBuffer", "Buffer",
  "setImmediate", "clearImmediate", "require", "BudgetState", "WebView", "measure", "profile", "dir", "dirxml",
  "profileEnd", "clear", "table", "keys", "values", "debug", "undebug", "monitor", "unmonitor", "inspect", "copy",
  "getEventListeners", "monitorEvents", "unmonitorEvents", "$", "$$", "$x"
]

const report = globalNames.reduce((r, globalName) => {
  try {
    eval(globalName);
    r.existing.push(globalName);
  } catch (e) {
    // Not defined at mksnapshot time
    r.missing.push(globalName);
  }
  return r;
}, {existing: [], missing: []});

async function main() {
  return report.existing.map(each => `"${each}"`).join(', ');
}