From d64e16f72ef199485291dafa4551f2f58dae9b73 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Mon, 1 Jul 2013 21:44:26 -0700 Subject: [PATCH] Goodbye, blacklist! --- tools/linker.js | 240 ------------------------------------------------ 1 file changed, 240 deletions(-) diff --git a/tools/linker.js b/tools/linker.js index 8e41d8bcf8..8c7037d240 100644 --- a/tools/linker.js +++ b/tools/linker.js @@ -723,246 +723,6 @@ var getImportCode = function (imports, header, omitvar) { return buf; }; -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// From Chome. Open a console on an empty tab and call: -// Object.getOwnPropertyNames(this).join('", "') -// Object.getOwnPropertyNames(Object.getPrototypeOf(this)).join('", "') -// I'm not sure why window has a prototype, but it does, and that -// prototype contains important stuff like setTimeout. -// Additionally I manually added a few symbols at the bottom. -var blacklistedSymbols = [ - // Object.getOwnPropertyNames(this).join('", "') - "eval", "$", "ntp", "findAncestorByClass", "escape", "undefined", - "decodeURI", "eventLog", "url", "isRTL", "encodeURIComponent", - "getRequiredElement", "chromeSend", "getFaviconURL", "logEvent", - "parseHtmlSubset", "isNaN", "preventDefaultOnPoundLinkClicks", - "Date", "window", "Math", "RangeError", "i18nTemplate", "NaN", - "cr", "appendParam", "String", "decodeURIComponent", - "findAncestor", "external", "unescape", "SyntaxError", "isFinite", - "v8Intl", "RegExp", "location", "TypeError", "Function", "toCssPx", - "document", "assert", "Object", "ReferenceError", "loadTimeData", - "parseInt", "chrome", "EventTracker", "disableTextSelectAndDrag", - "EvalError", "parseQueryParams", "Infinity", "swapDomNodes", - "encodeURI", "top", "Intl", "global", "Error", "Array", "URIError", - "parseFloat", "JSON", "Number", "Boolean", "WebSocket", - "webkitRTCPeerConnection", "webkitMediaStream", - "webkitOfflineAudioContext", "webkitAudioContext", - "webkitSpeechGrammarList", "webkitSpeechGrammar", - "webkitSpeechRecognitionEvent", "webkitSpeechRecognitionError", - "webkitSpeechRecognition", "webkitNotifications", - "WebKitSourceBufferList", "WebKitSourceBuffer", - "WebKitMediaSource", "SharedWorker", "DeviceOrientationEvent", - "MediaController", "HTMLSourceElement", "TimeRanges", "MediaError", - "HTMLVideoElement", "HTMLMediaElement", "HTMLAudioElement", - "Audio", "TrackEvent", "TextTrackList", "TextTrackCueList", - "TextTrackCue", "TextTrack", "HTMLTrackElement", - "HTMLShadowElement", "HTMLContentElement", "WebKitShadowRoot", - "localStorage", "sessionStorage", "applicationCache", "CloseEvent", - "MediaStreamEvent", "RTCIceCandidate", "RTCSessionDescription", - "OfflineAudioCompletionEvent", "AudioProcessingEvent", - "webkitAudioPannerNode", "SQLException", "IDBVersionChangeEvent", - "IDBTransaction", "IDBRequest", "IDBOpenDBRequest", - "IDBObjectStore", "IDBKeyRange", "IDBIndex", "IDBFactory", - "IDBDatabase", "IDBCursorWithValue", "IDBCursor", "indexedDB", - "webkitIDBTransaction", "webkitIDBRequest", "webkitIDBObjectStore", - "webkitIDBKeyRange", "webkitIDBIndex", "webkitIDBFactory", - "webkitIDBDatabase", "webkitIDBCursor", "webkitIndexedDB", - "webkitStorageInfo", "Notification", "WebKitMutationObserver", - "webkitURL", "URL", "FileReader", "FileError", "FormData", - "SVGFilterElement", "SVGFETurbulenceElement", "SVGFETileElement", - "SVGFESpotLightElement", "SVGFESpecularLightingElement", - "SVGFEPointLightElement", "SVGFEOffsetElement", - "SVGFEMorphologyElement", "SVGFEMergeNodeElement", - "SVGFEMergeElement", "SVGFEImageElement", - "SVGFEGaussianBlurElement", "SVGFEFuncRElement", - "SVGFEFuncGElement", "SVGFEFuncBElement", "SVGFEFuncAElement", - "SVGFEFloodElement", "SVGFEDropShadowElement", - "SVGFEDistantLightElement", "SVGFEDisplacementMapElement", - "SVGFEDiffuseLightingElement", "SVGFEConvolveMatrixElement", - "SVGFECompositeElement", "SVGFEComponentTransferElement", - "SVGFEColorMatrixElement", "SVGFEBlendElement", - "SVGComponentTransferFunctionElement", "SVGVKernElement", - "SVGMissingGlyphElement", "SVGHKernElement", "SVGGlyphRefElement", - "SVGGlyphElement", "SVGFontFaceUriElement", - "SVGFontFaceSrcElement", "SVGFontFaceNameElement", - "SVGFontFaceFormatElement", "SVGFontFaceElement", "SVGFontElement", - "SVGAltGlyphItemElement", "SVGAltGlyphElement", - "SVGAltGlyphDefElement", "SVGSetElement", "SVGMPathElement", - "SVGAnimateTransformElement", "SVGAnimateMotionElement", - "SVGAnimateElement", "SVGAnimateColorElement", "SVGZoomAndPan", - "SVGViewSpec", "SVGViewElement", "SVGUseElement", "SVGUnitTypes", - "SVGTSpanElement", "SVGTRefElement", "SVGTransformList", - "SVGTransform", "SVGTitleElement", "SVGTextPositioningElement", - "SVGTextPathElement", "SVGTextElement", "SVGTextContentElement", - "SVGSymbolElement", "SVGSwitchElement", "SVGSVGElement", - "SVGStyleElement", "SVGStringList", "SVGStopElement", - "SVGScriptElement", "SVGRenderingIntent", "SVGRectElement", - "SVGRect", "SVGRadialGradientElement", "SVGPreserveAspectRatio", - "SVGPolylineElement", "SVGPolygonElement", "SVGPointList", - "SVGPoint", "SVGPatternElement", "SVGPathSegMovetoRel", - "SVGPathSegMovetoAbs", "SVGPathSegList", - "SVGPathSegLinetoVerticalRel", "SVGPathSegLinetoVerticalAbs", - "SVGPathSegLinetoRel", "SVGPathSegLinetoHorizontalRel", - "SVGPathSegLinetoHorizontalAbs", "SVGPathSegLinetoAbs", - "SVGPathSegCurvetoQuadraticSmoothRel", - "SVGPathSegCurvetoQuadraticSmoothAbs", - "SVGPathSegCurvetoQuadraticRel", "SVGPathSegCurvetoQuadraticAbs", - "SVGPathSegCurvetoCubicSmoothRel", - "SVGPathSegCurvetoCubicSmoothAbs", "SVGPathSegCurvetoCubicRel", - "SVGPathSegCurvetoCubicAbs", "SVGPathSegClosePath", - "SVGPathSegArcRel", "SVGPathSegArcAbs", "SVGPathSeg", - "SVGPathElement", "SVGPaint", "SVGNumberList", "SVGNumber", - "SVGMetadataElement", "SVGMatrix", "SVGMaskElement", - "SVGMarkerElement", "SVGLineElement", "SVGLinearGradientElement", - "SVGLengthList", "SVGLength", "SVGImageElement", - "SVGGradientElement", "SVGGElement", "SVGException", - "SVGForeignObjectElement", "SVGEllipseElement", - "SVGElementInstanceList", "SVGElementInstance", "SVGElement", - "SVGDocument", "SVGDescElement", "SVGDefsElement", - "SVGCursorElement", "SVGColor", "SVGClipPathElement", - "SVGCircleElement", "SVGAnimatedTransformList", - "SVGAnimatedString", "SVGAnimatedRect", - "SVGAnimatedPreserveAspectRatio", "SVGAnimatedNumberList", - "SVGAnimatedNumber", "SVGAnimatedLengthList", "SVGAnimatedLength", - "SVGAnimatedInteger", "SVGAnimatedEnumeration", - "SVGAnimatedBoolean", "SVGAnimatedAngle", "SVGAngle", - "SVGAElement", "SVGZoomEvent", "XPathException", "XPathResult", - "XPathEvaluator", "Storage", "ClientRectList", "ClientRect", - "MimeTypeArray", "MimeType", "PluginArray", "Plugin", - "MessageChannel", "MessagePort", "XSLTProcessor", - "XMLHttpRequestException", "XMLHttpRequestUpload", - "XMLHttpRequest", "XMLSerializer", "DOMParser", "XMLDocument", - "EventSource", "RangeException", "Range", "NodeFilter", "Blob", - "FileList", "File", "Worker", "Clipboard", "WebKitPoint", - "WebKitCSSMatrix", "WebKitCSSKeyframesRule", - "WebKitCSSKeyframeRule", "EventException", "WebGLContextEvent", - "SpeechInputEvent", "StorageEvent", "TouchEvent", - "XMLHttpRequestProgressEvent", "WheelEvent", - "WebKitTransitionEvent", "WebKitAnimationEvent", "UIEvent", - "TextEvent", "ProgressEvent", "PageTransitionEvent", - "PopStateEvent", "OverflowEvent", "MutationEvent", "MouseEvent", - "MessageEvent", "KeyboardEvent", "HashChangeEvent", "ErrorEvent", - "CustomEvent", "CompositionEvent", "BeforeLoadEvent", "Event", - "DataView", "Float64Array", "Float32Array", "Uint32Array", - "Int32Array", "Uint16Array", "Int16Array", "Uint8ClampedArray", - "Uint8Array", "Int8Array", "ArrayBufferView", "ArrayBuffer", - "DOMStringMap", "WebGLUniformLocation", "WebGLTexture", - "WebGLShaderPrecisionFormat", "WebGLShader", - "WebGLRenderingContext", "WebGLRenderbuffer", "WebGLProgram", - "WebGLFramebuffer", "WebGLBuffer", "WebGLActiveInfo", - "TextMetrics", "ImageData", "CanvasRenderingContext2D", - "CanvasGradient", "CanvasPattern", "Option", "Image", - "HTMLUnknownElement", "HTMLOptionsCollection", - "HTMLFormControlsCollection", "HTMLAllCollection", - "HTMLCollection", "HTMLUListElement", "HTMLTitleElement", - "HTMLTextAreaElement", "HTMLTableSectionElement", - "HTMLTableRowElement", "HTMLTableElement", "HTMLTableColElement", - "HTMLTableCellElement", "HTMLTableCaptionElement", - "HTMLStyleElement", "HTMLSpanElement", "HTMLSelectElement", - "HTMLScriptElement", "HTMLQuoteElement", "HTMLProgressElement", - "HTMLPreElement", "HTMLParamElement", "HTMLParagraphElement", - "HTMLOutputElement", "HTMLOptionElement", "HTMLOptGroupElement", - "HTMLObjectElement", "HTMLOListElement", "HTMLModElement", - "HTMLMeterElement", "HTMLMetaElement", "HTMLMenuElement", - "HTMLMarqueeElement", "HTMLMapElement", "HTMLLinkElement", - "HTMLLegendElement", "HTMLLabelElement", "HTMLLIElement", - "HTMLKeygenElement", "HTMLInputElement", "HTMLImageElement", - "HTMLIFrameElement", "HTMLHtmlElement", "HTMLHeadingElement", - "HTMLHeadElement", "HTMLHRElement", "HTMLFrameSetElement", - "HTMLFrameElement", "HTMLFormElement", "HTMLFontElement", - "HTMLFieldSetElement", "HTMLEmbedElement", "HTMLDivElement", - "HTMLDirectoryElement", "HTMLDataListElement", "HTMLDListElement", - "HTMLCanvasElement", "HTMLButtonElement", "HTMLBodyElement", - "HTMLBaseFontElement", "HTMLBaseElement", "HTMLBRElement", - "HTMLAreaElement", "HTMLAppletElement", "HTMLAnchorElement", - "HTMLElement", "HTMLDocument", "Window", "Selection", - "ProcessingInstruction", "EntityReference", "Entity", "Notation", - "DocumentType", "CDATASection", "Comment", "Text", "Element", - "Attr", "CharacterData", "NamedNodeMap", "NodeList", "Node", - "Document", "DocumentFragment", "DOMTokenList", - "DOMSettableTokenList", "DOMImplementation", "DOMStringList", - "DOMException", "StyleSheetList", "RGBColor", "Rect", - "CSSRuleList", "Counter", "MediaList", "CSSStyleDeclaration", - "CSSStyleRule", "CSSPageRule", "CSSMediaRule", "CSSImportRule", - "CSSFontFaceRule", "CSSCharsetRule", "CSSRule", - "WebKitCSSFilterValue", "WebKitCSSMixFunctionValue", - "WebKitCSSTransformValue", "CSSValueList", "CSSPrimitiveValue", - "CSSValue", "CSSStyleSheet", "StyleSheet", "performance", - "console", "devicePixelRatio", "styleMedia", "parent", "opener", - "frames", "self", "defaultstatus", "defaultStatus", "status", - "name", "length", "closed", "pageYOffset", "pageXOffset", - "scrollY", "scrollX", "screenTop", "screenLeft", "screenY", - "screenX", "innerWidth", "innerHeight", "outerWidth", - "outerHeight", "offscreenBuffering", "frameElement", "event", - "crypto", "clientInformation", "navigator", "toolbar", "statusbar", - "scrollbars", "personalbar", "menubar", "locationbar", "history", - "screen", - - // Object.getOwnPropertyNames(Object.getPrototypeOf(this)).join('", "') - "toString", "postMessage", "close", "blur", "focus", - "ondeviceorientation", "onwebkittransitionend", - "onwebkitanimationstart", "onwebkitanimationiteration", - "onwebkitanimationend", "onsearch", "onreset", "onwaiting", - "onvolumechange", "onunload", "ontimeupdate", "onsuspend", - "onsubmit", "onstorage", "onstalled", "onselect", "onseeking", - "onseeked", "onscroll", "onresize", "onratechange", "onprogress", - "onpopstate", "onplaying", "onplay", "onpause", "onpageshow", - "onpagehide", "ononline", "onoffline", "onmousewheel", "onmouseup", - "onmouseover", "onmouseout", "onmousemove", "onmousedown", - "onmessage", "onloadstart", "onloadedmetadata", "onloadeddata", - "onload", "onkeyup", "onkeypress", "onkeydown", "oninvalid", - "oninput", "onhashchange", "onfocus", "onerror", "onended", - "onemptied", "ondurationchange", "ondrop", "ondragstart", - "ondragover", "ondragleave", "ondragenter", "ondragend", "ondrag", - "ondblclick", "oncontextmenu", "onclick", "onchange", - "oncanplaythrough", "oncanplay", "onblur", "onbeforeunload", - "onabort", "getSelection", "print", "stop", "open", - "showModalDialog", "alert", "confirm", "prompt", "find", - "scrollBy", "scrollTo", "scroll", "moveBy", "moveTo", "resizeBy", - "resizeTo", "matchMedia", "setTimeout", "clearTimeout", - "setInterval", "clearInterval", "requestAnimationFrame", - "cancelAnimationFrame", "webkitRequestAnimationFrame", - "webkitCancelAnimationFrame", "webkitCancelRequestAnimationFrame", - "atob", "btoa", "addEventListener", "removeEventListener", - "captureEvents", "releaseEvents", "getComputedStyle", - "getMatchedCSSRules", "webkitConvertPointFromPageToNode", - "webkitConvertPointFromNodeToPage", "dispatchEvent", - "webkitRequestFileSystem", "webkitResolveLocalFileSystemURL", - "openDatabase", "TEMPORARY", "PERSISTENT", "constructor", - - // Additional, manually added symbols. - - // We're going to need 'arguments' - "arguments", - - // This is how we do imports and exports - "Package", - - // Meteor provides these at runtime - "Npm", "__meteor_runtime_config__", "__meteor_bootstrap__", "Assets", - - // A node-ism (and needed by the 'meteor' package to read the - // environment to bootstrap __meteor_runtime_config__, though - // probably we should find a better way to do that) - "process", - - // Another node global - "Buffer", - - // These are used by sockjs. (XXX before this - // goes out the door, it needs to switch to detecting assignment - // rather than using a blacklist, or at the very very least it needs - // to have a blacklist that includes all the major browsers.) - "ActiveXObject", "CollectGarbage", "XDomainRequest" -]; - -var blacklist = {}; -_.each(blacklistedSymbols, function (name) { - blacklist[name] = true; -}); - var linker = module.exports = { prelink: prelink, link: link