diff options
| -rw-r--r-- | main_background.js | 1042 | ||||
| -rw-r--r-- | nontriv.html | 111 | ||||
| -rw-r--r-- | test.js | 958 | ||||
| -rw-r--r-- | test_bundle.js | 1055 | 
4 files changed, 2954 insertions, 212 deletions
diff --git a/main_background.js b/main_background.js index fe8dd52..aafd873 100644 --- a/main_background.js +++ b/main_background.js @@ -722,112 +722,989 @@ function blocked_status(hash){  }  /* *********************************************************************************************** */ -// - For each definition of anything executable that gets a name, including methods: -//  It must call only primitives. (except altering the dom, eval, ajax, square bracket notation)  - - -// The number of conditionals and loops must be at most 3. - -// It does not declare an array more than 50 elements long. -// (This will be under VariableDeclarator) -// At every VariableDeclarator, see if it has  - - -//  It must not call itself +var fname_data = { +	"WebGLShader": true, +	"WebGLShaderPrecisionFormat": true, +	"WebGLQuery": true, +	"WebGLRenderbuffer": true, +	"WebGLSampler": true, +	"WebGLUniformLocation": true, +	"WebGLFramebuffer": true, +	"WebGLProgram": true, +	"WebGLContextEvent": true, +	"WebGL2RenderingContext": true, +	"WebGLTexture": true, +	"WebGLRenderingContext": true, +	"WebGLVertexArrayObject": true, +	"WebGLActiveInfo": true, +	"WebGLTransformFeedback": true, +	"WebGLSync": true, +	"WebGLBuffer": true, +	"cat_svg": true, +	"SVGPoint": true, +	"SVGEllipseElement": true, +	"SVGRadialGradientElement": true, +	"SVGComponentTransferFunctionElement": true, +	"SVGPathSegCurvetoQuadraticAbs": true, +	"SVGAnimatedNumberList": true, +	"SVGPathSegCurvetoQuadraticSmoothRel": true, +	"SVGFEColorMatrixElement": true, +	"SVGPathSegLinetoHorizontalAbs": true, +	"SVGLinearGradientElement": true, +	"SVGStyleElement": true, +	"SVGPathSegMovetoRel": true, +	"SVGStopElement": true, +	"SVGPathSegLinetoRel": true, +	"SVGFEConvolveMatrixElement": true, +	"SVGAnimatedAngle": true, +	"SVGPathSegLinetoAbs": true, +	"SVGPreserveAspectRatio": true, +	"SVGFEOffsetElement": true, +	"SVGFEImageElement": true, +	"SVGFEDiffuseLightingElement": true, +	"SVGAnimatedNumber": true, +	"SVGTextElement": true, +	"SVGFESpotLightElement": true, +	"SVGFEMorphologyElement": true, +	"SVGAngle": true, +	"SVGScriptElement": true, +	"SVGFEDropShadowElement": true, +	"SVGPathSegArcRel": true, +	"SVGNumber": true, +	"SVGPathSegLinetoHorizontalRel": true, +	"SVGFEFuncBElement": true, +	"SVGClipPathElement": true, +	"SVGPathSeg": true, +	"SVGUseElement": true, +	"SVGPathSegArcAbs": true, +	"SVGPathSegCurvetoQuadraticSmoothAbs": true, +	"SVGRect": true, +	"SVGAnimatedPreserveAspectRatio": true, +	"SVGImageElement": true, +	"SVGAnimatedEnumeration": true, +	"SVGAnimatedLengthList": true, +	"SVGFEFloodElement": true, +	"SVGFECompositeElement": true, +	"SVGAElement": true, +	"SVGAnimatedBoolean": true, +	"SVGMaskElement": true, +	"SVGFilterElement": true, +	"SVGPathSegLinetoVerticalRel": true, +	"SVGAnimatedInteger": true, +	"SVGTSpanElement": true, +	"SVGMarkerElement": true, +	"SVGStringList": true, +	"SVGTransform": true, +	"SVGTitleElement": true, +	"SVGFEBlendElement": true, +	"SVGTextPositioningElement": true, +	"SVGFEFuncGElement": true, +	"SVGFEPointLightElement": true, +	"SVGAnimateElement": true, +	"SVGPolylineElement": true, +	"SVGDefsElement": true, +	"SVGPathSegList": true, +	"SVGAnimatedTransformList": true, +	"SVGPathSegClosePath": true, +	"SVGGradientElement": true, +	"SVGSwitchElement": true, +	"SVGViewElement": true, +	"SVGUnitTypes": true, +	"SVGPathSegMovetoAbs": true, +	"SVGSymbolElement": true, +	"SVGFEFuncAElement": true, +	"SVGAnimatedString": true, +	"SVGFEMergeElement": true, +	"SVGPathSegLinetoVerticalAbs": true, +	"SVGAnimationElement": true, +	"SVGPathSegCurvetoCubicAbs": true, +	"SVGLength": true, +	"SVGTextPathElement": true, +	"SVGPolygonElement": true, +	"SVGAnimatedRect": true, +	"SVGPathSegCurvetoCubicRel": true, +	"SVGFEFuncRElement": true, +	"SVGLengthList": true, +	"SVGTextContentElement": true, +	"SVGFETurbulenceElement": true, +	"SVGMatrix": true, +	"SVGZoomAndPan": true, +	"SVGMetadataElement": true, +	"SVGFEDistantLightElement": true, +	"SVGAnimateMotionElement": true, +	"SVGDescElement": true, +	"SVGPathSegCurvetoCubicSmoothRel": true, +	"SVGFESpecularLightingElement": true, +	"SVGFEGaussianBlurElement": true, +	"SVGFEComponentTransferElement": true, +	"SVGNumberList": true, +	"SVGTransformList": true, +	"SVGForeignObjectElement": true, +	"SVGRectElement": true, +	"SVGFEDisplacementMapElement": true, +	"SVGAnimateTransformElement": true, +	"SVGAnimatedLength": true, +	"SVGPointList": true, +	"SVGPatternElement": true, +	"SVGPathSegCurvetoCubicSmoothAbs": true, +	"SVGCircleElement": true, +	"SVGSetElement": true, +	"SVGFETileElement": true, +	"SVGMPathElement": true, +	"SVGFEMergeNodeElement": true, +	"SVGPathSegCurvetoQuadraticRel": true, +	"SVGElement": true, +	"SVGGraphicsElement": true, +	"SVGSVGElement": true, +	"SVGGElement": true, +	"SVGGeometryElement": true, +	"SVGPathElement": true, +	"SVGLineElement": true, +	"cat_html": true, +	"HTMLTimeElement": true, +	"HTMLPictureElement": true, +	"HTMLMenuItemElement": true, +	"HTMLFormElement": true, +	"HTMLOptionElement": true, +	"HTMLCanvasElement": true, +	"HTMLTableSectionElement": true, +	"HTMLSelectElement": true, +	"HTMLUListElement": true, +	"HTMLMetaElement": true, +	"HTMLLinkElement": true, +	"HTMLBaseElement": true, +	"HTMLDataListElement": true, +	"HTMLInputElement": true, +	"HTMLMeterElement": true, +	"HTMLSourceElement": true, +	"HTMLTrackElement": true, +	"HTMLTableColElement": true, +	"HTMLFieldSetElement": true, +	"HTMLDirectoryElement": true, +	"HTMLTableCellElement": true, +	"HTMLStyleElement": true, +	"HTMLAudioElement": true, +	"HTMLLegendElement": true, +	"HTMLOListElement": true, +	"HTMLEmbedElement": true, +	"HTMLQuoteElement": true, +	"HTMLMenuElement": true, +	"HTMLHeadElement": true, +	"HTMLUnknownElement": true, +	"HTMLBRElement": true, +	"HTMLProgressElement": true, +	"HTMLMediaElement": true, +	"HTMLFormControlsCollection": true, +	"HTMLCollection": true, +	"HTMLLIElement": true, +	"HTMLDetailsElement": true, +	"HTMLObjectElement": true, +	"HTMLHeadingElement": true, +	"HTMLTableCaptionElement": true, +	"HTMLPreElement": true, +	"HTMLAllCollection": true, +	"HTMLFrameSetElement": true, +	"HTMLFontElement": true, +	"HTMLFrameElement": true, +	"HTMLAnchorElement": true, +	"HTMLOptGroupElement": true, +	"HTMLVideoElement": true, +	"HTMLModElement": true, +	"HTMLBodyElement": true, +	"HTMLTableElement": true, +	"HTMLButtonElement": true, +	"HTMLTableRowElement": true, +	"HTMLAreaElement": true, +	"HTMLDataElement": true, +	"HTMLParamElement": true, +	"HTMLLabelElement": true, +	"HTMLTemplateElement": true, +	"HTMLOptionsCollection": true, +	"HTMLIFrameElement": true, +	"HTMLTitleElement": true, +	"HTMLMapElement": true, +	"HTMLOutputElement": true, +	"HTMLDListElement": true, +	"HTMLParagraphElement": true, +	"HTMLHRElement": true, +	"HTMLImageElement": true, +	"HTMLDocument": true, +	"HTMLElement": true, +	"HTMLScriptElement": true, +	"HTMLHtmlElement": true, +	"HTMLTextAreaElement": true, +	"HTMLDivElement": true, +	"HTMLSpanElement": true, +	"cat_css": true, +	"CSSStyleRule": true, +	"CSSFontFaceRule": true, +	"CSSPrimitiveValue": true, +	"CSSStyleDeclaration": true, +	"CSSStyleSheet": true, +	"CSSPageRule": true, +	"CSSSupportsRule": true, +	"CSSMozDocumentRule": true, +	"CSSKeyframeRule": true, +	"CSSGroupingRule": true, +	"CSS2Properties": true, +	"CSSFontFeatureValuesRule": true, +	"CSSRuleList": true, +	"CSSPseudoElement": true, +	"CSSMediaRule": true, +	"CSSCounterStyleRule": true, +	"CSSImportRule": true, +	"CSSTransition": true, +	"CSSAnimation": true, +	"CSSValue": true, +	"CSSNamespaceRule": true, +	"CSSRule": true, +	"CSS": true, +	"CSSKeyframesRule": true, +	"CSSConditionRule": true, +	"CSSValueList": true, +	"cat_event": true, +	"ondevicemotion": true, +	"ondeviceorientation": true, +	"onabsolutedeviceorientation": true, +	"ondeviceproximity": true, +	"onuserproximity": true, +	"ondevicelight": true, +	"onvrdisplayconnect": true, +	"onvrdisplaydisconnect": true, +	"onvrdisplayactivate": true, +	"onvrdisplaydeactivate": true, +	"onvrdisplaypresentchange": true, +	"onabort": true, +	"onblur": true, +	"onfocus": true, +	"onauxclick": true, +	"oncanplay": true, +	"oncanplaythrough": true, +	"onchange": true, +	"onclick": true, +	"onclose": true, +	"oncontextmenu": true, +	"ondblclick": true, +	"ondrag": true, +	"ondragend": true, +	"ondragenter": true, +	"ondragexit": true, +	"ondragleave": true, +	"ondragover": true, +	"ondragstart": true, +	"ondrop": true, +	"ondurationchange": true, +	"onemptied": true, +	"onended": true, +	"oninput": true, +	"oninvalid": true, +	"onkeydown": true, +	"onkeypress": true, +	"onkeyup": true, +	"onload": true, +	"onloadeddata": true, +	"onloadedmetadata": true, +	"onloadend": true, +	"onloadstart": true, +	"onmousedown": true, +	"onmouseenter": true, +	"onmouseleave": true, +	"onmousemove": true, +	"onmouseout": true, +	"onmouseover": true, +	"onmouseup": true, +	"onwheel": true, +	"onpause": true, +	"onplay": true, +	"onplaying": true, +	"onprogress": true, +	"onratechange": true, +	"onreset": true, +	"onresize": true, +	"onscroll": true, +	"onseeked": true, +	"onseeking": true, +	"onselect": true, +	"onshow": true, +	"onstalled": true, +	"onsubmit": true, +	"onsuspend": true, +	"ontimeupdate": true, +	"onvolumechange": true, +	"onwaiting": true, +	"onselectstart": true, +	"ontoggle": true, +	"onpointercancel": true, +	"onpointerdown": true, +	"onpointerup": true, +	"onpointermove": true, +	"onpointerout": true, +	"onpointerover": true, +	"onpointerenter": true, +	"onpointerleave": true, +	"ongotpointercapture": true, +	"onlostpointercapture": true, +	"onmozfullscreenchange": true, +	"onmozfullscreenerror": true, +	"onanimationcancel": true, +	"onanimationend": true, +	"onanimationiteration": true, +	"onanimationstart": true, +	"ontransitioncancel": true, +	"ontransitionend": true, +	"ontransitionrun": true, +	"ontransitionstart": true, +	"onwebkitanimationend": true, +	"onwebkitanimationiteration": true, +	"onwebkitanimationstart": true, +	"onwebkittransitionend": true, +	"onerror": true, +	"onafterprint": true, +	"onbeforeprint": true, +	"onbeforeunload": true, +	"onhashchange": true, +	"onlanguagechange": true, +	"onmessage": true, +	"onmessageerror": true, +	"onoffline": true, +	"ononline": true, +	"onpagehide": true, +	"onpageshow": true, +	"onpopstate": true, +	"onstorage": true, +	"onunload": true, +	"cat_rtc": true, +	"RTCDTMFSender": true, +	"RTCStatsReport": true, +	"RTCTrackEvent": true, +	"RTCDataChannelEvent": true, +	"RTCPeerConnectionIceEvent": true, +	"RTCCertificate": true, +	"RTCDTMFToneChangeEvent": true, +	"RTCPeerConnection": true, +	"RTCIceCandidate": true, +	"RTCRtpReceiver": true, +	"RTCRtpSender": true, +	"RTCSessionDescription": true, +	"cat_vr": true, +	"VRStageParameters": true, +	"VRFrameData": true, +	"VRDisplay": true, +	"VRDisplayEvent": true, +	"VRFieldOfView": true, +	"VRDisplayCapabilities": true, +	"VREyeParameters": true, +	"VRPose": true, +	"cat_dom": true, +	"DOMStringMap": true, +	"DOMRectReadOnly": true, +	"DOMException": true, +	"DOMRect": true, +	"DOMMatrix": true, +	"DOMMatrixReadOnly": true, +	"DOMPointReadOnly": true, +	"DOMPoint": true, +	"DOMQuad": true, +	"DOMRequest": true, +	"DOMParser": true, +	"DOMTokenList": true, +	"DOMStringList": true, +	"DOMImplementation": true, +	"DOMError": true, +	"DOMRectList": true, +	"DOMCursor": true, +	"cat_idb": true, +	"IDBFileRequest": true, +	"IDBTransaction": true, +	"IDBCursor": true, +	"IDBFileHandle": true, +	"IDBMutableFile": true, +	"IDBKeyRange": true, +	"IDBVersionChangeEvent": true, +	"IDBObjectStore": true, +	"IDBFactory": true, +	"IDBCursorWithValue": true, +	"IDBOpenDBRequest": true, +	"IDBRequest": true, +	"IDBIndex": true, +	"IDBDatabase": true, +	"cat_audio": true, +	"AudioContext": true, +	"AudioBuffer": true, +	"AudioBufferSourceNode": true, +	"Audio": true, +	"MediaElementAudioSourceNode": true, +	"AudioNode": true, +	"BaseAudioContext": true, +	"AudioListener": true, +	"MediaStreamAudioSourceNode": true, +	"OfflineAudioContext": true, +	"AudioDestinationNode": true, +	"AudioParam": true, +	"MediaStreamAudioDestinationNode": true, +	"OfflineAudioCompletionEvent": true, +	"AudioStreamTrack": true, +	"AudioScheduledSourceNode": true, +	"AudioProcessingEvent": true, +	"cat_gamepad": true, +	"GamepadButton": true, +	"GamepadHapticActuator": true, +	"GamepadAxisMoveEvent": true, +	"GamepadPose": true, +	"GamepadEvent": true, +	"Gamepad": true, +	"GamepadButtonEvent": true, +	"cat_media": true, +	"MediaKeys": true, +	"MediaKeyError": true, +	"MediaSource": true, +	"MediaDevices": true, +	"MediaKeyStatusMap": true, +	"MediaStreamTrackEvent": true, +	"MediaRecorder": true, +	"MediaQueryListEvent": true, +	"MediaStream": true, +	"MediaEncryptedEvent": true, +	"MediaStreamTrack": true, +	"MediaError": true, +	"MediaStreamEvent": true, +	"MediaQueryList": true, +	"MediaKeySystemAccess": true, +	"MediaDeviceInfo": true, +	"MediaKeySession": true, +	"MediaList": true, +	"MediaRecorderErrorEvent": true, +	"MediaKeyMessageEvent": true, +	"cat_event2": true, +	"SpeechSynthesisErrorEvent": true, +	"BeforeUnloadEvent": true, +	"CustomEvent": true, +	"PageTransitionEvent": true, +	"PopupBlockedEvent": true, +	"CloseEvent": true, +	"ProgressEvent": true, +	"MutationEvent": true, +	"MessageEvent": true, +	"FocusEvent": true, +	"TrackEvent": true, +	"DeviceMotionEvent": true, +	"TimeEvent": true, +	"PointerEvent": true, +	"UserProximityEvent": true, +	"StorageEvent": true, +	"DragEvent": true, +	"MouseScrollEvent": true, +	"EventSource": true, +	"PopStateEvent": true, +	"DeviceProximityEvent": true, +	"SpeechSynthesisEvent": true, +	"XMLHttpRequestEventTarget": true, +	"ClipboardEvent": true, +	"AnimationPlaybackEvent": true, +	"DeviceLightEvent": true, +	"BlobEvent": true, +	"MouseEvent": true, +	"WheelEvent": true, +	"InputEvent": true, +	"HashChangeEvent": true, +	"DeviceOrientationEvent": true, +	"CompositionEvent": true, +	"KeyEvent": true, +	"ScrollAreaEvent": true, +	"KeyboardEvent": true, +	"TransitionEvent": true, +	"ErrorEvent": true, +	"AnimationEvent": true, +	"FontFaceSetLoadEvent": true, +	"EventTarget": true, +	"captureEvents": true, +	"releaseEvents": true, +	"Event": true, +	"UIEvent": true, +	"cat_other": false, +	"undefined": false, +	"Array": false, +	"Boolean": false, +	"JSON": false, +	"Date": false, +	"Math": false, +	"Number": false, +	"String": false, +	"RegExp": false, +	"Error": false, +	"InternalError": false, +	"EvalError": false, +	"RangeError": false, +	"ReferenceError": false, +	"SyntaxError": false, +	"TypeError": false, +	"URIError": false, +	"ArrayBuffer": true, +	"Int8Array": true, +	"Uint8Array": true, +	"Int16Array": true, +	"Uint16Array": true, +	"Int32Array": true, +	"Uint32Array": true, +	"Float32Array": true, +	"Float64Array": true, +	"Uint8ClampedArray": true, +	"Proxy": true, +	"WeakMap": true, +	"Map": true, +	"Set": true, +	"DataView": false, +	"Symbol": false, +	"SharedArrayBuffer": true, +	"Intl": false, +	"TypedObject": true, +	"Reflect": true, +	"SIMD": true, +	"WeakSet": true, +	"Atomics": true, +	"Promise": true, +	"WebAssembly": true, +	"NaN": false, +	"Infinity": false, +	"isNaN": false, +	"isFinite": false, +	"parseFloat": false, +	"parseInt": false, +	"escape": false, +	"unescape": false, +	"decodeURI": false, +	"encodeURI": false, +	"decodeURIComponent": false, +	"encodeURIComponent": false, +	"uneval": false, +	"BatteryManager": true, +	"CanvasGradient": true, +	"TextDecoder": true, +	"Plugin": true, +	"PushManager": true, +	"ChannelMergerNode": true, +	"PerformanceResourceTiming": true, +	"ServiceWorker": true, +	"TextTrackCueList": true, +	"PerformanceEntry": true, +	"TextTrackList": true, +	"StyleSheet": true, +	"PerformanceMeasure": true, +	"DesktopNotificationCenter": true, +	"Comment": true, +	"DelayNode": true, +	"XPathResult": true, +	"CDATASection": true, +	"MessageChannel": true, +	"BiquadFilterNode": true, +	"SpeechSynthesisUtterance": true, +	"Crypto": true, +	"Navigator": true, +	"FileList": true, +	"URLSearchParams": false, +	"ServiceWorkerContainer": true, +	"ValidityState": true, +	"ProcessingInstruction": true, +	"AbortSignal": true, +	"FontFace": true, +	"FileReader": true, +	"Worker": true, +	"External": true, +	"ImageBitmap": true, +	"TimeRanges": true, +	"Option": true, +	"TextTrack": true, +	"Image": true, +	"AnimationTimeline": true, +	"VideoPlaybackQuality": true, +	"VTTCue": true, +	"Storage": true, +	"XPathExpression": true, +	"CharacterData": false, +	"TextMetrics": true, +	"AnimationEffectReadOnly": true, +	"PerformanceTiming": false, +	"PerformanceMark": true, +	"ImageBitmapRenderingContext": true, +	"Headers": true, +	"Range": false, +	"Rect": true, +	"AnimationEffectTimingReadOnly": true, +	"KeyframeEffect": true, +	"Permissions": true, +	"TextEncoder": true, +	"ImageData": true, +	"SpeechSynthesisVoice": true, +	"StorageManager": true, +	"TextTrackCue": true, +	"WebSocket": true, +	"DocumentType": true, +	"XPathEvaluator": true, +	"PerformanceNavigationTiming": true, +	"IdleDeadline": true, +	"FileSystem": true, +	"FileSystemFileEntry": true, +	"CacheStorage": true, +	"MimeType": true, +	"PannerNode": true, +	"NodeFilter": true, +	"StereoPannerNode": true, +	"console": false, +	"DynamicsCompressorNode": true, +	"PaintRequest": true, +	"RGBColor": true, +	"FontFaceSet": false, +	"PaintRequestList": true, +	"FileSystemEntry": true, +	"XMLDocument": false, +	"SourceBuffer": false, +	"Screen": true, +	"NamedNodeMap": false, +	"History": true, +	"Response": true, +	"AnimationEffectTiming": true, +	"ServiceWorkerRegistration": true, +	"CanvasRenderingContext2D": true, +	"ScriptProcessorNode": true, +	"FileSystemDirectoryReader": true, +	"MimeTypeArray": true, +	"CanvasCaptureMediaStream": true, +	"Directory": true, +	"mozRTCPeerConnection": true, +	"PerformanceObserverEntryList": true, +	"PushSubscriptionOptions": true, +	"Text": false, +	"IntersectionObserverEntry": true, +	"SubtleCrypto": true, +	"Animation": true, +	"DataTransfer": true, +	"TreeWalker": true, +	"XMLHttpRequest": true, +	"LocalMediaStream": true, +	"ConvolverNode": true, +	"WaveShaperNode": true, +	"DataTransferItemList": false, +	"Request": true, +	"SourceBufferList": false, +	"XSLTProcessor": true, +	"XMLHttpRequestUpload": true, +	"SharedWorker": true, +	"Notification": false, +	"DataTransferItem": true, +	"AnalyserNode": true, +	"mozRTCIceCandidate": true, +	"PerformanceObserver": true, +	"OfflineResourceList": true, +	"FileSystemDirectoryEntry": true, +	"DesktopNotification": false, +	"DataChannel": true, +	"IIRFilterNode": true, +	"ChannelSplitterNode": true, +	"File": true, +	"ConstantSourceNode": true, +	"CryptoKey": true, +	"GainNode": true, +	"AbortController": true, +	"Attr": true, +	"SpeechSynthesis": true, +	"PushSubscription": false, +	"XMLStylesheetProcessingInstruction": false, +	"NodeIterator": true, +	"VideoStreamTrack": true, +	"XMLSerializer": true, +	"CaretPosition": true, +	"FormData": true, +	"CanvasPattern": true, +	"mozRTCSessionDescription": true, +	"Path2D": true, +	"PerformanceNavigation": true, +	"URL": false, +	"PluginArray": true, +	"MutationRecord": true, +	"WebKitCSSMatrix": true, +	"PeriodicWave": true, +	"DocumentFragment": true, +	"DocumentTimeline": false, +	"ScreenOrientation": true, +	"BroadcastChannel": true, +	"PermissionStatus": true, +	"IntersectionObserver": true, +	"Blob": true, +	"MessagePort": true, +	"BarProp": true, +	"OscillatorNode": true, +	"Cache": true, +	"RadioNodeList": true, +	"KeyframeEffectReadOnly": true, +	"InstallTrigger": true, +	"Function": false, +	"Object": false, +	"eval": true, +	"Window": false, +	"close": false, +	"stop": false, +	"focus": false, +	"blur": false, +	"open": true, +	"alert": false, +	"confirm": false, +	"prompt": false, +	"print": false, +	"postMessage": true, +	"getSelection": true, +	"getComputedStyle": true, +	"matchMedia": true, +	"moveTo": false, +	"moveBy": false, +	"resizeTo": false, +	"resizeBy": false, +	"scroll": false, +	"scrollTo": false, +	"scrollBy": false, +	"requestAnimationFrame": true, +	"cancelAnimationFrame": true, +	"getDefaultComputedStyle": false, +	"scrollByLines": false, +	"scrollByPages": false, +	"sizeToContent": false, +	"updateCommands": true, +	"find": false, +	"dump": true, +	"setResizable": false, +	"requestIdleCallback": false, +	"cancelIdleCallback": false, +	"btoa": true, +	"atob": true, +	"setTimeout": true, +	"clearTimeout": true, +	"setInterval": true, +	"clearInterval": true, +	"createImageBitmap": true, +	"fetch": true, +	"self": true, +	"name": false, +	"history": true, +	"locationbar": true, +	"menubar": true, +	"personalbar": true, +	"scrollbars": true, +	"statusbar": true, +	"toolbar": true, +	"status": true, +	"closed": true, +	"frames": true, +	"length": false, +	"opener": true, +	"parent": true, +	"frameElement": true, +	"navigator": true, +	"external": true, +	"applicationCache": true, +	"screen": true, +	"innerWidth": true, +	"innerHeight": true, +	"scrollX": true, +	"pageXOffset": true, +	"scrollY": true, +	"pageYOffset": true, +	"screenX": true, +	"screenY": true, +	"outerWidth": true, +	"outerHeight": true, +	"performance": true, +	"mozInnerScreenX": true, +	"mozInnerScreenY": true, +	"devicePixelRatio": true, +	"scrollMaxX": true, +	"scrollMaxY": true, +	"fullScreen": false, +	"mozPaintCount": true, +	"sidebar": false, +	"crypto": true, +	"speechSynthesis": true, +	"localStorage": true, +	"origin": true, +	"isSecureContext": false, +	"indexedDB": true, +	"caches": true, +	"sessionStorage": true, +	"window": false, +	"document": true, +	"location": false, +	"top": true, +	"netscape": true, +	"Node": true, +	"Document": true, +	"Performance": false, +	"startProfiling": true, +	"stopProfiling": true, +	"pauseProfilers": true, +	"resumeProfilers": true, +	"dumpProfile": true, +	"getMaxGCPauseSinceClear": true, +	"clearMaxGCPauseAccumulator": true, +	"Location": true, +	"StyleSheetList": false, +	"Selection": false, +	"Element": true, +	"AnonymousContent": false, +	"MutationObserver": true, +	"NodeList": true, +	"StopIteration": true +};  // "The number of conditionals and loops must be at most 5"   var loops = ["ForInStatement","ForStatement","DoWhileStatement","WhileStatement","IfStatement","SwitchStatement"]; -  /** -*	Rigorously determines if code is trivial or not based on the official triviality criterion  +*	Loop over a function and get a list of things being called. +* +*	Tests to see if the function calls itself. +*	 +*	Note: If it is an anonmyous function, recursion isn't possible. +*  */ -function full_evaluate(script){ -	var ast = acorn.parse_dammit(script); -	 -	var amtloops = 0; -	var conditionals = 0; +function get_function_names(input_node_src,scope){ +	var func_name = "";  	var flag = true; - -	console.log(ast); - -	return true; +	// The name of the function can't appear anywhere. +	// No bracket suffix notation either. +	console.log("Searching for identifier '"+scope+"' in this code:"); +	//console.log(input_node_src); -	walk.full(ast, node => { -		if(flag){ -			if(node.type != "Literal"){ -				console.log("%c"+node.type+":","color:purple;"); -				console.log(script.substring(node["start"],node["end"])); -			} +	var tokens = acorn_base.tokenizer(input_node_src); +	var toke = tokens.getToken(); +	while(toke.type != acorn_base.tokTypes.eof){ +		if(toke.type.label == "name" && scope == toke.value){ +			return true; +		} +		toke = tokens.getToken(); +	} -			// Pretty sure this is bracket suffix notation -			if(node.type == "MemberExpression"){ -				console.log("%c NONTRIVIAL: Bracket suffix notation.","color:red"); -				flag = false;				 -			} +	return false; +} +/** +*	Reads fname_data to determine if a function call is trivial +* +*/ +function test_function_name(name){ +	var res = fname_data[name]; +	if(res == false){ +		console.log("'"+name+"'"+" is trivial.");	 +		return false; +	} +	if(res == true){ +		console.log("%cNONTRIVIAL:'"+name+"'"+" is non-trivial.","color:red");	 +		return true;	 +	} +	console.log("%cNONTRIVIAL:'"+name+"'"+" is probably user defined.","color:red");	 +	return false; -			// This is the beginning of some "object chain" -			if(node.type == "ExpressionStatement"){ -				 -			} +} +/** +*	Rigorously determines if code is trivial or not based on the official triviality criterion  +*/ +function full_evaluate(script){ +	var res = true;		 -			if(node.arguments !== undefined){ -				console.log("%cCalls function:","color:white"); -				script.substring(node.start,node.end) -			} +	if(script === undefined || script == ""){ +		return true; +	} +	var ast = acorn.parse_dammit(script).body[0]; -			// "It does not declare an array more than 50 elements long." -			// (what about dictionaries?) -			if(node.type == "ArrayExpression"){ +	var flag = false; +	var amtloops = 0; -				var len = 0; -			 -				try{ -					var temp = script.substring(node["start"],node["end"]); -					len = JSON.parse(temp).length; -				} catch(e){ -					console.warn("Invalid array?"); -					len = 99; -				} -			 -				if(len > 50){ -					console.log("%c NONTRIVIAL: Array longer than 50 elements. ("+len+")","color:red"); -					flag = false; -				} +	// COUNTS LOOPS AND CONDITIONALS +	walk.simple(ast, { +		ForInStatement(node){ +			if(amtloops > 3){return;}				 +			amtloops++; +		}, +		ForStatement(node){ +			if(amtloops > 3){return;} +			amtloops++; +		}, +		DoWhileStatement(node){ +			if(amtloops > 3){return;} +			amtloops++; +		}, +		WhileStatement(node){ +			if(amtloops > 3){return;} +			amtloops++; +		}, +		IfStatement(node){ +			if(amtloops > 3){return;} +			amtloops++; +		}, +		SwitchStatement(node){ +			if(amtloops > 3){return;} +			amtloops++; +		} +	}); -			} +	if(amtloops > 3){ +		console.log("%c NONTRIVIAL: Too many loops/conditionals.","color:red"); +		return false; +	} +	// Detect which objects are referenced and which functions are called +	// Only cares about top level objects. Window is special because we will test its methods. +	var nontrivial = false; -			// "The number of conditionals and loops must be at most 3." -			for(var i = 0; i < loops.length; i++){ -				if(node.type == loops[i]){ -					amtloops++; +	walk.simple(ast, { +		ExpressionStatement(node){ +			if(nontrivial == true){ +				return; +			} +			// Get the first thing in the expression	 +			if(node === undefined){ +				return; +			}			 +			var lnode = node.expression;				 +			var last_name = ""; +			while(true){ +				// window.test() +				if(lnode.type == "CallExpression"){ +					if(lnode.property !== undefined){ +						last_name = lnode.property.name;	 +					} +					lnode = lnode.callee; +				// window.test +				}else if(lnode.type == "MemberExpression"){ +					last_name = lnode.property.name; +					// This may be bracket suffix notation +					lnode = lnode.object;			 +				// We should be at the first in the chain.		 +				}else if(lnode.type == "Identifier"){ +					// Since window is the global object, it is special +					if(lnode.name == "window"){ +						nontrivial = test_function_name(last_name); +						break; +					} else{ +						nontrivial = test_function_name(lnode.name); +						break; +					} +				}else if(lnode.type == "BinaryExpression"){ +					// This actually might not be valid. It can't be anything nontrivial. +					console.log("%c Warn: syntax not valid","color:Red;") +					break; +				} else{ +					console.log("Unrecognized: "+lnode.type);  					break;  				} +				//console.log(last_name+":"+lnode.name);  			} - -			if(amtloops > 3){ -				console.log("%c NONTRIVIAL: Too many loops/conditionals.","color:red"); -				flag = false; -			} -  		}  	}); -	if(flag == true){ -		console.log("%cScript is trivial.","color:green"); -	}	 - -	return flag; - +	if(nontrivial == true){ +		return false; +	} +	return res;  } -//full_evaluate("if(true){}if(true){}if(true){}if(true){}"); -//full_evaluate("var test  =[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50];"); -var test = 'object[test];'; -full_evaluate(test); -full_evaluate('object.test.method["something"];');  /**  *	Performs the initial pass on code to see if it needs to be completely parsed  */ @@ -875,6 +1752,9 @@ function evaluate(script,name){  	}  	return [flag,reason+"<br>"];  } + + +  function license_valid(matches){  	if(matches.length != 4){  		return [false, "malformed or unrecognized license tag"]; diff --git a/nontriv.html b/nontriv.html index 53134a2..aaf49ba 100644 --- a/nontriv.html +++ b/nontriv.html @@ -7,21 +7,80 @@  <script>  window.onload = function (){  	var s = Object.getOwnPropertyNames(window); + +	var kids = document.getElementById("categories").children; +	for(var i = 0; i < kids.length; i++){ +		var checkbox = "<input name='opt' id='cat_"+kids[i].id+"' type='checkbox'></input>"; +		kids[i].insertAdjacentHTML("beforeend",checkbox+"Check entire category\n"); +		document.getElementById("cat_"+kids[i].id).addEventListener("click",function(){ +			var nontriv = document.getElementById(this.id.substring(4,this.id.length)); +			for(var j = 0; j < nontriv.children.length; j++){ +				if(this.checked){ +					nontriv.children[j].checked = true; +				} else{ +					nontriv.children[j].checked = false; +				} +			}		 +		}); +	} +  	for(var i = 0; i < s.length; i++){  		var checkbox = "<input name='opt' id='"+s[i]+"' type='checkbox'></input>";	 -		document.getElementById("input").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); + +		if(s[i].indexOf("HTML") == 0){ +			document.getElementById("html").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("CSS") == 0){ +			document.getElementById("css").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("SVG") == 0){ +			document.getElementById("svg").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("on") == 0){ +			document.getElementById("event").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("RTC") == 0){ +			document.getElementById("rtc").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("HTML") == 0){ +			document.getElementById("html").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("VR") == 0){ +			document.getElementById("vr").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("WebGL") == 0){ +			document.getElementById("webgl").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("DOM") == 0){ +			document.getElementById("dom").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("IDB") == 0){ +			document.getElementById("idb").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("Audio") != -1){ +			document.getElementById("audio").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("Gamepad") == 0){ +			document.getElementById("gamepad").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("Media") == 0){ +			document.getElementById("media").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else if(s[i].indexOf("Event") != -1){ +			document.getElementById("event2").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}else{ +			document.getElementById("other").insertAdjacentHTML("beforeend",checkbox + s[i] + "\n"); +		}  	} +  	document.getElementById("gen").addEventListener("click",function(){  		var temp = document.getElementsByName("opt");  		var outputjson = {}; -		for(var i = 0; i < temp.length; i++){ -			if(temp[i].checked){ -				outputjson[temp[i].id] = "non-trivial"; -			}else{ -				outputjson[temp[i].id] = "trivial"; +		for(var i = 1; i < temp.length; i++){ +			outputjson[temp[i].id] = temp[i].checked; +		} +		document.getElementById("output").innerHTML = JSON.stringify(outputjson, null, '\t'); +	}); +	document.getElementById("read").addEventListener("click",function(){ +		var inputjson = JSON.parse(document.getElementById("injson").value); +		console.log(inputjson); +		var keys = Object.keys(inputjson); +		for(var i = 0; i < keys.length; i++){ +			console.log(inputjson[keys[i]]); +			if(inputjson[keys[i]] == true){ +				document.getElementById(keys[i]).checked = true; +			} else{ +				document.getElementById(keys[i]).checked = false;  			}  		} -		document.getElementById("output").innerHTML = JSON.stringify(outputjson); +		return;  	});  }  </script> @@ -32,11 +91,45 @@ This page allows us to generate the allowed/disallowed object JSON.  We know it's up to date because it iterates over all keys of the window variable (which is the global object for browsers)  <br>  <br> -(Checked = nontrivial) +(True = nontrivial, false = trivial)  <br><br><br> +<textarea id="injson" rows="4" cols="50"></textarea>  +<br> +<input id="read" type="button" value="Load JSON"></input> +<br>  <input id="gen" type="button" value="Generate"></input>  <br>  <pre id="output"></pre> -<pre id="input"></pre> +<div id="categories"> + +<pre id="webgl">WebGL +</pre> +<pre id="svg">SVG +</pre> +<pre id="html">HTML +</pre> +<pre id="css">CSS +</pre> +<pre id="event">Events +</pre> +<pre id="rtc">WebRTC +</pre> +<pre id="vr">VR +</pre> +<pre id="dom">DOM +</pre> +<pre id="idb">IDB +</pre> +<pre id="audio">Audio +</pre> +<pre id="gamepad">Gamepad +</pre> +<pre id="media">Media +</pre> +<pre id="event2">Other events +</pre> +<pre id="other">All else +</pre> +</div>  </body> @@ -2,9 +2,839 @@ var acorn = require('acorn/dist/acorn_loose');  var walk = require("acorn/dist/walk");  var acorn_base = require("acorn"); +var fname_data = { +	"WebGLShader": true, +	"WebGLShaderPrecisionFormat": true, +	"WebGLQuery": true, +	"WebGLRenderbuffer": true, +	"WebGLSampler": true, +	"WebGLUniformLocation": true, +	"WebGLFramebuffer": true, +	"WebGLProgram": true, +	"WebGLContextEvent": true, +	"WebGL2RenderingContext": true, +	"WebGLTexture": true, +	"WebGLRenderingContext": true, +	"WebGLVertexArrayObject": true, +	"WebGLActiveInfo": true, +	"WebGLTransformFeedback": true, +	"WebGLSync": true, +	"WebGLBuffer": true, +	"cat_svg": true, +	"SVGPoint": true, +	"SVGEllipseElement": true, +	"SVGRadialGradientElement": true, +	"SVGComponentTransferFunctionElement": true, +	"SVGPathSegCurvetoQuadraticAbs": true, +	"SVGAnimatedNumberList": true, +	"SVGPathSegCurvetoQuadraticSmoothRel": true, +	"SVGFEColorMatrixElement": true, +	"SVGPathSegLinetoHorizontalAbs": true, +	"SVGLinearGradientElement": true, +	"SVGStyleElement": true, +	"SVGPathSegMovetoRel": true, +	"SVGStopElement": true, +	"SVGPathSegLinetoRel": true, +	"SVGFEConvolveMatrixElement": true, +	"SVGAnimatedAngle": true, +	"SVGPathSegLinetoAbs": true, +	"SVGPreserveAspectRatio": true, +	"SVGFEOffsetElement": true, +	"SVGFEImageElement": true, +	"SVGFEDiffuseLightingElement": true, +	"SVGAnimatedNumber": true, +	"SVGTextElement": true, +	"SVGFESpotLightElement": true, +	"SVGFEMorphologyElement": true, +	"SVGAngle": true, +	"SVGScriptElement": true, +	"SVGFEDropShadowElement": true, +	"SVGPathSegArcRel": true, +	"SVGNumber": true, +	"SVGPathSegLinetoHorizontalRel": true, +	"SVGFEFuncBElement": true, +	"SVGClipPathElement": true, +	"SVGPathSeg": true, +	"SVGUseElement": true, +	"SVGPathSegArcAbs": true, +	"SVGPathSegCurvetoQuadraticSmoothAbs": true, +	"SVGRect": true, +	"SVGAnimatedPreserveAspectRatio": true, +	"SVGImageElement": true, +	"SVGAnimatedEnumeration": true, +	"SVGAnimatedLengthList": true, +	"SVGFEFloodElement": true, +	"SVGFECompositeElement": true, +	"SVGAElement": true, +	"SVGAnimatedBoolean": true, +	"SVGMaskElement": true, +	"SVGFilterElement": true, +	"SVGPathSegLinetoVerticalRel": true, +	"SVGAnimatedInteger": true, +	"SVGTSpanElement": true, +	"SVGMarkerElement": true, +	"SVGStringList": true, +	"SVGTransform": true, +	"SVGTitleElement": true, +	"SVGFEBlendElement": true, +	"SVGTextPositioningElement": true, +	"SVGFEFuncGElement": true, +	"SVGFEPointLightElement": true, +	"SVGAnimateElement": true, +	"SVGPolylineElement": true, +	"SVGDefsElement": true, +	"SVGPathSegList": true, +	"SVGAnimatedTransformList": true, +	"SVGPathSegClosePath": true, +	"SVGGradientElement": true, +	"SVGSwitchElement": true, +	"SVGViewElement": true, +	"SVGUnitTypes": true, +	"SVGPathSegMovetoAbs": true, +	"SVGSymbolElement": true, +	"SVGFEFuncAElement": true, +	"SVGAnimatedString": true, +	"SVGFEMergeElement": true, +	"SVGPathSegLinetoVerticalAbs": true, +	"SVGAnimationElement": true, +	"SVGPathSegCurvetoCubicAbs": true, +	"SVGLength": true, +	"SVGTextPathElement": true, +	"SVGPolygonElement": true, +	"SVGAnimatedRect": true, +	"SVGPathSegCurvetoCubicRel": true, +	"SVGFEFuncRElement": true, +	"SVGLengthList": true, +	"SVGTextContentElement": true, +	"SVGFETurbulenceElement": true, +	"SVGMatrix": true, +	"SVGZoomAndPan": true, +	"SVGMetadataElement": true, +	"SVGFEDistantLightElement": true, +	"SVGAnimateMotionElement": true, +	"SVGDescElement": true, +	"SVGPathSegCurvetoCubicSmoothRel": true, +	"SVGFESpecularLightingElement": true, +	"SVGFEGaussianBlurElement": true, +	"SVGFEComponentTransferElement": true, +	"SVGNumberList": true, +	"SVGTransformList": true, +	"SVGForeignObjectElement": true, +	"SVGRectElement": true, +	"SVGFEDisplacementMapElement": true, +	"SVGAnimateTransformElement": true, +	"SVGAnimatedLength": true, +	"SVGPointList": true, +	"SVGPatternElement": true, +	"SVGPathSegCurvetoCubicSmoothAbs": true, +	"SVGCircleElement": true, +	"SVGSetElement": true, +	"SVGFETileElement": true, +	"SVGMPathElement": true, +	"SVGFEMergeNodeElement": true, +	"SVGPathSegCurvetoQuadraticRel": true, +	"SVGElement": true, +	"SVGGraphicsElement": true, +	"SVGSVGElement": true, +	"SVGGElement": true, +	"SVGGeometryElement": true, +	"SVGPathElement": true, +	"SVGLineElement": true, +	"cat_html": true, +	"HTMLTimeElement": true, +	"HTMLPictureElement": true, +	"HTMLMenuItemElement": true, +	"HTMLFormElement": true, +	"HTMLOptionElement": true, +	"HTMLCanvasElement": true, +	"HTMLTableSectionElement": true, +	"HTMLSelectElement": true, +	"HTMLUListElement": true, +	"HTMLMetaElement": true, +	"HTMLLinkElement": true, +	"HTMLBaseElement": true, +	"HTMLDataListElement": true, +	"HTMLInputElement": true, +	"HTMLMeterElement": true, +	"HTMLSourceElement": true, +	"HTMLTrackElement": true, +	"HTMLTableColElement": true, +	"HTMLFieldSetElement": true, +	"HTMLDirectoryElement": true, +	"HTMLTableCellElement": true, +	"HTMLStyleElement": true, +	"HTMLAudioElement": true, +	"HTMLLegendElement": true, +	"HTMLOListElement": true, +	"HTMLEmbedElement": true, +	"HTMLQuoteElement": true, +	"HTMLMenuElement": true, +	"HTMLHeadElement": true, +	"HTMLUnknownElement": true, +	"HTMLBRElement": true, +	"HTMLProgressElement": true, +	"HTMLMediaElement": true, +	"HTMLFormControlsCollection": true, +	"HTMLCollection": true, +	"HTMLLIElement": true, +	"HTMLDetailsElement": true, +	"HTMLObjectElement": true, +	"HTMLHeadingElement": true, +	"HTMLTableCaptionElement": true, +	"HTMLPreElement": true, +	"HTMLAllCollection": true, +	"HTMLFrameSetElement": true, +	"HTMLFontElement": true, +	"HTMLFrameElement": true, +	"HTMLAnchorElement": true, +	"HTMLOptGroupElement": true, +	"HTMLVideoElement": true, +	"HTMLModElement": true, +	"HTMLBodyElement": true, +	"HTMLTableElement": true, +	"HTMLButtonElement": true, +	"HTMLTableRowElement": true, +	"HTMLAreaElement": true, +	"HTMLDataElement": true, +	"HTMLParamElement": true, +	"HTMLLabelElement": true, +	"HTMLTemplateElement": true, +	"HTMLOptionsCollection": true, +	"HTMLIFrameElement": true, +	"HTMLTitleElement": true, +	"HTMLMapElement": true, +	"HTMLOutputElement": true, +	"HTMLDListElement": true, +	"HTMLParagraphElement": true, +	"HTMLHRElement": true, +	"HTMLImageElement": true, +	"HTMLDocument": true, +	"HTMLElement": true, +	"HTMLScriptElement": true, +	"HTMLHtmlElement": true, +	"HTMLTextAreaElement": true, +	"HTMLDivElement": true, +	"HTMLSpanElement": true, +	"cat_css": true, +	"CSSStyleRule": true, +	"CSSFontFaceRule": true, +	"CSSPrimitiveValue": true, +	"CSSStyleDeclaration": true, +	"CSSStyleSheet": true, +	"CSSPageRule": true, +	"CSSSupportsRule": true, +	"CSSMozDocumentRule": true, +	"CSSKeyframeRule": true, +	"CSSGroupingRule": true, +	"CSS2Properties": true, +	"CSSFontFeatureValuesRule": true, +	"CSSRuleList": true, +	"CSSPseudoElement": true, +	"CSSMediaRule": true, +	"CSSCounterStyleRule": true, +	"CSSImportRule": true, +	"CSSTransition": true, +	"CSSAnimation": true, +	"CSSValue": true, +	"CSSNamespaceRule": true, +	"CSSRule": true, +	"CSS": true, +	"CSSKeyframesRule": true, +	"CSSConditionRule": true, +	"CSSValueList": true, +	"cat_event": true, +	"ondevicemotion": true, +	"ondeviceorientation": true, +	"onabsolutedeviceorientation": true, +	"ondeviceproximity": true, +	"onuserproximity": true, +	"ondevicelight": true, +	"onvrdisplayconnect": true, +	"onvrdisplaydisconnect": true, +	"onvrdisplayactivate": true, +	"onvrdisplaydeactivate": true, +	"onvrdisplaypresentchange": true, +	"onabort": true, +	"onblur": true, +	"onfocus": true, +	"onauxclick": true, +	"oncanplay": true, +	"oncanplaythrough": true, +	"onchange": true, +	"onclick": true, +	"onclose": true, +	"oncontextmenu": true, +	"ondblclick": true, +	"ondrag": true, +	"ondragend": true, +	"ondragenter": true, +	"ondragexit": true, +	"ondragleave": true, +	"ondragover": true, +	"ondragstart": true, +	"ondrop": true, +	"ondurationchange": true, +	"onemptied": true, +	"onended": true, +	"oninput": true, +	"oninvalid": true, +	"onkeydown": true, +	"onkeypress": true, +	"onkeyup": true, +	"onload": true, +	"onloadeddata": true, +	"onloadedmetadata": true, +	"onloadend": true, +	"onloadstart": true, +	"onmousedown": true, +	"onmouseenter": true, +	"onmouseleave": true, +	"onmousemove": true, +	"onmouseout": true, +	"onmouseover": true, +	"onmouseup": true, +	"onwheel": true, +	"onpause": true, +	"onplay": true, +	"onplaying": true, +	"onprogress": true, +	"onratechange": true, +	"onreset": true, +	"onresize": true, +	"onscroll": true, +	"onseeked": true, +	"onseeking": true, +	"onselect": true, +	"onshow": true, +	"onstalled": true, +	"onsubmit": true, +	"onsuspend": true, +	"ontimeupdate": true, +	"onvolumechange": true, +	"onwaiting": true, +	"onselectstart": true, +	"ontoggle": true, +	"onpointercancel": true, +	"onpointerdown": true, +	"onpointerup": true, +	"onpointermove": true, +	"onpointerout": true, +	"onpointerover": true, +	"onpointerenter": true, +	"onpointerleave": true, +	"ongotpointercapture": true, +	"onlostpointercapture": true, +	"onmozfullscreenchange": true, +	"onmozfullscreenerror": true, +	"onanimationcancel": true, +	"onanimationend": true, +	"onanimationiteration": true, +	"onanimationstart": true, +	"ontransitioncancel": true, +	"ontransitionend": true, +	"ontransitionrun": true, +	"ontransitionstart": true, +	"onwebkitanimationend": true, +	"onwebkitanimationiteration": true, +	"onwebkitanimationstart": true, +	"onwebkittransitionend": true, +	"onerror": true, +	"onafterprint": true, +	"onbeforeprint": true, +	"onbeforeunload": true, +	"onhashchange": true, +	"onlanguagechange": true, +	"onmessage": true, +	"onmessageerror": true, +	"onoffline": true, +	"ononline": true, +	"onpagehide": true, +	"onpageshow": true, +	"onpopstate": true, +	"onstorage": true, +	"onunload": true, +	"cat_rtc": true, +	"RTCDTMFSender": true, +	"RTCStatsReport": true, +	"RTCTrackEvent": true, +	"RTCDataChannelEvent": true, +	"RTCPeerConnectionIceEvent": true, +	"RTCCertificate": true, +	"RTCDTMFToneChangeEvent": true, +	"RTCPeerConnection": true, +	"RTCIceCandidate": true, +	"RTCRtpReceiver": true, +	"RTCRtpSender": true, +	"RTCSessionDescription": true, +	"cat_vr": true, +	"VRStageParameters": true, +	"VRFrameData": true, +	"VRDisplay": true, +	"VRDisplayEvent": true, +	"VRFieldOfView": true, +	"VRDisplayCapabilities": true, +	"VREyeParameters": true, +	"VRPose": true, +	"cat_dom": true, +	"DOMStringMap": true, +	"DOMRectReadOnly": true, +	"DOMException": true, +	"DOMRect": true, +	"DOMMatrix": true, +	"DOMMatrixReadOnly": true, +	"DOMPointReadOnly": true, +	"DOMPoint": true, +	"DOMQuad": true, +	"DOMRequest": true, +	"DOMParser": true, +	"DOMTokenList": true, +	"DOMStringList": true, +	"DOMImplementation": true, +	"DOMError": true, +	"DOMRectList": true, +	"DOMCursor": true, +	"cat_idb": true, +	"IDBFileRequest": true, +	"IDBTransaction": true, +	"IDBCursor": true, +	"IDBFileHandle": true, +	"IDBMutableFile": true, +	"IDBKeyRange": true, +	"IDBVersionChangeEvent": true, +	"IDBObjectStore": true, +	"IDBFactory": true, +	"IDBCursorWithValue": true, +	"IDBOpenDBRequest": true, +	"IDBRequest": true, +	"IDBIndex": true, +	"IDBDatabase": true, +	"cat_audio": true, +	"AudioContext": true, +	"AudioBuffer": true, +	"AudioBufferSourceNode": true, +	"Audio": true, +	"MediaElementAudioSourceNode": true, +	"AudioNode": true, +	"BaseAudioContext": true, +	"AudioListener": true, +	"MediaStreamAudioSourceNode": true, +	"OfflineAudioContext": true, +	"AudioDestinationNode": true, +	"AudioParam": true, +	"MediaStreamAudioDestinationNode": true, +	"OfflineAudioCompletionEvent": true, +	"AudioStreamTrack": true, +	"AudioScheduledSourceNode": true, +	"AudioProcessingEvent": true, +	"cat_gamepad": true, +	"GamepadButton": true, +	"GamepadHapticActuator": true, +	"GamepadAxisMoveEvent": true, +	"GamepadPose": true, +	"GamepadEvent": true, +	"Gamepad": true, +	"GamepadButtonEvent": true, +	"cat_media": true, +	"MediaKeys": true, +	"MediaKeyError": true, +	"MediaSource": true, +	"MediaDevices": true, +	"MediaKeyStatusMap": true, +	"MediaStreamTrackEvent": true, +	"MediaRecorder": true, +	"MediaQueryListEvent": true, +	"MediaStream": true, +	"MediaEncryptedEvent": true, +	"MediaStreamTrack": true, +	"MediaError": true, +	"MediaStreamEvent": true, +	"MediaQueryList": true, +	"MediaKeySystemAccess": true, +	"MediaDeviceInfo": true, +	"MediaKeySession": true, +	"MediaList": true, +	"MediaRecorderErrorEvent": true, +	"MediaKeyMessageEvent": true, +	"cat_event2": true, +	"SpeechSynthesisErrorEvent": true, +	"BeforeUnloadEvent": true, +	"CustomEvent": true, +	"PageTransitionEvent": true, +	"PopupBlockedEvent": true, +	"CloseEvent": true, +	"ProgressEvent": true, +	"MutationEvent": true, +	"MessageEvent": true, +	"FocusEvent": true, +	"TrackEvent": true, +	"DeviceMotionEvent": true, +	"TimeEvent": true, +	"PointerEvent": true, +	"UserProximityEvent": true, +	"StorageEvent": true, +	"DragEvent": true, +	"MouseScrollEvent": true, +	"EventSource": true, +	"PopStateEvent": true, +	"DeviceProximityEvent": true, +	"SpeechSynthesisEvent": true, +	"XMLHttpRequestEventTarget": true, +	"ClipboardEvent": true, +	"AnimationPlaybackEvent": true, +	"DeviceLightEvent": true, +	"BlobEvent": true, +	"MouseEvent": true, +	"WheelEvent": true, +	"InputEvent": true, +	"HashChangeEvent": true, +	"DeviceOrientationEvent": true, +	"CompositionEvent": true, +	"KeyEvent": true, +	"ScrollAreaEvent": true, +	"KeyboardEvent": true, +	"TransitionEvent": true, +	"ErrorEvent": true, +	"AnimationEvent": true, +	"FontFaceSetLoadEvent": true, +	"EventTarget": true, +	"captureEvents": true, +	"releaseEvents": true, +	"Event": true, +	"UIEvent": true, +	"cat_other": false, +	"undefined": false, +	"Array": false, +	"Boolean": false, +	"JSON": false, +	"Date": false, +	"Math": false, +	"Number": false, +	"String": false, +	"RegExp": false, +	"Error": false, +	"InternalError": false, +	"EvalError": false, +	"RangeError": false, +	"ReferenceError": false, +	"SyntaxError": false, +	"TypeError": false, +	"URIError": false, +	"ArrayBuffer": true, +	"Int8Array": true, +	"Uint8Array": true, +	"Int16Array": true, +	"Uint16Array": true, +	"Int32Array": true, +	"Uint32Array": true, +	"Float32Array": true, +	"Float64Array": true, +	"Uint8ClampedArray": true, +	"Proxy": true, +	"WeakMap": true, +	"Map": true, +	"Set": true, +	"DataView": false, +	"Symbol": false, +	"SharedArrayBuffer": true, +	"Intl": false, +	"TypedObject": true, +	"Reflect": true, +	"SIMD": true, +	"WeakSet": true, +	"Atomics": true, +	"Promise": true, +	"WebAssembly": true, +	"NaN": false, +	"Infinity": false, +	"isNaN": false, +	"isFinite": false, +	"parseFloat": false, +	"parseInt": false, +	"escape": false, +	"unescape": false, +	"decodeURI": false, +	"encodeURI": false, +	"decodeURIComponent": false, +	"encodeURIComponent": false, +	"uneval": false, +	"BatteryManager": true, +	"CanvasGradient": true, +	"TextDecoder": true, +	"Plugin": true, +	"PushManager": true, +	"ChannelMergerNode": true, +	"PerformanceResourceTiming": true, +	"ServiceWorker": true, +	"TextTrackCueList": true, +	"PerformanceEntry": true, +	"TextTrackList": true, +	"StyleSheet": true, +	"PerformanceMeasure": true, +	"DesktopNotificationCenter": true, +	"Comment": true, +	"DelayNode": true, +	"XPathResult": true, +	"CDATASection": true, +	"MessageChannel": true, +	"BiquadFilterNode": true, +	"SpeechSynthesisUtterance": true, +	"Crypto": true, +	"Navigator": true, +	"FileList": true, +	"URLSearchParams": false, +	"ServiceWorkerContainer": true, +	"ValidityState": true, +	"ProcessingInstruction": true, +	"AbortSignal": true, +	"FontFace": true, +	"FileReader": true, +	"Worker": true, +	"External": true, +	"ImageBitmap": true, +	"TimeRanges": true, +	"Option": true, +	"TextTrack": true, +	"Image": true, +	"AnimationTimeline": true, +	"VideoPlaybackQuality": true, +	"VTTCue": true, +	"Storage": true, +	"XPathExpression": true, +	"CharacterData": false, +	"TextMetrics": true, +	"AnimationEffectReadOnly": true, +	"PerformanceTiming": false, +	"PerformanceMark": true, +	"ImageBitmapRenderingContext": true, +	"Headers": true, +	"Range": false, +	"Rect": true, +	"AnimationEffectTimingReadOnly": true, +	"KeyframeEffect": true, +	"Permissions": true, +	"TextEncoder": true, +	"ImageData": true, +	"SpeechSynthesisVoice": true, +	"StorageManager": true, +	"TextTrackCue": true, +	"WebSocket": true, +	"DocumentType": true, +	"XPathEvaluator": true, +	"PerformanceNavigationTiming": true, +	"IdleDeadline": true, +	"FileSystem": true, +	"FileSystemFileEntry": true, +	"CacheStorage": true, +	"MimeType": true, +	"PannerNode": true, +	"NodeFilter": true, +	"StereoPannerNode": true, +	"console": false, +	"DynamicsCompressorNode": true, +	"PaintRequest": true, +	"RGBColor": true, +	"FontFaceSet": false, +	"PaintRequestList": true, +	"FileSystemEntry": true, +	"XMLDocument": false, +	"SourceBuffer": false, +	"Screen": true, +	"NamedNodeMap": false, +	"History": true, +	"Response": true, +	"AnimationEffectTiming": true, +	"ServiceWorkerRegistration": true, +	"CanvasRenderingContext2D": true, +	"ScriptProcessorNode": true, +	"FileSystemDirectoryReader": true, +	"MimeTypeArray": true, +	"CanvasCaptureMediaStream": true, +	"Directory": true, +	"mozRTCPeerConnection": true, +	"PerformanceObserverEntryList": true, +	"PushSubscriptionOptions": true, +	"Text": false, +	"IntersectionObserverEntry": true, +	"SubtleCrypto": true, +	"Animation": true, +	"DataTransfer": true, +	"TreeWalker": true, +	"XMLHttpRequest": true, +	"LocalMediaStream": true, +	"ConvolverNode": true, +	"WaveShaperNode": true, +	"DataTransferItemList": false, +	"Request": true, +	"SourceBufferList": false, +	"XSLTProcessor": true, +	"XMLHttpRequestUpload": true, +	"SharedWorker": true, +	"Notification": false, +	"DataTransferItem": true, +	"AnalyserNode": true, +	"mozRTCIceCandidate": true, +	"PerformanceObserver": true, +	"OfflineResourceList": true, +	"FileSystemDirectoryEntry": true, +	"DesktopNotification": false, +	"DataChannel": true, +	"IIRFilterNode": true, +	"ChannelSplitterNode": true, +	"File": true, +	"ConstantSourceNode": true, +	"CryptoKey": true, +	"GainNode": true, +	"AbortController": true, +	"Attr": true, +	"SpeechSynthesis": true, +	"PushSubscription": false, +	"XMLStylesheetProcessingInstruction": false, +	"NodeIterator": true, +	"VideoStreamTrack": true, +	"XMLSerializer": true, +	"CaretPosition": true, +	"FormData": true, +	"CanvasPattern": true, +	"mozRTCSessionDescription": true, +	"Path2D": true, +	"PerformanceNavigation": true, +	"URL": false, +	"PluginArray": true, +	"MutationRecord": true, +	"WebKitCSSMatrix": true, +	"PeriodicWave": true, +	"DocumentFragment": true, +	"DocumentTimeline": false, +	"ScreenOrientation": true, +	"BroadcastChannel": true, +	"PermissionStatus": true, +	"IntersectionObserver": true, +	"Blob": true, +	"MessagePort": true, +	"BarProp": true, +	"OscillatorNode": true, +	"Cache": true, +	"RadioNodeList": true, +	"KeyframeEffectReadOnly": true, +	"InstallTrigger": true, +	"Function": false, +	"Object": false, +	"eval": true, +	"Window": false, +	"close": false, +	"stop": false, +	"focus": false, +	"blur": false, +	"open": true, +	"alert": false, +	"confirm": false, +	"prompt": false, +	"print": false, +	"postMessage": true, +	"getSelection": true, +	"getComputedStyle": true, +	"matchMedia": true, +	"moveTo": false, +	"moveBy": false, +	"resizeTo": false, +	"resizeBy": false, +	"scroll": false, +	"scrollTo": false, +	"scrollBy": false, +	"requestAnimationFrame": true, +	"cancelAnimationFrame": true, +	"getDefaultComputedStyle": false, +	"scrollByLines": false, +	"scrollByPages": false, +	"sizeToContent": false, +	"updateCommands": true, +	"find": false, +	"dump": true, +	"setResizable": false, +	"requestIdleCallback": false, +	"cancelIdleCallback": false, +	"btoa": true, +	"atob": true, +	"setTimeout": true, +	"clearTimeout": true, +	"setInterval": true, +	"clearInterval": true, +	"createImageBitmap": true, +	"fetch": true, +	"self": true, +	"name": false, +	"history": true, +	"locationbar": true, +	"menubar": true, +	"personalbar": true, +	"scrollbars": true, +	"statusbar": true, +	"toolbar": true, +	"status": true, +	"closed": true, +	"frames": true, +	"length": false, +	"opener": true, +	"parent": true, +	"frameElement": true, +	"navigator": true, +	"external": true, +	"applicationCache": true, +	"screen": true, +	"innerWidth": true, +	"innerHeight": true, +	"scrollX": true, +	"pageXOffset": true, +	"scrollY": true, +	"pageYOffset": true, +	"screenX": true, +	"screenY": true, +	"outerWidth": true, +	"outerHeight": true, +	"performance": true, +	"mozInnerScreenX": true, +	"mozInnerScreenY": true, +	"devicePixelRatio": true, +	"scrollMaxX": true, +	"scrollMaxY": true, +	"fullScreen": false, +	"mozPaintCount": true, +	"sidebar": false, +	"crypto": true, +	"speechSynthesis": true, +	"localStorage": true, +	"origin": true, +	"isSecureContext": false, +	"indexedDB": true, +	"caches": true, +	"sessionStorage": true, +	"window": false, +	"document": true, +	"location": false, +	"top": true, +	"netscape": true, +	"Node": true, +	"Document": true, +	"Performance": false, +	"startProfiling": true, +	"stopProfiling": true, +	"pauseProfilers": true, +	"resumeProfilers": true, +	"dumpProfile": true, +	"getMaxGCPauseSinceClear": true, +	"clearMaxGCPauseAccumulator": true, +	"Location": true, +	"StyleSheetList": false, +	"Selection": false, +	"Element": true, +	"AnonymousContent": false, +	"MutationObserver": true, +	"NodeList": true, +	"StopIteration": true +}; - +var DEBUG = true;  /**  *	Loop over a function and get a list of things being called.  * @@ -19,8 +849,7 @@ function get_function_names(input_node_src,scope){  	// The name of the function can't appear anywhere.  	// No bracket suffix notation either. -	console.log("Searching for identifier '"+scope+"' in this code:"); -	console.log(input_node_src); +	console.log("Searching for identifier '"+scope+"'");  	var tokens = acorn_base.tokenizer(input_node_src);  	var toke = tokens.getToken(); @@ -34,14 +863,13 @@ function get_function_names(input_node_src,scope){  	return false;  } -var fname_data = {"undefined":"trivial","Array":"trivial","Boolean":"trivial","JSON":"trivial","Date":"trivial","Math":"trivial","Number":"trivial","String":"trivial","RegExp":"trivial","Error":"non-trivial","InternalError":"trivial","EvalError":"non-trivial","RangeError":"trivial","ReferenceError":"trivial","SyntaxError":"trivial","TypeError":"trivial","URIError":"trivial","StopIteration":"trivial","ArrayBuffer":"non-trivial","Int8Array":"non-trivial","Uint8Array":"non-trivial","Int16Array":"non-trivial","Uint16Array":"non-trivial","Int32Array":"non-trivial","Uint32Array":"non-trivial","Float32Array":"non-trivial","Float64Array":"non-trivial","Uint8ClampedArray":"non-trivial","Proxy":"non-trivial","WeakMap":"non-trivial","Map":"non-trivial","Set":"non-trivial","DataView":"trivial","Symbol":"trivial","SharedArrayBuffer":"non-trivial","Intl":"trivial","TypedObject":"trivial","Reflect":"non-trivial","SIMD":"non-trivial","WeakSet":"trivial","Atomics":"non-trivial","Promise":"trivial","WebAssembly":"non-trivial","NaN":"trivial","Infinity":"trivial","isNaN":"trivial","isFinite":"trivial","parseFloat":"trivial","parseInt":"trivial","escape":"trivial","unescape":"trivial","decodeURI":"trivial","encodeURI":"trivial","decodeURIComponent":"trivial","encodeURIComponent":"trivial","uneval":"non-trivial","CSSStyleRule":"trivial","HTMLTimeElement":"trivial","SpeechSynthesisErrorEvent":"non-trivial","BatteryManager":"non-trivial","AudioContext":"non-trivial","CanvasGradient":"trivial","HTMLPictureElement":"non-trivial","HTMLMenuItemElement":"non-trivial","DOMStringMap":"non-trivial","HTMLFormElement":"non-trivial","BeforeUnloadEvent":"non-trivial","CSSFontFaceRule":"trivial","CSSPrimitiveValue":"trivial","HTMLOptionElement":"non-trivial","WebGLShader":"non-trivial","TextDecoder":"trivial","MediaKeys":"trivial","HTMLCanvasElement":"non-trivial","CSSStyleDeclaration":"trivial","HTMLTableSectionElement":"non-trivial","RTCDTMFSender":"non-trivial","Plugin":"non-trivial","AudioBuffer":"non-trivial","HTMLSelectElement":"non-trivial","CustomEvent":"non-trivial","PageTransitionEvent":"trivial","SVGPoint":"trivial","PushManager":"non-trivial","ChannelMergerNode":"non-trivial","SVGEllipseElement":"trivial","CSSStyleSheet":"trivial","RTCStatsReport":"non-trivial","SVGRadialGradientElement":"trivial","PerformanceResourceTiming":"non-trivial","PopupBlockedEvent":"non-trivial","SVGComponentTransferFunctionElement":"trivial","CSSPageRule":"trivial","SVGPathSegCurvetoQuadraticAbs":"trivial","SVGAnimatedNumberList":"trivial","MediaKeyError":"non-trivial","VRStageParameters":"non-trivial","CloseEvent":"trivial","SVGPathSegCurvetoQuadraticSmoothRel":"trivial","RTCTrackEvent":"non-trivial","ServiceWorker":"non-trivial","SVGFEColorMatrixElement":"non-trivial","HTMLUListElement":"non-trivial","ProgressEvent":"trivial","MutationEvent":"non-trivial","MessageEvent":"trivial","TextTrackCueList":"non-trivial","FocusEvent":"trivial","SVGPathSegLinetoHorizontalAbs":"trivial","PerformanceEntry":"non-trivial","TextTrackList":"non-trivial","StyleSheet":"trivial","DOMRectReadOnly":"non-trivial","HTMLMetaElement":"non-trivial","DOMException":"non-trivial","PerformanceMeasure":"non-trivial","DesktopNotificationCenter":"non-trivial","Comment":"non-trivial","DelayNode":"non-trivial","XPathResult":"non-trivial","MediaSource":"non-trivial","SVGLinearGradientElement":"trivial","WebGLShaderPrecisionFormat":"non-trivial","SVGStyleElement":"trivial","CDATASection":"non-trivial","HTMLLinkElement":"trivial","MessageChannel":"non-trivial","HTMLBaseElement":"trivial","IDBFileRequest":"non-trivial","SVGGraphicsElement":"trivial","HTMLDataListElement":"trivial","VRFrameData":"non-trivial","HTMLInputElement":"trivial","SVGPathSegMovetoRel":"trivial","TrackEvent":"trivial","HTMLMeterElement":"trivial","DeviceMotionEvent":"non-trivial","SVGStopElement":"trivial","BiquadFilterNode":"non-trivial","MediaDevices":"non-trivial","DOMRect":"trivial","CSSSupportsRule":"trivial","CSSMozDocumentRule":"trivial","SVGPathSegLinetoRel":"trivial","SVGFEConvolveMatrixElement":"trivial","HTMLSourceElement":"trivial","SpeechSynthesisUtterance":"non-trivial","Crypto":"non-trivial","Navigator":"non-trivial","FileList":"non-trivial","HTMLTrackElement":"non-trivial","WebGLQuery":"non-trivial","AudioBufferSourceNode":"non-trivial","SVGLineElement":"trivial","WebGLRenderbuffer":"non-trivial","SVGAnimatedAngle":"trivial","CSSKeyframeRule":"trivial","HTMLTableColElement":"trivial","DOMMatrix":"non-trivial","HTMLFieldSetElement":"trivial","WebGLSampler":"non-trivial","URLSearchParams":"trivial","WebGLUniformLocation":"non-trivial","ServiceWorkerContainer":"non-trivial","SVGPathSegLinetoAbs":"trivial","DOMMatrixReadOnly":"trivial","ValidityState":"non-trivial","DOMPointReadOnly":"trivial","ProcessingInstruction":"trivial","SVGPreserveAspectRatio":"trivial","SVGFEOffsetElement":"trivial","AbortSignal":"non-trivial","SVGFEImageElement":"trivial","TimeEvent":"non-trivial","FontFace":"trivial","FileReader":"non-trivial","SVGFEDiffuseLightingElement":"trivial","Worker":"non-trivial","External":"non-trivial","Audio":"non-trivial","IDBTransaction":"non-trivial","ImageBitmap":"non-trivial","MediaElementAudioSourceNode":"non-trivial","RTCDataChannelEvent":"non-trivial","TimeRanges":"non-trivial","Option":"non-trivial","TextTrack":"non-trivial","SVGElement":"trivial","SVGAnimatedNumber":"trivial","Image":"non-trivial","SVGTextElement":"trivial","DOMPoint":"trivial","HTMLDirectoryElement":"trivial","SVGFESpotLightElement":"trivial","VRDisplay":"non-trivial","AnimationTimeline":"trivial","SVGFEMorphologyElement":"trivial","IDBCursor":"non-trivial","SVGAngle":"trivial","VideoPlaybackQuality":"non-trivial","NodeList":"trivial","HTMLTableCellElement":"trivial","VTTCue":"non-trivial","SVGScriptElement":"trivial","HTMLStyleElement":"trivial","HTMLAudioElement":"trivial","Storage":"non-trivial","AudioNode":"non-trivial","PointerEvent":"non-trivial","XPathExpression":"non-trivial","CSSGroupingRule":"trivial","SVGFEDropShadowElement":"trivial","DOMQuad":"trivial","CharacterData":"non-trivial","BaseAudioContext":"non-trivial","SVGPathSegArcRel":"trivial","TextMetrics":"non-trivial","AudioListener":"non-trivial","MediaKeyStatusMap":"non-trivial","RTCPeerConnectionIceEvent":"non-trivial","MediaStreamTrackEvent":"trivial","HTMLLegendElement":"trivial","AnimationEffectReadOnly":"trivial","PerformanceTiming":"non-trivial","SVGNumber":"trivial","CSS2Properties":"trivial","MediaRecorder":"non-trivial","SVGGeometryElement":"trivial","PerformanceMark":"non-trivial","ImageBitmapRenderingContext":"non-trivial","SVGPathSegLinetoHorizontalRel":"trivial","SVGFEFuncBElement":"trivial","CSSFontFeatureValuesRule":"trivial","UserProximityEvent":"non-trivial","MediaQueryListEvent":"non-trivial","RTCCertificate":"non-trivial","Headers":"non-trivial","SVGClipPathElement":"trivial","IDBFileHandle":"non-trivial","StorageEvent":"non-trivial","CSSRuleList":"trivial","SVGPathSeg":"trivial","Range":"non-trivial","SVGUseElement":"trivial","CSSPseudoElement":"trivial","Rect":"trivial","DOMRequest":"non-trivial","HTMLOListElement":"trivial","SVGPathSegArcAbs":"trivial","AnimationEffectTimingReadOnly":"trivial","SVGPathSegCurvetoQuadraticSmoothAbs":"trivial","SVGRect":"trivial","RTCDTMFToneChangeEvent":"non-trivial","IDBMutableFile":"non-trivial","SVGAnimatedPreserveAspectRatio":"trivial","HTMLEmbedElement":"trivial","CSSMediaRule":"trivial","KeyframeEffect":"non-trivial","SVGImageElement":"trivial","MediaStream":"trivial","SVGGElement":"trivial","WebGLFramebuffer":"non-trivial","RTCPeerConnection":"non-trivial","HTMLTextAreaElement":"trivial","Permissions":"trivial","TextEncoder":"trivial","VRDisplayEvent":"non-trivial","SVGAnimatedEnumeration":"trivial","SVGAnimatedLengthList":"trivial","MediaStreamAudioSourceNode":"non-trivial","ImageData":"non-trivial","SVGFEFloodElement":"trivial","SpeechSynthesisVoice":"non-trivial","HTMLQuoteElement":"trivial","DOMParser":"trivial","StorageManager":"trivial","WebGLProgram":"non-trivial","TextTrackCue":"non-trivial","DOMTokenList":"trivial","SVGFECompositeElement":"trivial","OfflineAudioContext":"non-trivial","UIEvent":"non-trivial","HTMLMenuElement":"trivial","WebSocket":"non-trivial","DocumentType":"non-trivial","HTMLHeadElement":"trivial","SVGAElement":"trivial","SVGAnimatedBoolean":"trivial","SVGMaskElement":"trivial","HTMLUnknownElement":"trivial","HTMLBRElement":"trivial","GamepadButton":"non-trivial","HTMLProgressElement":"trivial","HTMLMediaElement":"trivial","SVGFilterElement":"trivial","HTMLFormControlsCollection":"trivial","HTMLCollection":"trivial","XPathEvaluator":"trivial","DragEvent":"non-trivial","VRFieldOfView":"non-trivial","MouseScrollEvent":"trivial","PerformanceNavigationTiming":"trivial","HTMLLIElement":"trivial","EventSource":"trivial","IdleDeadline":"trivial","AudioDestinationNode":"trivial","SVGPathSegLinetoVerticalRel":"trivial","AudioParam":"non-trivial","FileSystem":"non-trivial","MediaEncryptedEvent":"trivial","CSSCounterStyleRule":"trivial","FileSystemFileEntry":"non-trivial","CacheStorage":"non-trivial","MimeType":"trivial","PannerNode":"trivial","MutationObserver":"non-trivial","CSSImportRule":"trivial","HTMLDetailsElement":"trivial","NodeFilter":"non-trivial","SVGAnimatedInteger":"trivial","SVGTSpanElement":"trivial","MediaStreamTrack":"trivial","SVGMarkerElement":"trivial","SVGStringList":"trivial","GamepadHapticActuator":"non-trivial","SVGTransform":"trivial","StereoPannerNode":"trivial","console":"trivial","SVGPathElement":"trivial","MediaError":"trivial","HTMLObjectElement":"trivial","PopStateEvent":"non-trivial","MediaStreamAudioDestinationNode":"non-trivial","DynamicsCompressorNode":"non-trivial","DeviceProximityEvent":"non-trivial","PaintRequest":"non-trivial","RGBColor":"non-trivial","SVGTitleElement":"trivial","HTMLHeadingElement":"trivial","SpeechSynthesisEvent":"non-trivial","XMLHttpRequestEventTarget":"non-trivial","SVGFEBlendElement":"trivial","VRDisplayCapabilities":"non-trivial","ClipboardEvent":"non-trivial","FontFaceSet":"trivial","SVGTextPositioningElement":"trivial","SVGFEFuncGElement":"trivial","RTCIceCandidate":"non-trivial","OfflineAudioCompletionEvent":"non-trivial","CSSTransition":"trivial","IDBKeyRange":"non-trivial","PaintRequestList":"non-trivial","CSSAnimation":"trivial","AnimationPlaybackEvent":"trivial","SVGFEPointLightElement":"trivial","FileSystemEntry":"non-trivial","XMLDocument":"trivial","HTMLTableCaptionElement":"trivial","SourceBuffer":"non-trivial","Screen":"trivial","NamedNodeMap":"trivial","SVGAnimateElement":"trivial","SVGPolylineElement":"trivial","CSSValue":"trivial","History":"non-trivial","DeviceLightEvent":"non-trivial","StyleSheetList":"trivial","SVGDefsElement":"trivial","Response":"non-trivial","AnimationEffectTiming":"trivial","ServiceWorkerRegistration":"trivial","CanvasRenderingContext2D":"trivial","IDBVersionChangeEvent":"non-trivial","SVGPathSegList":"trivial","SVGAnimatedTransformList":"trivial","MediaStreamEvent":"trivial","HTMLPreElement":"trivial","SVGPathSegClosePath":"trivial","ScriptProcessorNode":"non-trivial","FileSystemDirectoryReader":"trivial","RTCRtpReceiver":"non-trivial","MimeTypeArray":"trivial","HTMLAllCollection":"trivial","CanvasCaptureMediaStream":"non-trivial","RTCRtpSender":"non-trivial","HTMLSpanElement":"trivial","CSSNamespaceRule":"trivial","SVGGradientElement":"trivial","HTMLFrameSetElement":"trivial","HTMLFontElement":"trivial","Directory":"trivial","mozRTCPeerConnection":"non-trivial","BlobEvent":"trivial","SVGSwitchElement":"trivial","PerformanceObserverEntryList":"trivial","SVGViewElement":"trivial","SVGUnitTypes":"trivial","PushSubscriptionOptions":"trivial","HTMLFrameElement":"trivial","DOMStringList":"trivial","MouseEvent":"trivial","SVGPathSegMovetoAbs":"trivial","Text":"trivial","GamepadAxisMoveEvent":"non-trivial","IntersectionObserverEntry":"trivial","SVGSymbolElement":"trivial","SVGFEFuncAElement":"trivial","WebGLContextEvent":"non-trivial","DOMImplementation":"trivial","WheelEvent":"trivial","MediaQueryList":"trivial","IDBObjectStore":"non-trivial","SubtleCrypto":"non-trivial","WebGL2RenderingContext":"non-trivial","InputEvent":"trivial","HashChangeEvent":"non-trivial","CSSRule":"trivial","Animation":"trivial","CSS":"trivial","HTMLAnchorElement":"trivial","AudioStreamTrack":"trivial","DataTransfer":"trivial","TreeWalker":"trivial","XMLHttpRequest":"non-trivial","VREyeParameters":"non-trivial","SVGAnimatedString":"trivial","SVGFEMergeElement":"trivial","CSSKeyframesRule":"trivial","LocalMediaStream":"non-trivial","ConvolverNode":"non-trivial","SVGPathSegLinetoVerticalAbs":"trivial","CSSConditionRule":"trivial","AudioScheduledSourceNode":"non-trivial","DeviceOrientationEvent":"non-trivial","WaveShaperNode":"non-trivial","SVGAnimationElement":"trivial","SVGPathSegCurvetoCubicAbs":"trivial","HTMLOptGroupElement":"trivial","DOMError":"trivial","DataTransferItemList":"non-trivial","Request":"non-trivial","HTMLVideoElement":"non-trivial","SourceBufferList":"non-trivial","SVGLength":"trivial","SVGTextPathElement":"trivial","SVGPolygonElement":"trivial","SVGAnimatedRect":"trivial","RTCSessionDescription":"non-trivial","MediaKeySystemAccess":"non-trivial","IDBFactory":"non-trivial","XSLTProcessor":"non-trivial","GamepadPose":"non-trivial","SVGPathSegCurvetoCubicRel":"trivial","HTMLModElement":"trivial","MediaDeviceInfo":"trivial","SVGFEFuncRElement":"trivial","HTMLHtmlElement":"trivial","XMLHttpRequestUpload":"trivial","SharedWorker":"trivial","WebGLTexture":"non-trivial","SVGLengthList":"trivial","Notification":"non-trivial","DOMRectList":"trivial","DataTransferItem":"non-trivial","CompositionEvent":"non-trivial","HTMLBodyElement":"trivial","SVGTextContentElement":"trivial","AnalyserNode":"non-trivial","MediaKeySession":"trivial","SVGFETurbulenceElement":"trivial","mozRTCIceCandidate":"non-trivial","PerformanceObserver":"non-trivial","OfflineResourceList":"non-trivial","WebGLRenderingContext":"non-trivial","FileSystemDirectoryEntry":"non-trivial","SVGMatrix":"trivial","DesktopNotification":"non-trivial","WebGLVertexArrayObject":"non-trivial","GamepadEvent":"non-trivial","HTMLTableElement":"trivial","MediaList":"non-trivial","SVGZoomAndPan":"trivial","SVGMetadataElement":"trivial","DataChannel":"non-trivial","IIRFilterNode":"non-trivial","IDBCursorWithValue":"non-trivial","ChannelSplitterNode":"non-trivial","KeyEvent":"non-trivial","MediaRecorderErrorEvent":"non-trivial","HTMLButtonElement":"trivial","File":"non-trivial","ConstantSourceNode":"non-trivial","CryptoKey":"non-trivial","GainNode":"non-trivial","AbortController":"non-trivial","SVGFEDistantLightElement":"non-trivial","Attr":"non-trivial","SpeechSynthesis":"non-trivial","SVGSVGElement":"trivial","Gamepad":"non-trivial","HTMLTableRowElement":"trivial","PushSubscription":"non-trivial","IDBOpenDBRequest":"non-trivial","SVGAnimateMotionElement":"trivial","SVGDescElement":"trivial","XMLStylesheetProcessingInstruction":"non-trivial","SVGPathSegCurvetoCubicSmoothRel":"trivial","NodeIterator":"trivial","HTMLAreaElement":"trivial","VideoStreamTrack":"non-trivial","SVGFESpecularLightingElement":"trivial","HTMLDataElement":"trivial","SVGFEGaussianBlurElement":"non-trivial","XMLSerializer":"non-trivial","SVGFEComponentTransferElement":"trivial","CaretPosition":"non-trivial","FormData":"non-trivial","SVGNumberList":"trivial","SVGTransformList":"trivial","WebGLActiveInfo":"non-trivial","SVGForeignObjectElement":"trivial","CanvasPattern":"non-trivial","SVGRectElement":"trivial","mozRTCSessionDescription":"non-trivial","Path2D":"non-trivial","HTMLParamElement":"trivial","SVGFEDisplacementMapElement":"trivial","SVGAnimateTransformElement":"trivial","ScrollAreaEvent":"trivial","HTMLLabelElement":"trivial","PerformanceNavigation":"trivial","GamepadButtonEvent":"non-trivial","KeyboardEvent":"non-trivial","TransitionEvent":"trivial","SVGAnimatedLength":"trivial","SVGPointList":"trivial","HTMLTemplateElement":"trivial","HTMLOptionsCollection":"trivial","SVGPatternElement":"trivial","ErrorEvent":"trivial","URL":"trivial","AnimationEvent":"trivial","SVGPathSegCurvetoCubicSmoothAbs":"trivial","PluginArray":"non-trivial","MutationRecord":"trivial","HTMLDivElement":"trivial","CSSValueList":"trivial","WebKitCSSMatrix":"trivial","HTMLIFrameElement":"trivial","PeriodicWave":"non-trivial","IDBRequest":"non-trivial","MediaKeyMessageEvent":"non-trivial","SVGCircleElement":"trivial","WebGLTransformFeedback":"non-trivial","DocumentFragment":"trivial","DOMCursor":"trivial","WebGLSync":"non-trivial","FontFaceSetLoadEvent":"trivial","DocumentTimeline":"non-trivial","IDBIndex":"non-trivial","SVGSetElement":"trivial","ScreenOrientation":"non-trivial","BroadcastChannel":"non-trivial","PermissionStatus":"non-trivial","IntersectionObserver":"non-trivial","SVGFETileElement":"trivial","HTMLTitleElement":"trivial","SVGMPathElement":"trivial","Blob":"trivial","MessagePort":"non-trivial","HTMLMapElement":"trivial","SVGFEMergeNodeElement":"trivial","BarProp":"non-trivial","VRPose":"non-trivial","SVGPathSegCurvetoQuadraticRel":"trivial","OscillatorNode":"non-trivial","Cache":"non-trivial","HTMLOutputElement":"trivial","HTMLDListElement":"trivial","HTMLParagraphElement":"trivial","IDBDatabase":"non-trivial","RadioNodeList":"non-trivial","AudioProcessingEvent":"non-trivial","WebGLBuffer":"non-trivial","KeyframeEffectReadOnly":"trivial","HTMLHRElement":"trivial","HTMLImageElement":"trivial","InstallTrigger":"non-trivial","Function":"trivial","Object":"trivial","eval":"non-trivial","EventTarget":"trivial","Window":"trivial","close":"trivial","stop":"trivial","focus":"trivial","blur":"trivial","open":"trivial","alert":"trivial","confirm":"trivial","prompt":"trivial","print":"trivial","postMessage":"non-trivial","captureEvents":"non-trivial","releaseEvents":"non-trivial","getSelection":"non-trivial","getComputedStyle":"trivial","matchMedia":"non-trivial","moveTo":"non-trivial","moveBy":"non-trivial","resizeTo":"non-trivial","resizeBy":"non-trivial","scroll":"trivial","scrollTo":"trivial","scrollBy":"trivial","requestAnimationFrame":"non-trivial","cancelAnimationFrame":"non-trivial","getDefaultComputedStyle":"non-trivial","scrollByLines":"trivial","scrollByPages":"trivial","sizeToContent":"trivial","updateCommands":"non-trivial","find":"trivial","dump":"trivial","setResizable":"non-trivial","requestIdleCallback":"non-trivial","cancelIdleCallback":"non-trivial","btoa":"trivial","atob":"trivial","setTimeout":"non-trivial","clearTimeout":"trivial","setInterval":"non-trivial","clearInterval":"non-trivial","createImageBitmap":"non-trivial","fetch":"non-trivial","self":"non-trivial","name":"non-trivial","history":"non-trivial","locationbar":"non-trivial","menubar":"non-trivial","personalbar":"non-trivial","scrollbars":"non-trivial","statusbar":"non-trivial","toolbar":"non-trivial","status":"non-trivial","closed":"non-trivial","frames":"non-trivial","length":"non-trivial","opener":"non-trivial","parent":"non-trivial","frameElement":"trivial","navigator":"non-trivial","external":"non-trivial","applicationCache":"non-trivial","screen":"non-trivial","innerWidth":"non-trivial","innerHeight":"non-trivial","scrollX":"non-trivial","pageXOffset":"non-trivial","scrollY":"non-trivial","pageYOffset":"non-trivial","screenX":"non-trivial","screenY":"non-trivial","outerWidth":"non-trivial","outerHeight":"non-trivial","performance":"non-trivial","mozInnerScreenX":"non-trivial","mozInnerScreenY":"non-trivial","devicePixelRatio":"non-trivial","scrollMaxX":"non-trivial","scrollMaxY":"non-trivial","fullScreen":"non-trivial","mozPaintCount":"non-trivial","ondevicemotion":"non-trivial","ondeviceorientation":"non-trivial","onabsolutedeviceorientation":"non-trivial","ondeviceproximity":"non-trivial","onuserproximity":"non-trivial","ondevicelight":"non-trivial","sidebar":"trivial","onvrdisplayconnect":"non-trivial","onvrdisplaydisconnect":"non-trivial","onvrdisplayactivate":"non-trivial","onvrdisplaydeactivate":"non-trivial","onvrdisplaypresentchange":"non-trivial","crypto":"non-trivial","onabort":"non-trivial","onblur":"non-trivial","onfocus":"non-trivial","onauxclick":"non-trivial","oncanplay":"non-trivial","oncanplaythrough":"non-trivial","onchange":"non-trivial","onclick":"non-trivial","onclose":"non-trivial","oncontextmenu":"non-trivial","ondblclick":"non-trivial","ondrag":"non-trivial","ondragend":"non-trivial","ondragenter":"non-trivial","ondragexit":"non-trivial","ondragleave":"non-trivial","ondragover":"non-trivial","ondragstart":"non-trivial","ondrop":"non-trivial","ondurationchange":"non-trivial","onemptied":"non-trivial","onended":"non-trivial","oninput":"non-trivial","oninvalid":"non-trivial","onkeydown":"non-trivial","onkeypress":"non-trivial","onkeyup":"non-trivial","onload":"trivial","onloadeddata":"non-trivial","onloadedmetadata":"non-trivial","onloadend":"non-trivial","onloadstart":"non-trivial","onmousedown":"non-trivial","onmouseenter":"non-trivial","onmouseleave":"non-trivial","onmousemove":"non-trivial","onmouseout":"non-trivial","onmouseover":"non-trivial","onmouseup":"non-trivial","onwheel":"non-trivial","onpause":"non-trivial","onplay":"non-trivial","onplaying":"non-trivial","onprogress":"non-trivial","onratechange":"non-trivial","onreset":"non-trivial","onresize":"non-trivial","onscroll":"non-trivial","onseeked":"non-trivial","onseeking":"non-trivial","onselect":"non-trivial","onshow":"non-trivial","onstalled":"non-trivial","onsubmit":"non-trivial","onsuspend":"non-trivial","ontimeupdate":"non-trivial","onvolumechange":"non-trivial","onwaiting":"non-trivial","onselectstart":"non-trivial","ontoggle":"non-trivial","onpointercancel":"non-trivial","onpointerdown":"non-trivial","onpointerup":"non-trivial","onpointermove":"non-trivial","onpointerout":"non-trivial","onpointerover":"non-trivial","onpointerenter":"non-trivial","onpointerleave":"non-trivial","ongotpointercapture":"non-trivial","onlostpointercapture":"non-trivial","onmozfullscreenchange":"non-trivial","onmozfullscreenerror":"non-trivial","onanimationcancel":"non-trivial","onanimationend":"non-trivial","onanimationiteration":"non-trivial","onanimationstart":"non-trivial","ontransitioncancel":"non-trivial","ontransitionend":"non-trivial","ontransitionrun":"non-trivial","ontransitionstart":"non-trivial","onwebkitanimationend":"non-trivial","onwebkitanimationiteration":"non-trivial","onwebkitanimationstart":"non-trivial","onwebkittransitionend":"non-trivial","onerror":"non-trivial","speechSynthesis":"non-trivial","onafterprint":"non-trivial","onbeforeprint":"non-trivial","onbeforeunload":"non-trivial","onhashchange":"non-trivial","onlanguagechange":"non-trivial","onmessage":"non-trivial","onmessageerror":"non-trivial","onoffline":"non-trivial","ononline":"non-trivial","onpagehide":"non-trivial","onpageshow":"non-trivial","onpopstate":"non-trivial","onstorage":"non-trivial","onunload":"non-trivial","localStorage":"non-trivial","origin":"non-trivial","isSecureContext":"non-trivial","indexedDB":"non-trivial","caches":"non-trivial","sessionStorage":"non-trivial","window":"trivial","document":"trivial","location":"non-trivial","top":"trivial","netscape":"non-trivial","Node":"non-trivial","Document":"trivial","HTMLDocument":"trivial","Performance":"non-trivial","startProfiling":"non-trivial","stopProfiling":"non-trivial","pauseProfilers":"non-trivial","resumeProfilers":"non-trivial","dumpProfile":"non-trivial","getMaxGCPauseSinceClear":"non-trivial","clearMaxGCPauseAccumulator":"non-trivial","Selection":"non-trivial","Element":"trivial","HTMLElement":"trivial","HTMLScriptElement":"trivial","Event":"trivial","Location":"non-trivial"}  function test_function_name(name){  	var res = fname_data[name]; -	if(res == "trivial"){ +	if(res == false){  		console.log("'"+name+"'"+" is trivial.");	  		return false;  	} -	if(res == "nontrivial"){ +	if(res == true){  		console.log("%cNONTRIVIAL:'"+name+"'"+" is non-trivial.","color:red");	  		return true;	  	} @@ -49,18 +877,14 @@ function test_function_name(name){  	return false;  } +//746 -window.onload = function () { - -	document.getElementById("parse").addEventListener("click",function(){ +function full_evaluate(script){  		var res = true;		 - -		var script = document.getElementById("input").value; -		if(script == "" || script === undefined){ +		if(script === undefined || script == ""){  			return true;  		}  		var ast = acorn.parse_dammit(script).body[0]; -		document.getElementById("output").innerHTML = JSON.stringify(ast, null, "\t"); // Indented with tab  		var flag = false;  		var amtloops = 0; @@ -95,73 +919,97 @@ window.onload = function () {  		if(amtloops > 3){  			console.log("%c NONTRIVIAL: Too many loops/conditionals.","color:red"); -			return false; +			if(DEBUG == false){			 +				return false; +			}		  		}  		// Detect which objects are referenced and which functions are called  		// Only cares about top level objects. Window is special because we will test its methods.  		var nontrivial = false; -		function read(){ +		// Has a while loop to cut down on recursion when not needed  +		function read(lnode){ +			while(true){ +				// window.test() +				if(lnode.type == "CallExpression"){ +					if(lnode.property !== undefined){ +						last_name = lnode.property.name;	 +					} +					lnode = lnode.callee; +				// window.test +				}else if(lnode.type == "MemberExpression"){ +					last_name = lnode.property.name; +					// This may be bracket suffix notation +					lnode = lnode.object;			 +				// We should be at the first in the chain.		 +				}else if(lnode.type == "Identifier"){ +					// Since window is the global object, it is special +					if(lnode.name == "window"){ +						return test_function_name(last_name); +					} else{ +						return test_function_name(lnode.name); +					} +				}else if(lnode.type == "BinaryExpression"){ +					// recurse on left side +					if(read(lnode.left) == true){ +						return true; +					} +					// continue on right side +					last_name = lnode.operator; +					// This may be bracket suffix notation +					lnode = lnode.right; +				}else if(lnode.type == "AssignmentExpression"){ +					// recurse on left side +					if(read(lnode.left) == true){ +						return true; +					} +					// continue on right side +					last_name = lnode.operator; +					// This may be bracket suffix notation +					lnode = lnode.right;	 +				}else if(lnode.type == "FunctionExpression"){ +					console.log("%cDefines a function.","color:red"); +					return true; +				}else{ +					console.log("Unrecognized:"); +					console.log(lnode); +					return; +				} +				//console.log(last_name+":"+lnode.name); +			}  		}  		walk.simple(ast, {  			ExpressionStatement(node){ -				if(nontrivial == true){ +				if(nontrivial == true && DEBUG == false){  					return;  				}  				// Get the first thing in the expression	  				if(node === undefined){  					return; -				}			 +				}  				var lnode = node.expression;				  				var last_name = ""; -				while(true){ -					// window.test() -					if(lnode.type == "CallExpression"){ -						if(lnode.property !== undefined){ -							last_name = lnode.property.name;	 -						} -						lnode = lnode.callee; - 					// window.test -					}else if(lnode.type == "MemberExpression"){ -						last_name = lnode.property.name; -						// This may be bracket suffix notation -						lnode = lnode.object;			 -					// We should be at the first in the chain.		 -					}else if(lnode.type == "Identifier"){ -						// Since window is the global object, it is special -						if(lnode.name == "window"){ -							nontrivial = test_function_name(last_name); -							break; -						} else{ -							nontrivial = test_function_name(lnode.name); -							break; -						} -					}else if(lnode.type == "BinaryExpression"){ -						// This actually might not be valid. It can't be anything nontrivial. -						console.log("%c Warn: syntax not valid","color:Red;") -						break; -					} else{ -						break; -					} -					//console.log(last_name+":"+lnode.name); -				}, -				BinaryExpression(node){ -					 - -				}			 +				console.log("%cReading ExpressionStatement","color:green"); +				read(lnode,last_name); +			}, FunctionExpression(node){ +				//   			}  		}); -		document.getElementById("output").innerHTML =  res + "\n\n" + document.getElementById("output").innerHTML;		 -  		if(nontrivial == true){  			return false;  		}  		return true; - +} +window.onload = function () { +	document.getElementById("parse").addEventListener("click",function(){ +		var script = document.getElementById("input").value; +		var ast = acorn.parse_dammit(script).body[0]; +		document.getElementById("output").innerHTML = JSON.stringify(ast, null, '\t'); // Indented with tab +		document.getElementById("output").innerHTML = full_evaluate(script) + "\n\n" + document.getElementById("output").innerHTML;  	});  } diff --git a/test_bundle.js b/test_bundle.js index cac1d81..f0a3d6f 100644 --- a/test_bundle.js +++ b/test_bundle.js @@ -1,101 +1,1022 @@  (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){  var acorn = require('acorn/dist/acorn_loose');  var walk = require("acorn/dist/walk"); +var acorn_base = require("acorn"); + +var fname_data = { +	"WebGLShader": true, +	"WebGLShaderPrecisionFormat": true, +	"WebGLQuery": true, +	"WebGLRenderbuffer": true, +	"WebGLSampler": true, +	"WebGLUniformLocation": true, +	"WebGLFramebuffer": true, +	"WebGLProgram": true, +	"WebGLContextEvent": true, +	"WebGL2RenderingContext": true, +	"WebGLTexture": true, +	"WebGLRenderingContext": true, +	"WebGLVertexArrayObject": true, +	"WebGLActiveInfo": true, +	"WebGLTransformFeedback": true, +	"WebGLSync": true, +	"WebGLBuffer": true, +	"cat_svg": true, +	"SVGPoint": true, +	"SVGEllipseElement": true, +	"SVGRadialGradientElement": true, +	"SVGComponentTransferFunctionElement": true, +	"SVGPathSegCurvetoQuadraticAbs": true, +	"SVGAnimatedNumberList": true, +	"SVGPathSegCurvetoQuadraticSmoothRel": true, +	"SVGFEColorMatrixElement": true, +	"SVGPathSegLinetoHorizontalAbs": true, +	"SVGLinearGradientElement": true, +	"SVGStyleElement": true, +	"SVGPathSegMovetoRel": true, +	"SVGStopElement": true, +	"SVGPathSegLinetoRel": true, +	"SVGFEConvolveMatrixElement": true, +	"SVGAnimatedAngle": true, +	"SVGPathSegLinetoAbs": true, +	"SVGPreserveAspectRatio": true, +	"SVGFEOffsetElement": true, +	"SVGFEImageElement": true, +	"SVGFEDiffuseLightingElement": true, +	"SVGAnimatedNumber": true, +	"SVGTextElement": true, +	"SVGFESpotLightElement": true, +	"SVGFEMorphologyElement": true, +	"SVGAngle": true, +	"SVGScriptElement": true, +	"SVGFEDropShadowElement": true, +	"SVGPathSegArcRel": true, +	"SVGNumber": true, +	"SVGPathSegLinetoHorizontalRel": true, +	"SVGFEFuncBElement": true, +	"SVGClipPathElement": true, +	"SVGPathSeg": true, +	"SVGUseElement": true, +	"SVGPathSegArcAbs": true, +	"SVGPathSegCurvetoQuadraticSmoothAbs": true, +	"SVGRect": true, +	"SVGAnimatedPreserveAspectRatio": true, +	"SVGImageElement": true, +	"SVGAnimatedEnumeration": true, +	"SVGAnimatedLengthList": true, +	"SVGFEFloodElement": true, +	"SVGFECompositeElement": true, +	"SVGAElement": true, +	"SVGAnimatedBoolean": true, +	"SVGMaskElement": true, +	"SVGFilterElement": true, +	"SVGPathSegLinetoVerticalRel": true, +	"SVGAnimatedInteger": true, +	"SVGTSpanElement": true, +	"SVGMarkerElement": true, +	"SVGStringList": true, +	"SVGTransform": true, +	"SVGTitleElement": true, +	"SVGFEBlendElement": true, +	"SVGTextPositioningElement": true, +	"SVGFEFuncGElement": true, +	"SVGFEPointLightElement": true, +	"SVGAnimateElement": true, +	"SVGPolylineElement": true, +	"SVGDefsElement": true, +	"SVGPathSegList": true, +	"SVGAnimatedTransformList": true, +	"SVGPathSegClosePath": true, +	"SVGGradientElement": true, +	"SVGSwitchElement": true, +	"SVGViewElement": true, +	"SVGUnitTypes": true, +	"SVGPathSegMovetoAbs": true, +	"SVGSymbolElement": true, +	"SVGFEFuncAElement": true, +	"SVGAnimatedString": true, +	"SVGFEMergeElement": true, +	"SVGPathSegLinetoVerticalAbs": true, +	"SVGAnimationElement": true, +	"SVGPathSegCurvetoCubicAbs": true, +	"SVGLength": true, +	"SVGTextPathElement": true, +	"SVGPolygonElement": true, +	"SVGAnimatedRect": true, +	"SVGPathSegCurvetoCubicRel": true, +	"SVGFEFuncRElement": true, +	"SVGLengthList": true, +	"SVGTextContentElement": true, +	"SVGFETurbulenceElement": true, +	"SVGMatrix": true, +	"SVGZoomAndPan": true, +	"SVGMetadataElement": true, +	"SVGFEDistantLightElement": true, +	"SVGAnimateMotionElement": true, +	"SVGDescElement": true, +	"SVGPathSegCurvetoCubicSmoothRel": true, +	"SVGFESpecularLightingElement": true, +	"SVGFEGaussianBlurElement": true, +	"SVGFEComponentTransferElement": true, +	"SVGNumberList": true, +	"SVGTransformList": true, +	"SVGForeignObjectElement": true, +	"SVGRectElement": true, +	"SVGFEDisplacementMapElement": true, +	"SVGAnimateTransformElement": true, +	"SVGAnimatedLength": true, +	"SVGPointList": true, +	"SVGPatternElement": true, +	"SVGPathSegCurvetoCubicSmoothAbs": true, +	"SVGCircleElement": true, +	"SVGSetElement": true, +	"SVGFETileElement": true, +	"SVGMPathElement": true, +	"SVGFEMergeNodeElement": true, +	"SVGPathSegCurvetoQuadraticRel": true, +	"SVGElement": true, +	"SVGGraphicsElement": true, +	"SVGSVGElement": true, +	"SVGGElement": true, +	"SVGGeometryElement": true, +	"SVGPathElement": true, +	"SVGLineElement": true, +	"cat_html": true, +	"HTMLTimeElement": true, +	"HTMLPictureElement": true, +	"HTMLMenuItemElement": true, +	"HTMLFormElement": true, +	"HTMLOptionElement": true, +	"HTMLCanvasElement": true, +	"HTMLTableSectionElement": true, +	"HTMLSelectElement": true, +	"HTMLUListElement": true, +	"HTMLMetaElement": true, +	"HTMLLinkElement": true, +	"HTMLBaseElement": true, +	"HTMLDataListElement": true, +	"HTMLInputElement": true, +	"HTMLMeterElement": true, +	"HTMLSourceElement": true, +	"HTMLTrackElement": true, +	"HTMLTableColElement": true, +	"HTMLFieldSetElement": true, +	"HTMLDirectoryElement": true, +	"HTMLTableCellElement": true, +	"HTMLStyleElement": true, +	"HTMLAudioElement": true, +	"HTMLLegendElement": true, +	"HTMLOListElement": true, +	"HTMLEmbedElement": true, +	"HTMLQuoteElement": true, +	"HTMLMenuElement": true, +	"HTMLHeadElement": true, +	"HTMLUnknownElement": true, +	"HTMLBRElement": true, +	"HTMLProgressElement": true, +	"HTMLMediaElement": true, +	"HTMLFormControlsCollection": true, +	"HTMLCollection": true, +	"HTMLLIElement": true, +	"HTMLDetailsElement": true, +	"HTMLObjectElement": true, +	"HTMLHeadingElement": true, +	"HTMLTableCaptionElement": true, +	"HTMLPreElement": true, +	"HTMLAllCollection": true, +	"HTMLFrameSetElement": true, +	"HTMLFontElement": true, +	"HTMLFrameElement": true, +	"HTMLAnchorElement": true, +	"HTMLOptGroupElement": true, +	"HTMLVideoElement": true, +	"HTMLModElement": true, +	"HTMLBodyElement": true, +	"HTMLTableElement": true, +	"HTMLButtonElement": true, +	"HTMLTableRowElement": true, +	"HTMLAreaElement": true, +	"HTMLDataElement": true, +	"HTMLParamElement": true, +	"HTMLLabelElement": true, +	"HTMLTemplateElement": true, +	"HTMLOptionsCollection": true, +	"HTMLIFrameElement": true, +	"HTMLTitleElement": true, +	"HTMLMapElement": true, +	"HTMLOutputElement": true, +	"HTMLDListElement": true, +	"HTMLParagraphElement": true, +	"HTMLHRElement": true, +	"HTMLImageElement": true, +	"HTMLDocument": true, +	"HTMLElement": true, +	"HTMLScriptElement": true, +	"HTMLHtmlElement": true, +	"HTMLTextAreaElement": true, +	"HTMLDivElement": true, +	"HTMLSpanElement": true, +	"cat_css": true, +	"CSSStyleRule": true, +	"CSSFontFaceRule": true, +	"CSSPrimitiveValue": true, +	"CSSStyleDeclaration": true, +	"CSSStyleSheet": true, +	"CSSPageRule": true, +	"CSSSupportsRule": true, +	"CSSMozDocumentRule": true, +	"CSSKeyframeRule": true, +	"CSSGroupingRule": true, +	"CSS2Properties": true, +	"CSSFontFeatureValuesRule": true, +	"CSSRuleList": true, +	"CSSPseudoElement": true, +	"CSSMediaRule": true, +	"CSSCounterStyleRule": true, +	"CSSImportRule": true, +	"CSSTransition": true, +	"CSSAnimation": true, +	"CSSValue": true, +	"CSSNamespaceRule": true, +	"CSSRule": true, +	"CSS": true, +	"CSSKeyframesRule": true, +	"CSSConditionRule": true, +	"CSSValueList": true, +	"cat_event": true, +	"ondevicemotion": true, +	"ondeviceorientation": true, +	"onabsolutedeviceorientation": true, +	"ondeviceproximity": true, +	"onuserproximity": true, +	"ondevicelight": true, +	"onvrdisplayconnect": true, +	"onvrdisplaydisconnect": true, +	"onvrdisplayactivate": true, +	"onvrdisplaydeactivate": true, +	"onvrdisplaypresentchange": true, +	"onabort": true, +	"onblur": true, +	"onfocus": true, +	"onauxclick": true, +	"oncanplay": true, +	"oncanplaythrough": true, +	"onchange": true, +	"onclick": true, +	"onclose": true, +	"oncontextmenu": true, +	"ondblclick": true, +	"ondrag": true, +	"ondragend": true, +	"ondragenter": true, +	"ondragexit": true, +	"ondragleave": true, +	"ondragover": true, +	"ondragstart": true, +	"ondrop": true, +	"ondurationchange": true, +	"onemptied": true, +	"onended": true, +	"oninput": true, +	"oninvalid": true, +	"onkeydown": true, +	"onkeypress": true, +	"onkeyup": true, +	"onload": true, +	"onloadeddata": true, +	"onloadedmetadata": true, +	"onloadend": true, +	"onloadstart": true, +	"onmousedown": true, +	"onmouseenter": true, +	"onmouseleave": true, +	"onmousemove": true, +	"onmouseout": true, +	"onmouseover": true, +	"onmouseup": true, +	"onwheel": true, +	"onpause": true, +	"onplay": true, +	"onplaying": true, +	"onprogress": true, +	"onratechange": true, +	"onreset": true, +	"onresize": true, +	"onscroll": true, +	"onseeked": true, +	"onseeking": true, +	"onselect": true, +	"onshow": true, +	"onstalled": true, +	"onsubmit": true, +	"onsuspend": true, +	"ontimeupdate": true, +	"onvolumechange": true, +	"onwaiting": true, +	"onselectstart": true, +	"ontoggle": true, +	"onpointercancel": true, +	"onpointerdown": true, +	"onpointerup": true, +	"onpointermove": true, +	"onpointerout": true, +	"onpointerover": true, +	"onpointerenter": true, +	"onpointerleave": true, +	"ongotpointercapture": true, +	"onlostpointercapture": true, +	"onmozfullscreenchange": true, +	"onmozfullscreenerror": true, +	"onanimationcancel": true, +	"onanimationend": true, +	"onanimationiteration": true, +	"onanimationstart": true, +	"ontransitioncancel": true, +	"ontransitionend": true, +	"ontransitionrun": true, +	"ontransitionstart": true, +	"onwebkitanimationend": true, +	"onwebkitanimationiteration": true, +	"onwebkitanimationstart": true, +	"onwebkittransitionend": true, +	"onerror": true, +	"onafterprint": true, +	"onbeforeprint": true, +	"onbeforeunload": true, +	"onhashchange": true, +	"onlanguagechange": true, +	"onmessage": true, +	"onmessageerror": true, +	"onoffline": true, +	"ononline": true, +	"onpagehide": true, +	"onpageshow": true, +	"onpopstate": true, +	"onstorage": true, +	"onunload": true, +	"cat_rtc": true, +	"RTCDTMFSender": true, +	"RTCStatsReport": true, +	"RTCTrackEvent": true, +	"RTCDataChannelEvent": true, +	"RTCPeerConnectionIceEvent": true, +	"RTCCertificate": true, +	"RTCDTMFToneChangeEvent": true, +	"RTCPeerConnection": true, +	"RTCIceCandidate": true, +	"RTCRtpReceiver": true, +	"RTCRtpSender": true, +	"RTCSessionDescription": true, +	"cat_vr": true, +	"VRStageParameters": true, +	"VRFrameData": true, +	"VRDisplay": true, +	"VRDisplayEvent": true, +	"VRFieldOfView": true, +	"VRDisplayCapabilities": true, +	"VREyeParameters": true, +	"VRPose": true, +	"cat_dom": true, +	"DOMStringMap": true, +	"DOMRectReadOnly": true, +	"DOMException": true, +	"DOMRect": true, +	"DOMMatrix": true, +	"DOMMatrixReadOnly": true, +	"DOMPointReadOnly": true, +	"DOMPoint": true, +	"DOMQuad": true, +	"DOMRequest": true, +	"DOMParser": true, +	"DOMTokenList": true, +	"DOMStringList": true, +	"DOMImplementation": true, +	"DOMError": true, +	"DOMRectList": true, +	"DOMCursor": true, +	"cat_idb": true, +	"IDBFileRequest": true, +	"IDBTransaction": true, +	"IDBCursor": true, +	"IDBFileHandle": true, +	"IDBMutableFile": true, +	"IDBKeyRange": true, +	"IDBVersionChangeEvent": true, +	"IDBObjectStore": true, +	"IDBFactory": true, +	"IDBCursorWithValue": true, +	"IDBOpenDBRequest": true, +	"IDBRequest": true, +	"IDBIndex": true, +	"IDBDatabase": true, +	"cat_audio": true, +	"AudioContext": true, +	"AudioBuffer": true, +	"AudioBufferSourceNode": true, +	"Audio": true, +	"MediaElementAudioSourceNode": true, +	"AudioNode": true, +	"BaseAudioContext": true, +	"AudioListener": true, +	"MediaStreamAudioSourceNode": true, +	"OfflineAudioContext": true, +	"AudioDestinationNode": true, +	"AudioParam": true, +	"MediaStreamAudioDestinationNode": true, +	"OfflineAudioCompletionEvent": true, +	"AudioStreamTrack": true, +	"AudioScheduledSourceNode": true, +	"AudioProcessingEvent": true, +	"cat_gamepad": true, +	"GamepadButton": true, +	"GamepadHapticActuator": true, +	"GamepadAxisMoveEvent": true, +	"GamepadPose": true, +	"GamepadEvent": true, +	"Gamepad": true, +	"GamepadButtonEvent": true, +	"cat_media": true, +	"MediaKeys": true, +	"MediaKeyError": true, +	"MediaSource": true, +	"MediaDevices": true, +	"MediaKeyStatusMap": true, +	"MediaStreamTrackEvent": true, +	"MediaRecorder": true, +	"MediaQueryListEvent": true, +	"MediaStream": true, +	"MediaEncryptedEvent": true, +	"MediaStreamTrack": true, +	"MediaError": true, +	"MediaStreamEvent": true, +	"MediaQueryList": true, +	"MediaKeySystemAccess": true, +	"MediaDeviceInfo": true, +	"MediaKeySession": true, +	"MediaList": true, +	"MediaRecorderErrorEvent": true, +	"MediaKeyMessageEvent": true, +	"cat_event2": true, +	"SpeechSynthesisErrorEvent": true, +	"BeforeUnloadEvent": true, +	"CustomEvent": true, +	"PageTransitionEvent": true, +	"PopupBlockedEvent": true, +	"CloseEvent": true, +	"ProgressEvent": true, +	"MutationEvent": true, +	"MessageEvent": true, +	"FocusEvent": true, +	"TrackEvent": true, +	"DeviceMotionEvent": true, +	"TimeEvent": true, +	"PointerEvent": true, +	"UserProximityEvent": true, +	"StorageEvent": true, +	"DragEvent": true, +	"MouseScrollEvent": true, +	"EventSource": true, +	"PopStateEvent": true, +	"DeviceProximityEvent": true, +	"SpeechSynthesisEvent": true, +	"XMLHttpRequestEventTarget": true, +	"ClipboardEvent": true, +	"AnimationPlaybackEvent": true, +	"DeviceLightEvent": true, +	"BlobEvent": true, +	"MouseEvent": true, +	"WheelEvent": true, +	"InputEvent": true, +	"HashChangeEvent": true, +	"DeviceOrientationEvent": true, +	"CompositionEvent": true, +	"KeyEvent": true, +	"ScrollAreaEvent": true, +	"KeyboardEvent": true, +	"TransitionEvent": true, +	"ErrorEvent": true, +	"AnimationEvent": true, +	"FontFaceSetLoadEvent": true, +	"EventTarget": true, +	"captureEvents": true, +	"releaseEvents": true, +	"Event": true, +	"UIEvent": true, +	"cat_other": false, +	"undefined": false, +	"Array": false, +	"Boolean": false, +	"JSON": false, +	"Date": false, +	"Math": false, +	"Number": false, +	"String": false, +	"RegExp": false, +	"Error": false, +	"InternalError": false, +	"EvalError": false, +	"RangeError": false, +	"ReferenceError": false, +	"SyntaxError": false, +	"TypeError": false, +	"URIError": false, +	"ArrayBuffer": true, +	"Int8Array": true, +	"Uint8Array": true, +	"Int16Array": true, +	"Uint16Array": true, +	"Int32Array": true, +	"Uint32Array": true, +	"Float32Array": true, +	"Float64Array": true, +	"Uint8ClampedArray": true, +	"Proxy": true, +	"WeakMap": true, +	"Map": true, +	"Set": true, +	"DataView": false, +	"Symbol": false, +	"SharedArrayBuffer": true, +	"Intl": false, +	"TypedObject": true, +	"Reflect": true, +	"SIMD": true, +	"WeakSet": true, +	"Atomics": true, +	"Promise": true, +	"WebAssembly": true, +	"NaN": false, +	"Infinity": false, +	"isNaN": false, +	"isFinite": false, +	"parseFloat": false, +	"parseInt": false, +	"escape": false, +	"unescape": false, +	"decodeURI": false, +	"encodeURI": false, +	"decodeURIComponent": false, +	"encodeURIComponent": false, +	"uneval": false, +	"BatteryManager": true, +	"CanvasGradient": true, +	"TextDecoder": true, +	"Plugin": true, +	"PushManager": true, +	"ChannelMergerNode": true, +	"PerformanceResourceTiming": true, +	"ServiceWorker": true, +	"TextTrackCueList": true, +	"PerformanceEntry": true, +	"TextTrackList": true, +	"StyleSheet": true, +	"PerformanceMeasure": true, +	"DesktopNotificationCenter": true, +	"Comment": true, +	"DelayNode": true, +	"XPathResult": true, +	"CDATASection": true, +	"MessageChannel": true, +	"BiquadFilterNode": true, +	"SpeechSynthesisUtterance": true, +	"Crypto": true, +	"Navigator": true, +	"FileList": true, +	"URLSearchParams": false, +	"ServiceWorkerContainer": true, +	"ValidityState": true, +	"ProcessingInstruction": true, +	"AbortSignal": true, +	"FontFace": true, +	"FileReader": true, +	"Worker": true, +	"External": true, +	"ImageBitmap": true, +	"TimeRanges": true, +	"Option": true, +	"TextTrack": true, +	"Image": true, +	"AnimationTimeline": true, +	"VideoPlaybackQuality": true, +	"VTTCue": true, +	"Storage": true, +	"XPathExpression": true, +	"CharacterData": false, +	"TextMetrics": true, +	"AnimationEffectReadOnly": true, +	"PerformanceTiming": false, +	"PerformanceMark": true, +	"ImageBitmapRenderingContext": true, +	"Headers": true, +	"Range": false, +	"Rect": true, +	"AnimationEffectTimingReadOnly": true, +	"KeyframeEffect": true, +	"Permissions": true, +	"TextEncoder": true, +	"ImageData": true, +	"SpeechSynthesisVoice": true, +	"StorageManager": true, +	"TextTrackCue": true, +	"WebSocket": true, +	"DocumentType": true, +	"XPathEvaluator": true, +	"PerformanceNavigationTiming": true, +	"IdleDeadline": true, +	"FileSystem": true, +	"FileSystemFileEntry": true, +	"CacheStorage": true, +	"MimeType": true, +	"PannerNode": true, +	"NodeFilter": true, +	"StereoPannerNode": true, +	"console": false, +	"DynamicsCompressorNode": true, +	"PaintRequest": true, +	"RGBColor": true, +	"FontFaceSet": false, +	"PaintRequestList": true, +	"FileSystemEntry": true, +	"XMLDocument": false, +	"SourceBuffer": false, +	"Screen": true, +	"NamedNodeMap": false, +	"History": true, +	"Response": true, +	"AnimationEffectTiming": true, +	"ServiceWorkerRegistration": true, +	"CanvasRenderingContext2D": true, +	"ScriptProcessorNode": true, +	"FileSystemDirectoryReader": true, +	"MimeTypeArray": true, +	"CanvasCaptureMediaStream": true, +	"Directory": true, +	"mozRTCPeerConnection": true, +	"PerformanceObserverEntryList": true, +	"PushSubscriptionOptions": true, +	"Text": false, +	"IntersectionObserverEntry": true, +	"SubtleCrypto": true, +	"Animation": true, +	"DataTransfer": true, +	"TreeWalker": true, +	"XMLHttpRequest": true, +	"LocalMediaStream": true, +	"ConvolverNode": true, +	"WaveShaperNode": true, +	"DataTransferItemList": false, +	"Request": true, +	"SourceBufferList": false, +	"XSLTProcessor": true, +	"XMLHttpRequestUpload": true, +	"SharedWorker": true, +	"Notification": false, +	"DataTransferItem": true, +	"AnalyserNode": true, +	"mozRTCIceCandidate": true, +	"PerformanceObserver": true, +	"OfflineResourceList": true, +	"FileSystemDirectoryEntry": true, +	"DesktopNotification": false, +	"DataChannel": true, +	"IIRFilterNode": true, +	"ChannelSplitterNode": true, +	"File": true, +	"ConstantSourceNode": true, +	"CryptoKey": true, +	"GainNode": true, +	"AbortController": true, +	"Attr": true, +	"SpeechSynthesis": true, +	"PushSubscription": false, +	"XMLStylesheetProcessingInstruction": false, +	"NodeIterator": true, +	"VideoStreamTrack": true, +	"XMLSerializer": true, +	"CaretPosition": true, +	"FormData": true, +	"CanvasPattern": true, +	"mozRTCSessionDescription": true, +	"Path2D": true, +	"PerformanceNavigation": true, +	"URL": false, +	"PluginArray": true, +	"MutationRecord": true, +	"WebKitCSSMatrix": true, +	"PeriodicWave": true, +	"DocumentFragment": true, +	"DocumentTimeline": false, +	"ScreenOrientation": true, +	"BroadcastChannel": true, +	"PermissionStatus": true, +	"IntersectionObserver": true, +	"Blob": true, +	"MessagePort": true, +	"BarProp": true, +	"OscillatorNode": true, +	"Cache": true, +	"RadioNodeList": true, +	"KeyframeEffectReadOnly": true, +	"InstallTrigger": true, +	"Function": false, +	"Object": false, +	"eval": true, +	"Window": false, +	"close": false, +	"stop": false, +	"focus": false, +	"blur": false, +	"open": true, +	"alert": false, +	"confirm": false, +	"prompt": false, +	"print": false, +	"postMessage": true, +	"getSelection": true, +	"getComputedStyle": true, +	"matchMedia": true, +	"moveTo": false, +	"moveBy": false, +	"resizeTo": false, +	"resizeBy": false, +	"scroll": false, +	"scrollTo": false, +	"scrollBy": false, +	"requestAnimationFrame": true, +	"cancelAnimationFrame": true, +	"getDefaultComputedStyle": false, +	"scrollByLines": false, +	"scrollByPages": false, +	"sizeToContent": false, +	"updateCommands": true, +	"find": false, +	"dump": true, +	"setResizable": false, +	"requestIdleCallback": false, +	"cancelIdleCallback": false, +	"btoa": true, +	"atob": true, +	"setTimeout": true, +	"clearTimeout": true, +	"setInterval": true, +	"clearInterval": true, +	"createImageBitmap": true, +	"fetch": true, +	"self": true, +	"name": false, +	"history": true, +	"locationbar": true, +	"menubar": true, +	"personalbar": true, +	"scrollbars": true, +	"statusbar": true, +	"toolbar": true, +	"status": true, +	"closed": true, +	"frames": true, +	"length": false, +	"opener": true, +	"parent": true, +	"frameElement": true, +	"navigator": true, +	"external": true, +	"applicationCache": true, +	"screen": true, +	"innerWidth": true, +	"innerHeight": true, +	"scrollX": true, +	"pageXOffset": true, +	"scrollY": true, +	"pageYOffset": true, +	"screenX": true, +	"screenY": true, +	"outerWidth": true, +	"outerHeight": true, +	"performance": true, +	"mozInnerScreenX": true, +	"mozInnerScreenY": true, +	"devicePixelRatio": true, +	"scrollMaxX": true, +	"scrollMaxY": true, +	"fullScreen": false, +	"mozPaintCount": true, +	"sidebar": false, +	"crypto": true, +	"speechSynthesis": true, +	"localStorage": true, +	"origin": true, +	"isSecureContext": false, +	"indexedDB": true, +	"caches": true, +	"sessionStorage": true, +	"window": false, +	"document": true, +	"location": false, +	"top": true, +	"netscape": true, +	"Node": true, +	"Document": true, +	"Performance": false, +	"startProfiling": true, +	"stopProfiling": true, +	"pauseProfilers": true, +	"resumeProfilers": true, +	"dumpProfile": true, +	"getMaxGCPauseSinceClear": true, +	"clearMaxGCPauseAccumulator": true, +	"Location": true, +	"StyleSheetList": false, +	"Selection": false, +	"Element": true, +	"AnonymousContent": false, +	"MutationObserver": true, +	"NodeList": true, +	"StopIteration": true +}; + + +var DEBUG = true; +/** +*	Loop over a function and get a list of things being called. +* +*	Tests to see if the function calls itself. +*	 +*	Note: If it is an anonmyous function, recursion isn't possible. +* +*/ +function get_function_names(input_node_src,scope){ +	var func_name = ""; +	var flag = true; + +	// The name of the function can't appear anywhere. +	// No bracket suffix notation either. +	console.log("Searching for identifier '"+scope+"'"); +	 +	var tokens = acorn_base.tokenizer(input_node_src); +	var toke = tokens.getToken(); +	while(toke.type != acorn_base.tokTypes.eof){ +		if(toke.type.label == "name" && scope == toke.value){ +			return true; +		} +		toke = tokens.getToken(); +	} -window.onload = function () { +	return false; +} -	document.getElementById("parse").addEventListener("click",function(){ -	 -		var ast = acorn.parse_dammit(document.getElementById("input").value).body[0]; -		document.getElementById("output").innerHTML = JSON.stringify(ast, null, "\t"); // Indented with tab -		console.log(ast); +function test_function_name(name){ +	var res = fname_data[name]; +	if(res == false){ +		console.log("'"+name+"'"+" is trivial.");	 +		return false; +	} +	if(res == true){ +		console.log("%cNONTRIVIAL:'"+name+"'"+" is non-trivial.","color:red");	 +		return true;	 +	} +	console.log("%cNONTRIVIAL:'"+name+"'"+" is probably user defined.","color:red");	 +	return false; + +} +//746 + +function full_evaluate(script){ +		var res = true;		 +		if(script === undefined || script == ""){ +			return true; +		} +		var ast = acorn.parse_dammit(script).body[0];  		var flag = false;  		var amtloops = 0; -		walk.recursive(ast, null, { -			Literal(node, state, c) { -				console.log("literal"); -			}, -			Identifier(node, state, c){ -				if(state.called === true){ -					console.log("calls '"+node.name+"'"); -				} -			}, -			// The beggining of an "object chain" (obj1.obj2().property.value......) -			ExpressionStatement(node, state, c) { -				c(node["expression"],{}); -			}, -			CallExpression(node, state, c) { -				console.log("CallExpression"); -				c(node["callee"],{"called":true}); -				for(var i = 0; i < node.arguments.length; i++){ -					console.log(node.arguments[i]); -					c(node.arguments[i],{}); -				} -			}, -			MemberExpression(node, state, c){ -				if(state.called === true){ -					console.log("calls '"+node.property.name+"'"); -				} -				c(node["object"],{}); -			}, -			ArrayExpression(node, state, c){ -				var len = 0; -				try{ -					var temp = script.substring(node["start"],node["end"]); -					len = JSON.parse(temp).length; -				} catch(e){ -					console.warn("Invalid array?"); -					len = 99; -				} -				if(len > 50){ -					console.log("%c NONTRIVIAL: Array longer than 50 elements. ("+len+")","color:red"); -					flag = false; -				} - -			}, -			ForInStatement(node, state, c){ -				console.log("ForInStatement"); +		// COUNTS LOOPS AND CONDITIONALS +		walk.simple(ast, { +			ForInStatement(node){ +				if(amtloops > 3){return;}				  				amtloops++;  			}, -			ForStatement(node, state, c){ -				console.log("ForStatement"); +			ForStatement(node){ +				if(amtloops > 3){return;}  				amtloops++;  			}, -			DoWhileStatement(node, state, c){ -				console.log("DoWhileStatement"); +			DoWhileStatement(node){ +				if(amtloops > 3){return;}  				amtloops++;  			}, -			WhileStatement(node, state, c){ -				console.log("WhileStatement"); +			WhileStatement(node){ +				if(amtloops > 3){return;}  				amtloops++;  			}, -			IfStatement(node, state, c){ -				console.log("IfStatement"); -				c(node.test,{}); -				c(node.consequent,{}); +			IfStatement(node){ +				if(amtloops > 3){return;}  				amtloops++;  			}, -			SwitchStatement(node, state, c){ -				console.log("SwitchStatement"); +			SwitchStatement(node){ +				if(amtloops > 3){return;}  				amtloops++;  			} -  		}); -		if(flag == false){ -			return false; -		} +  		if(amtloops > 3){  			console.log("%c NONTRIVIAL: Too many loops/conditionals.","color:red"); +			if(DEBUG == false){			 +				return false; +			}		 +		} +		// Detect which objects are referenced and which functions are called +		// Only cares about top level objects. Window is special because we will test its methods. +		var nontrivial = false; + +		// Has a while loop to cut down on recursion when not needed  +		function read(lnode){ +			while(true){ +				// window.test() +				if(lnode.type == "CallExpression"){ +					if(lnode.property !== undefined){ +						last_name = lnode.property.name;	 +					} +					lnode = lnode.callee; +				// window.test +				}else if(lnode.type == "MemberExpression"){ +					last_name = lnode.property.name; +					// This may be bracket suffix notation +					lnode = lnode.object;			 +				// We should be at the first in the chain.		 +				}else if(lnode.type == "Identifier"){ +					// Since window is the global object, it is special +					if(lnode.name == "window"){ +						return test_function_name(last_name); +					} else{ +						return test_function_name(lnode.name); +					} +				}else if(lnode.type == "BinaryExpression"){ +					// recurse on left side +					if(read(lnode.left) == true){ +						return true; +					} +					// continue on right side +					last_name = lnode.operator; +					// This may be bracket suffix notation +					lnode = lnode.right; +				}else if(lnode.type == "AssignmentExpression"){ +					// recurse on left side +					if(read(lnode.left) == true){ +						return true; +					} +					// continue on right side +					last_name = lnode.operator; +					// This may be bracket suffix notation +					lnode = lnode.right;	 +				}else if(lnode.type == "FunctionExpression"){ +					console.log("%cDefines a function.","color:red"); +					return true; +				}else{ +					console.log("Unrecognized:"); +					console.log(lnode); +					return; +				} +				//console.log(last_name+":"+lnode.name); +			} + +		} + +		walk.simple(ast, { +			ExpressionStatement(node){ +				if(nontrivial == true && DEBUG == false){ +					return; +				} +				// Get the first thing in the expression	 +				if(node === undefined){ +					return; +				} +				var lnode = node.expression;				 +				var last_name = ""; +				console.log("%cReading ExpressionStatement","color:green"); +				read(lnode,last_name); +			}, FunctionExpression(node){ +				//  +			} +		}); + +		if(nontrivial == true){  			return false;  		} + +		return true; +} +window.onload = function () { +	document.getElementById("parse").addEventListener("click",function(){ +		var script = document.getElementById("input").value; +		var ast = acorn.parse_dammit(script).body[0]; +		document.getElementById("output").innerHTML = JSON.stringify(ast, null, '\t'); // Indented with tab +		document.getElementById("output").innerHTML = full_evaluate(script) + "\n\n" + document.getElementById("output").innerHTML;  	});  } -},{"acorn/dist/acorn_loose":3,"acorn/dist/walk":4}],2:[function(require,module,exports){ +},{"acorn":2,"acorn/dist/acorn_loose":3,"acorn/dist/walk":4}],2:[function(require,module,exports){  (function (global, factory) {  	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :  	typeof define === 'function' && define.amd ? define(['exports'], factory) :  | 
