GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Unverified Commit 5c978152 authored by boklm's avatar boklm
Browse files

Add a dom-objects-enumeration test

This test enumerates all DOM objects exposed in the global namespace
and produce an error if one of them is not in the expected list.

This test has been suggested in the iSEC partners' report:
https://blog.torproject.org/blog/isec-partners-conducts-tor-browser-hardening-study
parent be528bc8
......@@ -192,7 +192,12 @@ our @tests = (
type => 'mozmill',
descr => 'Check that some important settings are correctly set',
},
{
{
name => 'dom-objects-enumeration',
type => 'mozmill',
descr => 'Check the list of DOM Objects exposed in the global namespace',
},
{
name => 'fp_screen_dimensions',
type => 'selenium',
descr => 'Check that screen dimensions are spoofed correctly',
......
// This test enumerates all DOM objects exposed in the global namespace
// and produce an error if one of them is not in the expected list.
//
// This test has been suggested in the iSEC partners' report:
// https://blog.torproject.org/blog/isec-partners-conducts-tor-browser-hardening-study
"use strict";
var {expect} = require("../mozilla-mozmill-tests/lib/assertions");
// The list of expected DOM objects
const interfaceNamesInGlobalScope =
[
"adjustToolbarIconArrow",
"AnimationEvent",
"Application",
"ArchiveRequest",
"Array",
"ArrayBuffer",
"AsyncScrollEventDetail",
"Attr",
"Audio",
"AudioStreamTrack",
"BarProp",
"BatteryManager",
"BeforeUnloadEvent",
"Blob",
"BlobEvent",
"Boolean",
"BoxObject",
"BrowserFeedWriter",
"CameraCapabilities",
"CameraControl",
"CameraManager",
"CanvasGradient",
"CanvasPattern",
"CanvasRenderingContext2D",
"CaretPosition",
"CDATASection",
"CharacterData",
"ChromeMessageBroadcaster",
"ChromeMessageSender",
"ChromeWindow",
"ClientInformation",
"ClientRect",
"ClientRectList",
"ClipboardEvent",
"CloseEvent",
"CommandEvent",
"Comment",
"Components",
"CompositionEvent",
"console",
"Contact",
"ContactManager",
"ContentFrameMessageManager",
"Controllers",
"Counter",
"CRMFObject",
"Crypto",
"CryptoDialogs",
"CSS",
"CSS2Properties",
"CSSCharsetRule",
"CSSConditionRule",
"CSSFontFaceRule",
"CSSFontFeatureValuesRule",
"CSSGroupingRule",
"CSSGroupRuleRuleList",
"CSSImportRule",
"CSSMediaRule",
"CSSMozDocumentRule",
"CSSNameSpaceRule",
"CSSPageRule",
"CSSPrimitiveValue",
"CSSRect",
"CSSRule",
"CSSRuleList",
"CSSStyleDeclaration",
"CSSStyleRule",
"CSSStyleSheet",
"CSSSupportsRule",
"CSSUnknownRule",
"CSSValue",
"CSSValueList",
"CustomEvent",
"DataChannel",
"DataContainerEvent",
"DataErrorEvent",
"DataTransfer",
"DataView",
"Date",
"decodeURI",
"decodeURIComponent",
"DesktopNotification",
"DesktopNotificationCenter",
"DeviceAcceleration",
"DeviceLightEvent",
"DeviceMotionEvent",
"DeviceOrientationEvent",
"DeviceProximityEvent",
"DeviceRotationRate",
"DeviceStorage",
"DeviceStorageChangeEvent",
"DeviceStorageCursor",
"document",
"Document",
"DocumentFragment",
"DocumentTouch",
"DocumentType",
"DocumentXBL",
"DOMCursor",
"DOMError",
"DOMException",
"DOMImplementation",
"DOMParser",
"DOMRequest",
"DOMSettableTokenList",
"DOMStringList",
"DOMStringMap",
"DOMTokenList",
"DOMTransactionEvent",
"DragEvent",
"Element",
"ElementCSSInlineStyle",
"ElementReplaceEvent",
"ElementTimeControl",
"encodeURI",
"encodeURIComponent",
"Error",
"escape",
"eval",
"EvalError",
"Event",
"EventListener",
"EventListenerInfo",
"EventSource",
"EventTarget",
"external",
"File",
"FileHandle",
"FileList",
"FileReader",
"FileRequest",
"Float32Array",
"Float64Array",
"FocusEvent",
"FontFace",
"FontFaceList",
"FormData",
"Function",
"FutureResolver",
"Gamepad",
"GamepadAxisMoveEvent",
"GamepadButtonEvent",
"GamepadEvent",
"GeoGeolocation",
"GeoPosition",
"GeoPositionCallback",
"GeoPositionCoords",
"GeoPositionError",
"GeoPositionErrorCallback",
"getInterface",
"GetUserMediaErrorCallback",
"GetUserMediaSuccessCallback",
"GlobalObjectConstructor",
"GlobalPropertyInitializer",
"HashChangeEvent",
"History",
"HTMLAnchorElement",
"HTMLAppletElement",
"HTMLAreaElement",
"HTMLAudioElement",
"HTMLBaseElement",
"HTMLBodyElement",
"HTMLBRElement",
"HTMLButtonElement",
"HTMLByteRanges",
"HTMLCanvasElement",
"HTMLCollection",
"HTMLCommandElement",
"HTMLDataElement",
"HTMLDataListElement",
"HTMLDirectoryElement",
"HTMLDivElement",
"HTMLDListElement",
"HTMLDocument",
"HTMLElement",
"HTMLEmbedElement",
"HTMLFieldSetElement",
"HTMLFontElement",
"HTMLFormElement",
"HTMLFrameElement",
"HTMLFrameSetElement",
"HTMLHeadElement",
"HTMLHeadingElement",
"HTMLHRElement",
"HTMLHtmlElement",
"HTMLIFrameElement",
"HTMLImageElement",
"HTMLInputElement",
"HTMLLabelElement",
"HTMLLegendElement",
"HTMLLIElement",
"HTMLLinkElement",
"HTMLMapElement",
"HTMLMediaElement",
"HTMLMenuElement",
"HTMLMenuItemElement",
"HTMLMetaElement",
"HTMLMeterElement",
"HTMLModElement",
"HTMLObjectElement",
"HTMLOListElement",
"HTMLOptGroupElement",
"HTMLOptionElement",
"HTMLOptionsCollection",
"HTMLOutputElement",
"HTMLParagraphElement",
"HTMLParamElement",
"HTMLPreElement",
"HTMLProgressElement",
"HTMLPropertiesCollection",
"HTMLQuoteElement",
"HTMLScriptElement",
"HTMLSelectElement",
"HTMLSourceElement",
"HTMLSpanElement",
"HTMLStyleElement",
"HTMLTableCaptionElement",
"HTMLTableCellElement",
"HTMLTableColElement",
"HTMLTableElement",
"HTMLTableRowElement",
"HTMLTableSectionElement",
"HTMLTemplateElement",
"HTMLTextAreaElement",
"HTMLTimeElement",
"HTMLTitleElement",
"HTMLUListElement",
"HTMLUnknownElement",
"HTMLVideoElement",
"IDBCursor",
"IDBCursorWithValue",
"IDBDatabase",
"IDBFactory",
"IDBIndex",
"IDBKeyRange",
"IDBObjectStore",
"IDBOpenDBRequest",
"IDBRequest",
"IDBTransaction",
"IDBVersionChangeEvent",
"Image",
"ImageData",
"ImageDocument",
"Infinity",
"insertPropertyStrings",
"InstallTrigger",
"Int16Array",
"Int32Array",
"Int8Array",
"InternalError",
"isFinite",
"isNaN",
"Iterator",
"JSON",
"JSWindow",
"KeyboardEvent",
"KeyEvent",
"LinkStyle",
"LoadStatus",
"LocalMediaStream",
"Location",
"LockedFile",
"LSProgressEvent",
"Map",
"Math",
"MediaError",
"MediaList",
"MediaQueryList",
"MediaQueryListListener",
"MediaStream",
"MediaStreamTrack",
"MessageEvent",
"MimeType",
"MimeTypeArray",
"ModalContentWindow",
"MouseEvent",
"MouseScrollEvent",
"MozAlarmsManager",
"MozApplicationEvent",
"MozBlobBuilder",
"MozBrowserFrame",
"MozCanvasPrintState",
"MozConnection",
"MozContactChangeEvent",
"MozCSSKeyframeRule",
"MozCSSKeyframesRule",
"MozMmsEvent",
"MozMmsMessage",
"MozMobileCellInfo",
"MozMobileConnectionInfo",
"MozMobileMessageManager",
"MozMobileMessageThread",
"MozMobileNetworkInfo",
"MozNamedAttrMap",
"MozNavigatorMobileMessage",
"MozNavigatorNetwork",
"MozNavigatorSms",
"MozNavigatorTime",
"MozNetworkStats",
"MozNetworkStatsData",
"MozNetworkStatsManager",
"MozPowerManager",
"MozSettingsEvent",
"MozSmsEvent",
"MozSmsFilter",
"MozSmsManager",
"MozSmsMessage",
"MozSmsSegmentInfo",
"MozTimeManager",
"MozTouchEvent",
"MozWakeLock",
"MozWakeLockListener",
"MutationEvent",
"MutationObserver",
"MutationRecord",
"NaN",
"navigator",
"Navigator",
"NavigatorCamera",
"NavigatorDesktopNotification",
"NavigatorDeviceStorage",
"NavigatorGeolocation",
"NavigatorUserMedia",
"netscape",
"Node",
"NodeFilter",
"NodeIterator",
"NodeList",
"NodeSelector",
"__noscriptStorage",
"Notification",
"NotifyAudioAvailableEvent",
"NotifyPaintEvent",
"NSEditableElement",
"NSEvent",
"NSRGBAColor",
"NSXPathExpression",
"Number",
"Object",
"OfflineResourceList",
"onLoad",
"OpenWindowEventDetail",
"Option",
"PageTransitionEvent",
"PaintRequest",
"PaintRequestList",
"parseFloat",
"parseInt",
"Parser",
"ParserJS",
"PaymentRequestInfo",
"Performance",
"PerformanceNavigation",
"PerformanceTiming",
"PermissionSettings",
"Pkcs11",
"Plugin",
"PluginArray",
"PopStateEvent",
"PopupBlockedEvent",
"ProcessingInstruction",
"ProgressEvent",
"PropertyNodeList",
"Proxy",
"PushManager",
"Range",
"RangeError",
"Rect",
"ReferenceError",
"RegExp",
"RequestService",
"RGBColor",
"RTCIceCandidate",
"RTCPeerConnection",
"RTCSessionDescription",
"Screen",
"ScrollAreaEvent",
"Selection",
"Serializer",
"Services",
"Set",
"SettingsLock",
"SettingsManager",
"sidebar",
"SimpleGestureEvent",
"SmartCardEvent",
"SpeechRecognitionError",
"SpeechRecognitionEvent",
"SpeechSynthesisEvent",
"StopIteration",
"Storage",
"StorageEvent",
"StorageIndexedDB",
"StorageItem",
"StorageManager",
"StorageObsolete",
"String",
"StyleRuleChangeEvent",
"StyleSheet",
"StyleSheetApplicableStateChangeEvent",
"StyleSheetChangeEvent",
"StyleSheetList",
"SVGAElement",
"SVGAltGlyphElement",
"SVGAngle",
"SVGAnimatedAngle",
"SVGAnimatedBoolean",
"SVGAnimatedEnumeration",
"SVGAnimatedInteger",
"SVGAnimatedLength",
"SVGAnimatedLengthList",
"SVGAnimatedNumber",
"SVGAnimatedNumberList",
"SVGAnimatedPathData",
"SVGAnimatedPoints",
"SVGAnimatedPreserveAspectRatio",
"SVGAnimatedRect",
"SVGAnimatedString",
"SVGAnimatedTransformList",
"SVGAnimateElement",
"SVGAnimateMotionElement",
"SVGAnimateTransformElement",
"SVGAnimationElement",
"SVGCircleElement",
"SVGClipPathElement",
"SVGComponentTransferFunctionElement",
"SVGDefsElement",
"SVGDescElement",
"SVGDocument",
"SVGElement",
"SVGEllipseElement",
"SVGEvent",
"SVGFEBlendElement",
"SVGFEColorMatrixElement",
"SVGFEComponentTransferElement",
"SVGFECompositeElement",
"SVGFEConvolveMatrixElement",
"SVGFEDiffuseLightingElement",
"SVGFEDisplacementMapElement",
"SVGFEDistantLightElement",
"SVGFEFloodElement",
"SVGFEFuncAElement",
"SVGFEFuncBElement",
"SVGFEFuncGElement",
"SVGFEFuncRElement",
"SVGFEGaussianBlurElement",
"SVGFEImageElement",
"SVGFEMergeElement",
"SVGFEMergeNodeElement",
"SVGFEMorphologyElement",
"SVGFEOffsetElement",
"SVGFEPointLightElement",
"SVGFESpecularLightingElement",
"SVGFESpotLightElement",
"SVGFETileElement",
"SVGFETurbulenceElement",
"SVGFilterElement",
"SVGFilterPrimitiveStandardAttributes",
"SVGFitToViewBox",
"SVGForeignObjectElement",
"SVGGElement",
"SVGGradientElement",
"SVGGraphicsElement",
"SVGImageElement",
"SVGLength",
"SVGLengthList",
"SVGLinearGradientElement",
"SVGLineElement",
"SVGLocatable",
"SVGMarkerElement",
"SVGMaskElement",
"SVGMatrix",
"SVGMetadataElement",
"SVGMpathElement",
"SVGMPathElement",
"SVGNumber",
"SVGNumberList",
"SVGPathElement",
"SVGPathSeg",
"SVGPathSegArcAbs",
"SVGPathSegArcRel",
"SVGPathSegClosePath",
"SVGPathSegCurvetoCubicAbs",
"SVGPathSegCurvetoCubicRel",
"SVGPathSegCurvetoCubicSmoothAbs",
"SVGPathSegCurvetoCubicSmoothRel",
"SVGPathSegCurvetoQuadraticAbs",
"SVGPathSegCurvetoQuadraticRel",
"SVGPathSegCurvetoQuadraticSmoothAbs",
"SVGPathSegCurvetoQuadraticSmoothRel",
"SVGPathSegLinetoAbs",
"SVGPathSegLinetoHorizontalAbs",
"SVGPathSegLinetoHorizontalRel",
"SVGPathSegLinetoRel",
"SVGPathSegLinetoVerticalAbs",
"SVGPathSegLinetoVerticalRel",
"SVGPathSegList",
"SVGPathSegMovetoAbs",
"SVGPathSegMovetoRel",
"SVGPatternElement",
"SVGPoint",
"SVGPointList",
"SVGPolygonElement",
"SVGPolylineElement",
"SVGPreserveAspectRatio",
"SVGRadialGradientElement",
"SVGRect",
"SVGRectElement",
"SVGScriptElement",
"SVGSetElement",
"SVGStopElement",
"SVGStringList",
"SVGStylable",
"SVGStyleElement",
"SVGSVGElement",
"SVGSwitchElement",
"SVGSymbolElement",
"SVGTests",
"SVGTextContentElement",
"SVGTextElement",
"SVGTextPathElement",
"SVGTextPositioningElement",
"SVGTitleElement",
"SVGTransform",
"SVGTransformable",
"SVGTransformList",
"SVGTSpanElement",
"SVGUnitTypes",
"SVGURIReference",
"SVGUseElement",
"SVGViewElement",
"SVGViewSpec",
"SVGZoomAndPan",
"SVGZoomEvent",
"SyntaxError",
"TCPSocket",
"Text",
"TextDecoder",
"TextEncoder",
"TextMetrics",
"TimeEvent",
"TimeRanges",
"top",
"toStaticHTML",
"ToString",
"Touch",
"TouchEvent",
"TouchList",
"TransitionEvent",
"TreeColumn",
"TreeColumns",
"TreeContentView",
"TreeSelection",
"TreeWalker",
"TypeError",
"UIEvent",
"Uint16Array",
"Uint32Array",
"Uint8Array",
"Uint8ClampedArray",
"undefined",
"UndoManager",
"unescape",
"uneval",
"URIError",
"URL",
"UserDataHandler",
"UserProximityEvent",
"USSDReceivedEvent",
"ValidityState",
"VideoStreamTrack",
"WeakMap",
"WebGLActiveInfo",