commit 36cc780d129bd7cb9a1f47d5039918f9f759488a Author: Alex Catarineu acat@torproject.org Date: Thu May 14 16:42:41 2020 +0200
Fix dom-objects-enumeration tests
- Use fixture server. - Use same method for both worker and window tests. - Require results to exactly match what we expect. --- TBBTestSuite/TestSuite/BrowserBundleTests.pm | 1 + .../test_dom-objects-enumeration-worker.py | 62 +-- .../test_dom-objects-enumeration.py | 451 ++++----------------- test-data/dom-objects-enumeration.html | 14 + test-data/dom-objects-enumeration.js | 44 ++ .../workers/dom-objects-enumeration-worker.js | 22 - test-data/workers/dom-objects-enumeration.html | 15 - test-data/workers/dom-objects-enumeration.js | 15 - 8 files changed, 188 insertions(+), 436 deletions(-)
diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm index 44c800e..ce5ffeb 100644 --- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm +++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm @@ -829,6 +829,7 @@ sub marionette_run { system(xvfb_run($test), "$FindBin::Bin/virtualenv-marionette-5.0.0/$bin/tor-browser-tests", '--log-unittest', winpath($result_file_txt), '--log-html', winpath($result_file_html), + '--server-root', winpath("$FindBin::Bin/test-data"), '--binary', ffbin_path($tbbinfos, $test), '--profile', winpath($tbbinfos->{ffprofiledir}), $OSNAME eq 'cygwin' ? () : ('--workspace', $test->{workspace}), diff --git a/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py b/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py index a22e317..59d771b 100644 --- a/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py +++ b/marionette/tor_browser_tests/test_dom-objects-enumeration-worker.py @@ -1,18 +1,12 @@ -from marionette_driver import By -from marionette_driver.errors import MarionetteException - from marionette_harness import MarionetteTestCase
-import testsuite - - class Test(MarionetteTestCase):
def setUp(self): MarionetteTestCase.setUp(self)
- ts = testsuite.TestSuite() - self.ts = ts + self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False) + self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=worker")
self.expectedObjects = [ "AbortController", @@ -21,10 +15,15 @@ class Test(MarionetteTestCase): "Array", "ArrayBuffer", "atob", + "Atomics", + "BigInt", + "BigInt64Array", + "BigUint64Array", "Blob", "Boolean", "BroadcastChannel", "btoa", + "ByteLengthQueuingStrategy", "Cache", "caches", "CacheStorage", @@ -34,7 +33,9 @@ class Test(MarionetteTestCase): "CloseEvent", "console", "constructor", + "CountQueuingStrategy", "createImageBitmap", + "crossOriginIsolated", "crypto", "Crypto", "CustomEvent", @@ -47,9 +48,14 @@ class Test(MarionetteTestCase): "__defineSetter__", "Directory", "dispatchEvent", - "DOMCursor", - "DOMError", "DOMException", + "DOMMatrix", + "DOMMatrixReadOnly", + "DOMPoint", + "DOMPointReadOnly", + "DOMQuad", + "DOMRect", + "DOMRectReadOnly", "DOMRequest", "DOMStringList", "dump", @@ -72,7 +78,7 @@ class Test(MarionetteTestCase): "Float64Array", "FormData", "Function", - "getAllPropertyNames", + "globalThis", "hasOwnProperty", "Headers", "IDBCursor", @@ -101,13 +107,14 @@ class Test(MarionetteTestCase): "isNaN", "isPrototypeOf", "isSecureContext", - "Iterator", "JSON", "location", "__lookupGetter__", "__lookupSetter__", "Map", "Math", + "MediaCapabilities", + "MediaCapabilitiesInfo", "MessageChannel", "MessageEvent", "MessagePort", @@ -117,12 +124,14 @@ class Test(MarionetteTestCase): "Notification", "Number", "Object", - "onclose", "onerror", + "onlanguagechange", "onmessage", "onmessageerror", "onoffline", "ononline", + "onrejectionhandled", + "onunhandledrejection", "origin", "parseFloat", "parseInt", @@ -134,13 +143,17 @@ class Test(MarionetteTestCase): "PerformanceObserver", "PerformanceObserverEntryList", "PerformanceResourceTiming", + "PerformanceServerTiming", "postMessage", "ProgressEvent", "Promise", + "PromiseRejectionEvent", "propertyIsEnumerable", "__proto__", "Proxy", + "queueMicrotask", "RangeError", + "ReadableStream", "ReferenceError", "Reflect", "RegExp", @@ -151,7 +164,6 @@ class Test(MarionetteTestCase): "Set", "setInterval", "setTimeout", - "StopIteration", "StorageManager", "String", "SubtleCrypto", @@ -160,7 +172,6 @@ class Test(MarionetteTestCase): "TextDecoder", "TextEncoder", "toLocaleString", - "toSource", "toString", "TypeError", "Uint16Array", @@ -169,13 +180,10 @@ class Test(MarionetteTestCase): "Uint8ClampedArray", "undefined", "unescape", - "uneval", - "unwatch", "URIError", "URL", "URLSearchParams", "valueOf", - "watch", "WeakMap", "WeakSet", "WebAssembly", @@ -191,14 +199,13 @@ class Test(MarionetteTestCase):
def test_dom_objects_enumeration_workers(self): with self.marionette.using_context('content'): - URL = "file://%s/workers/dom-objects-enumeration.html" % self.ts.t['options']['test_data_dir'] - self.marionette.navigate(URL) - self.marionette.set_search_timeout(50000) + self.marionette.navigate(self.test_page_file_url) + self.marionette.timeout.implicit = 5 elt = self.marionette.find_element('id', 'enumeration') - + r = elt.text.split("\n") err = False unknown_objects = '' - for l in elt.text.split("\n"): + for l in r: if l in self.expectedObjects: continue err = True @@ -206,3 +213,12 @@ class Test(MarionetteTestCase):
err_msg = "Unknown objects:\n%s" % unknown_objects self.assertFalse(err, msg=err_msg) + + for l in self.expectedObjects: + if l in r: + continue + err = True + unknown_objects += l + "\n" + + err_msg = "Expected objects not found:\n%s" % unknown_objects + self.assertFalse(err, msg=err_msg) \ No newline at end of file diff --git a/marionette/tor_browser_tests/test_dom-objects-enumeration.py b/marionette/tor_browser_tests/test_dom-objects-enumeration.py index 84b58f5..be2ae65 100644 --- a/marionette/tor_browser_tests/test_dom-objects-enumeration.py +++ b/marionette/tor_browser_tests/test_dom-objects-enumeration.py @@ -9,79 +9,49 @@ from marionette_driver.errors import MarionetteException
from marionette_harness import MarionetteTestCase
-import testsuite - - class Test(MarionetteTestCase): - def setUp(self): MarionetteTestCase.setUp(self) - - ts = testsuite.TestSuite() - self.ts = ts - + self.marionette.set_pref("network.proxy.allow_hijacking_localhost", False) + self.test_page_file_url = self.marionette.absolute_url("dom-objects-enumeration.html?testType=window") # The list of expected DOM objects - self.interfaceNamesInGlobalScope = [ + self.expectedObjects = [ "AbortController", "AbortSignal", + "AbstractRange", "addEventListener", - "adjustToolbarIconArrow", "alert", - "AnalyserNode", "Animation", "AnimationEffect", "AnimationEvent", - "AnimationPlayer", + "AnimationPlaybackEvent", "AnimationTimeline", - "AnonymousContent", - "Application", - "applicationCache", - "ArchiveRequest", "Array", "ArrayBuffer", - "AsyncScrollEventDetail", "atob", + "Atomics", "Attr", "Audio", - "AudioBuffer", - "AudioBufferSourceNode", - "AudioContext", - "AudioDestinationNode", - "AudioListener", - "AudioNode", - "AudioParam", - "AudioProcessingEvent", + "AudioParamMap", "AudioScheduledSourceNode", - "AudioStreamTrack", - "back", + "AudioWorklet", + "AudioWorkletNode", "BarProp", "BaseAudioContext", - "BatteryManager", "BeforeUnloadEvent", - "BiquadFilterNode", + "BigInt", + "BigInt64Array", + "BigUint64Array", "Blob", "BlobEvent", "blur", "Boolean", - "BoxObject", "BroadcastChannel", - "BrowserFeedWriter", "btoa", + "ByteLengthQueuingStrategy", "Cache", "caches", "CacheStorage", - "CameraCapabilities", - "CameraClosedEvent", - "CameraConfigurationEvent", - "CameraControl", - "CameraDetectedFace", - "CameraFacesDetectedEvent", - "CameraManager", - "CameraRecorderAudioProfile", - "CameraRecorderProfile", - "CameraRecorderProfiles", - "CameraRecorderVideoProfile", - "CameraStateChangeEvent", "cancelAnimationFrame", "cancelIdleCallback", "CanvasCaptureMediaStream", @@ -91,77 +61,51 @@ class Test(MarionetteTestCase): "captureEvents", "CaretPosition", "CDATASection", - "ChannelMergerNode", - "ChannelSplitterNode", "CharacterData", - "ChromeMessageBroadcaster", - "ChromeMessageSender", - "ChromeWindow", - "ChromeWorker", "clearInterval", "clearTimeout", - "ClientInformation", - "ClientRect", - "ClientRectList", + "Clipboard", "ClipboardEvent", "close", "closed", "CloseEvent", - "CommandEvent", "Comment", - "Components", "CompositionEvent", "confirm", "console", - "Console", - "Contact", - "ContactManager", - "_content", + "constructor", "content", - "ContentFrameMessageManager", - "ContentProcessMessageManager", - "controllers", - "Controllers", - "ConvolverNode", - "Counter", + "CountQueuingStrategy", "createImageBitmap", - "CRMFObject", + "crossOriginIsolated", "crypto", "Crypto", - "CryptoDialogs", "CryptoKey", "CSS", "CSS2Properties", - "CSSCharsetRule", + "CSSAnimation", "CSSConditionRule", "CSSCounterStyleRule", "CSSFontFaceRule", "CSSFontFeatureValuesRule", "CSSGroupingRule", - "CSSGroupRuleRuleList", "CSSImportRule", "CSSKeyframeRule", "CSSKeyframesRule", "CSSMediaRule", "CSSMozDocumentRule", "CSSNamespaceRule", - "CSSNameSpaceRule", "CSSPageRule", - "CSSPrimitiveValue", - "CSSRect", "CSSRule", "CSSRuleList", "CSSStyleDeclaration", "CSSStyleRule", "CSSStyleSheet", "CSSSupportsRule", - "CSSUnknownRule", - "CSSValue", - "CSSValueList", + "CSSTransition", + "CustomElementRegistry", + "customElements", "CustomEvent", - "DataChannel", - "DataContainerEvent", - "DataErrorEvent", "DataTransfer", "DataTransferItem", "DataTransferItemList", @@ -169,37 +113,22 @@ class Test(MarionetteTestCase): "Date", "decodeURI", "decodeURIComponent", - "DelayNode", - "DesktopNotification", - "DesktopNotificationCenter", - "DeviceAcceleration", - "DeviceLightEvent", + "__defineGetter__", + "__defineSetter__", "DeviceMotionEvent", "DeviceOrientationEvent", "devicePixelRatio", - "DeviceProximityEvent", - "DeviceRotationRate", - "DeviceStorage", - "DeviceStorageChangeEvent", - "DeviceStorageCursor", "Directory", "dispatchEvent", "document", "Document", "DocumentFragment", - "DocumentTouch", + "DocumentTimeline", "DocumentType", - "DocumentXBL", - "DOMApplication", - "DOMApplicationsManager", - "DOMConstructor", - "DOMCursor", - "DOMError", "DOMException", "DOMImplementation", "DOMMatrix", "DOMMatrixReadOnly", - "DOMMMIError", "DOMParser", "DOMPoint", "DOMPointReadOnly", @@ -208,18 +137,12 @@ class Test(MarionetteTestCase): "DOMRectList", "DOMRectReadOnly", "DOMRequest", - "DOMSettableTokenList", "DOMStringList", "DOMStringMap", "DOMTokenList", - "DOMTransactionEvent", "DragEvent", "dump", - "DynamicsCompressorNode", "Element", - "ElementCSSInlineStyle", - "ElementReplaceEvent", - "ElementTimeControl", "encodeURI", "encodeURIComponent", "Error", @@ -227,19 +150,15 @@ class Test(MarionetteTestCase): "escape", "eval", "EvalError", + "event", "Event", - "EventListener", - "EventListenerInfo", "EventSource", "EventTarget", "external", - "External", "fetch", "File", - "FileHandle", "FileList", "FileReader", - "FileRequest", "FileSystem", "FileSystemDirectoryEntry", "FileSystemDirectoryReader", @@ -251,56 +170,42 @@ class Test(MarionetteTestCase): "focus", "FocusEvent", "FontFace", - "FontFaceList", "FontFaceSet", "FontFaceSetLoadEvent", "FormData", - "forward", + "FormDataEvent", "frameElement", "frames", "fullScreen", "Function", - "FutureResolver", - "GainNode", "Gamepad", - "GamepadAxisMoveEvent", - "GamepadButtonEvent", + "GamepadButton", "GamepadEvent", "GamepadHapticActuator", "GamepadPose", - "GeoGeolocation", - "GeoPosition", - "GeoPositionCallback", - "GeoPositionCoords", - "GeoPositionError", - "GeoPositionErrorCallback", + "Geolocation", + "GeolocationCoordinates", + "GeolocationPosition", + "GeolocationPositionError", "getComputedStyle", "getDefaultComputedStyle", - "getInterface", "getSelection", - "GetUserMediaErrorCallback", - "GetUserMediaSuccessCallback", - "GlobalObjectConstructor", - "GlobalPropertyInitializer", + "globalThis", "HashChangeEvent", + "hasOwnProperty", "Headers", "history", "History", - "home", "HTMLAllCollection", "HTMLAnchorElement", - "HTMLAppletElement", "HTMLAreaElement", "HTMLAudioElement", "HTMLBaseElement", "HTMLBodyElement", "HTMLBRElement", "HTMLButtonElement", - "HTMLByteRanges", "HTMLCanvasElement", "HTMLCollection", - "HTMLCommandElement", - "HTMLContentElement", "HTMLDataElement", "HTMLDataListElement", "HTMLDetailsElement", @@ -328,6 +233,7 @@ class Test(MarionetteTestCase): "HTMLLIElement", "HTMLLinkElement", "HTMLMapElement", + "HTMLMarqueeElement", "HTMLMediaElement", "HTMLMenuElement", "HTMLMenuItemElement", @@ -345,11 +251,10 @@ class Test(MarionetteTestCase): "HTMLPictureElement", "HTMLPreElement", "HTMLProgressElement", - "HTMLPropertiesCollection", "HTMLQuoteElement", "HTMLScriptElement", "HTMLSelectElement", - "HTMLShadowElement", + "HTMLSlotElement", "HTMLSourceElement", "HTMLSpanElement", "HTMLStyleElement", @@ -386,15 +291,12 @@ class Test(MarionetteTestCase): "ImageBitmap", "ImageBitmapRenderingContext", "ImageData", - "ImageDocument", "indexedDB", "Infinity", "innerHeight", "innerWidth", "InputEvent", - "insertPropertyStrings", "InstallTrigger", - "InstallTriggerImpl", "Int16Array", "Int32Array", "Int8Array", @@ -404,105 +306,54 @@ class Test(MarionetteTestCase): "Intl", "isFinite", "isNaN", + "isPrototypeOf", "isSecureContext", - "Iterator", "JSON", - "JSWindow", "KeyboardEvent", "KeyEvent", + "KeyframeEffect", "length", - "LinkStyle", - "LoadStatus", - "LocalMediaStream", "localStorage", "location", "Location", "locationbar", - "LockedFile", - "LSProgressEvent", + "__lookupGetter__", + "__lookupSetter__", "Map", "matchMedia", "Math", - "MediaElementAudioSourceNode", + "MathMLElement", + "MediaCapabilities", + "MediaCapabilitiesInfo", "MediaEncryptedEvent", "MediaError", - "MediaKeys", "MediaKeyError", "MediaKeyMessageEvent", + "MediaKeys", "MediaKeySession", "MediaKeyStatusMap", "MediaKeySystemAccess", "MediaList", "MediaQueryList", "MediaQueryListEvent", - "MediaQueryListListener", "MediaRecorder", "MediaRecorderErrorEvent", "MediaSource", "MediaStream", - "MediaStreamAudioDestinationNode", - "MediaStreamAudioSourceNode", "MediaStreamTrack", "MediaStreamTrackEvent", "menubar", - "MenuBoxObject", "MessageChannel", "MessageEvent", "MessagePort", "MimeType", "MimeTypeArray", - "ModalContentWindow", "MouseEvent", "MouseScrollEvent", "moveBy", "moveTo", - "MozAlarmsManager", - "mozAnimationStartTime", - "MozApplicationEvent", - "MozBlobBuilder", - "MozBrowserFrame", - "mozCancelAnimationFrame", - "mozCancelRequestAnimationFrame", - "MozCanvasPrintState", - "MozConnection", - "mozContact", - "MozContactChangeEvent", - "MozCSSKeyframeRule", - "MozCSSKeyframesRule", - "mozIndexedDB", "mozInnerScreenX", "mozInnerScreenY", - "MozMmsEvent", - "MozMmsMessage", - "MozMobileCellInfo", - "MozMobileConnectionInfo", - "MozMobileMessageManager", - "MozMobileMessageThread", - "MozMobileNetworkInfo", - "MozNamedAttrMap", - "MozNavigatorMobileMessage", - "MozNavigatorNetwork", - "MozNavigatorSms", - "MozNavigatorTime", - "MozNetworkStats", - "MozNetworkStatsData", - "MozNetworkStatsManager", - "mozPaintCount", - "MozPowerManager", - "mozRequestAnimationFrame", - "mozRequestOverfill", - "MozSelfSupport", - "MozSettingsEvent", - "MozSettingsTransactionEvent", - "MozSmsEvent", - "MozSmsFilter", - "MozSmsManager", - "MozSmsMessage", - "MozSmsSegmentInfo", - "MozTimeManager", - "MozTouchEvent", - "MozWakeLock", - "MozWakeLockListener", "MutationEvent", "MutationObserver", "MutationRecord", @@ -511,30 +362,15 @@ class Test(MarionetteTestCase): "NaN", "navigator", "Navigator", - "NavigatorCamera", - "NavigatorDesktopNotification", - "NavigatorDeviceStorage", - "NavigatorGeolocation", - "NavigatorUserMedia", "netscape", "Node", "NodeFilter", "NodeIterator", "NodeList", - "NodeSelector", - "__noscriptStorage", "Notification", - "NotifyAudioAvailableEvent", "NotifyPaintEvent", - "NSEditableElement", - "NSEvent", - "NSRGBAColor", - "NSXPathExpression", "Number", "Object", - "OfflineAudioCompletionEvent", - "OfflineAudioContext", - "OfflineResourceList", "onabort", "onabsolutedeviceorientation", "onafterprint", @@ -552,6 +388,7 @@ class Test(MarionetteTestCase): "onclick", "onclose", "oncontextmenu", + "oncuechange", "ondblclick", "ondevicelight", "ondevicemotion", @@ -570,7 +407,7 @@ class Test(MarionetteTestCase): "onended", "onerror", "onfocus", - "ongotpointercapture", + "onformdata", "onhashchange", "oninput", "oninvalid", @@ -579,12 +416,10 @@ class Test(MarionetteTestCase): "onkeyup", "onlanguagechange", "onload", - "onLoad", "onloadeddata", "onloadedmetadata", "onloadend", "onloadstart", - "onlostpointercapture", "onmessage", "onmessageerror", "onmousedown", @@ -596,8 +431,6 @@ class Test(MarionetteTestCase): "onmouseup", "onmozfullscreenchange", "onmozfullscreenerror", - "onmozpointerlockchange", - "onmozpointerlockerror", "onoffline", "ononline", "onpagehide", @@ -605,17 +438,10 @@ class Test(MarionetteTestCase): "onpause", "onplay", "onplaying", - "onpointercancel", - "onpointerdown", - "onpointerenter", - "onpointerleave", - "onpointermove", - "onpointerout", - "onpointerover", - "onpointerup", "onpopstate", "onprogress", "onratechange", + "onrejectionhandled", "onreset", "onresize", "onscroll", @@ -634,6 +460,7 @@ class Test(MarionetteTestCase): "ontransitionend", "ontransitionrun", "ontransitionstart", + "onunhandledrejection", "onunload", "onuserproximity", "onvolumechange", @@ -644,12 +471,9 @@ class Test(MarionetteTestCase): "onwebkittransitionend", "onwheel", "open", - "openDialog", "opener", - "OpenWindowEventDetail", "Option", "origin", - "OscillatorNode", "outerHeight", "outerWidth", "PageTransitionEvent", @@ -657,79 +481,64 @@ class Test(MarionetteTestCase): "pageYOffset", "PaintRequest", "PaintRequestList", - "PannerNode", "parent", "parseFloat", "parseInt", - "Parser", - "ParserJS", "Path2D", - "PaymentRequestInfo", "performance", "Performance", "PerformanceEntry", "PerformanceMark", "PerformanceMeasure", "PerformanceNavigation", - "PerformanceNavigationTiming", "PerformanceObserver", "PerformanceObserverEntryList", "PerformanceResourceTiming", + "PerformanceServerTiming", "PerformanceTiming", - "PeriodicWave", "Permissions", - "PermissionSettings", "PermissionStatus", "personalbar", - "PhoneNumberService", - "Pkcs11", "Plugin", "PluginArray", - "PluginCrashedEvent", - "PointerEvent", "PopStateEvent", "PopupBlockedEvent", - "PopupBoxObject", "postMessage", "print", "ProcessingInstruction", "ProgressEvent", "Promise", - "PromiseDebugging", + "PromiseRejectionEvent", "prompt", - "PropertyNodeList", + "propertyIsEnumerable", + "__proto__", "Proxy", - "PushManager", - "QueryInterface", + "queueMicrotask", "RadioNodeList", "Range", "RangeError", - "realFrameElement", - "RecordErrorEvent", - "Rect", + "ReadableStream", "ReferenceError", + "Reflect", "RegExp", "releaseEvents", "removeEventListener", "Request", "requestAnimationFrame", "requestIdleCallback", - "RequestService", "resizeBy", + "ResizeObserver", + "ResizeObserverEntry", + "ResizeObserverSize", "resizeTo", "Response", - "RGBColor", - "RTCIceCandidate", - "RTCPeerConnection", - "RTCPeerConnectionIdentityErrorEvent", - "RTCPeerConnectionIdentityEvent", - "RTCSessionDescription", "screen", "Screen", + "screenLeft", "ScreenOrientation", + "screenTop", "screenX", "screenY", - "ScriptProcessorNode", "scroll", "ScrollAreaEvent", "scrollbars", @@ -739,53 +548,41 @@ class Test(MarionetteTestCase): "scrollMaxX", "scrollMaxY", "scrollTo", - "ScrollViewChangeEvent", "scrollX", "scrollY", + "SecurityPolicyViolationEvent", "Selection", - "SelectionStateChangedEvent", "self", - "Serializer", - "Services", "sessionStorage", "Set", "setInterval", "setResizable", "setTimeout", - "SettingsLock", - "SettingsManager", + "ShadowRoot", "SharedWorker", - "showModalDialog", "sidebar", - "SimpleGestureEvent", "sizeToContent", - "SmartCardEvent", "SourceBuffer", "SourceBufferList", - "SpeechRecognitionError", - "SpeechRecognitionEvent", "speechSynthesis", + "SpeechSynthesis", + "SpeechSynthesisErrorEvent", "SpeechSynthesisEvent", + "SpeechSynthesisUtterance", + "SpeechSynthesisVoice", + "StaticRange", "status", "statusbar", - "StereoPannerNode", "stop", - "StopIteration", "Storage", "StorageEvent", - "StorageIndexedDB", - "StorageItem", "StorageManager", - "StorageObsolete", "String", - "StyleRuleChangeEvent", "StyleSheet", - "StyleSheetApplicableStateChangeEvent", - "StyleSheetChangeEvent", "StyleSheetList", + "SubmitEvent", "SubtleCrypto", "SVGAElement", - "SVGAltGlyphElement", "SVGAngle", "SVGAnimatedAngle", "SVGAnimatedBoolean", @@ -795,8 +592,6 @@ class Test(MarionetteTestCase): "SVGAnimatedLengthList", "SVGAnimatedNumber", "SVGAnimatedNumberList", - "SVGAnimatedPathData", - "SVGAnimatedPoints", "SVGAnimatedPreserveAspectRatio", "SVGAnimatedRect", "SVGAnimatedString", @@ -810,10 +605,8 @@ class Test(MarionetteTestCase): "SVGComponentTransferFunctionElement", "SVGDefsElement", "SVGDescElement", - "SVGDocument", "SVGElement", "SVGEllipseElement", - "SVGEvent", "SVGFEBlendElement", "SVGFEColorMatrixElement", "SVGFEComponentTransferElement", @@ -840,8 +633,6 @@ class Test(MarionetteTestCase): "SVGFETileElement", "SVGFETurbulenceElement", "SVGFilterElement", - "SVGFilterPrimitiveStandardAttributes", - "SVGFitToViewBox", "SVGForeignObjectElement", "SVGGElement", "SVGGeometryElement", @@ -852,37 +643,15 @@ class Test(MarionetteTestCase): "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", @@ -896,31 +665,23 @@ class Test(MarionetteTestCase): "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", "Symbol", "SyntaxError", - "TCPSocket", "Text", "TextDecoder", "TextEncoder", @@ -931,45 +692,36 @@ class Test(MarionetteTestCase): "TextTrackList", "TimeEvent", "TimeRanges", + "toLocaleString", "toolbar", "top", - "toStaticHTML", - "ToString", - "Touch", - "TouchEvent", - "TouchList", + "toString", "TrackEvent", "TransitionEvent", - "TreeColumn", - "TreeColumns", - "TreeContentView", - "TreeSelection", "TreeWalker", "TypeError", + "u2f", + "U2F", "UIEvent", "Uint16Array", "Uint32Array", "Uint8Array", "Uint8ClampedArray", "undefined", - "UndoManager", "unescape", - "uneval", "updateCommands", "URIError", "URL", "URLSearchParams", - "UserDataHandler", - "UserProximityEvent", - "USSDReceivedEvent", "ValidityState", + "valueOf", "VideoPlaybackQuality", - "VideoStreamTrack", + "VisualViewport", "VTTCue", "VTTRegion", - "WaveShaperNode", "WeakMap", "WeakSet", + "WebAssembly", "WebGLActiveInfo", "WebGLBuffer", "WebGLContextEvent", @@ -982,68 +734,36 @@ class Test(MarionetteTestCase): "WebGLShaderPrecisionFormat", "WebGLTexture", "WebGLUniformLocation", - "WebGLVertexArray", "WebGLVertexArrayObject", "WebKitCSSMatrix", + "webkitURL", "WebSocket", "WheelEvent", "window", "Window", - "WindowCollection", - "WindowInternal", - "WindowPerformance", - "WindowRoot", - "WindowUtils", "Worker", - "__XBLClassObjectMap__", + "Worklet", "XMLDocument", "XMLHttpRequest", "XMLHttpRequestEventTarget", "XMLHttpRequestUpload", "XMLSerializer", - "XMLStylesheetProcessingInstruction", "XPathEvaluator", "XPathExpression", - "XPathNamespace", - "XPathNSResolver", "XPathResult", - "XPCNativeWrapper", "XSLTProcessor", - "XULButtonElement", - "XULCheckboxElement", - "XULCommandDispatcher", - "XULCommandEvent", - "XULContainerElement", - "XULContainerItemElement", - "XULControlElement", - "XULControllers", - "XULDescriptionElement", - "XULDocument", - "XULElement", - "XULImageElement", - "XULLabeledControlElement", - "XULLabelElement", - "XULMenuListElement", - "XULMultiSelectControlElement", - "XULPopupElement", - "XULRelatedElement", - "XULSelectControlElement", - "XULSelectControlItemElement", - "XULTemplateBuilder", - "XULTextBoxElement", - "XULTreeBuilder", - "XULTreeElement", ]
def test_dom_objects_enumeration(self): with self.marionette.using_context('content'): - self.marionette.navigate('about:robots') - - r = self.marionette.execute_script('return Object.getOwnPropertyNames(window);') + self.marionette.navigate(self.test_page_file_url) + self.marionette.timeout.implicit = 5 + elt = self.marionette.find_element('id', 'enumeration') + r = elt.text.split("\n") err = False unknown_objects = '' for l in r: - if l in self.interfaceNamesInGlobalScope: + if l in self.expectedObjects: continue err = True unknown_objects += l + "\n" @@ -1051,3 +771,12 @@ class Test(MarionetteTestCase): err_msg = "Unknown objects:\n%s" % unknown_objects self.assertFalse(err, msg=err_msg)
+ for l in self.expectedObjects: + if l in r: + continue + err = True + unknown_objects += l + "\n" + + err_msg = "Expected objects not found:\n%s" % unknown_objects + self.assertFalse(err, msg=err_msg) + diff --git a/test-data/dom-objects-enumeration.html b/test-data/dom-objects-enumeration.html new file mode 100644 index 0000000..1f7e6c0 --- /dev/null +++ b/test-data/dom-objects-enumeration.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + + <title>dom objects enumeration</title> + </head> + + <body> + <h1>dom objects enumeration</h1> + <script src="dom-objects-enumeration.js"></script> + </body> +</html> + diff --git a/test-data/dom-objects-enumeration.js b/test-data/dom-objects-enumeration.js new file mode 100644 index 0000000..b3e60c5 --- /dev/null +++ b/test-data/dom-objects-enumeration.js @@ -0,0 +1,44 @@ +(() => { + // getAllPropertyNames function taken from: + // https://stackoverflow.com/questions/8024149/is-it-possible-to-get-the-non-en... + function getAllPropertyNames(obj) { + const props = []; + do { + Object.getOwnPropertyNames(obj).forEach((prop) => { + if (props.indexOf(prop) === -1) { + props.push(prop); + } + }); + } while (obj = Object.getPrototypeOf(obj)); + return [...new Set(props)].sort(); + } + + function getGlobalNames() { + return getAllPropertyNames(globalThis); + } + + if (!self.document) { + // This is a worker + self.postMessage(getGlobalNames()); + } else { + // Not a worker, loaded via script. + const enumeration = document.createElement("div"); + enumeration.setAttribute("id", "enumeration"); + const queryString = window.location.search; + const urlParams = new URLSearchParams(queryString); + let onmessage = (allObjects) => { + for (const name of allObjects) { + enumeration.innerHTML += name + "<br/>"; + } + document.getElementsByTagName("body")[0].appendChild(enumeration); + }; + if (urlParams.get("testType") === "worker") { + // Must enumerate worker globals + const worker = new Worker("dom-objects-enumeration.js"); + worker.onmessage = (e) => onmessage(e.data); + } else { + // Must enumerate window global + onmessage(getGlobalNames()); + } + } +})(); \ No newline at end of file diff --git a/test-data/workers/dom-objects-enumeration-worker.js b/test-data/workers/dom-objects-enumeration-worker.js deleted file mode 100644 index 5ab3723..0000000 --- a/test-data/workers/dom-objects-enumeration-worker.js +++ /dev/null @@ -1,22 +0,0 @@ -// getAllPropertyNames function taken from: -// https://stackoverflow.com/questions/8024149/is-it-possible-to-get-the-non-en... -function getAllPropertyNames( obj ) { - var props = []; - do { - Object.getOwnPropertyNames( obj ).forEach(function ( prop ) { - if ( props.indexOf( prop ) === -1 ) { - props.push( prop ); - } - }); - } while ( obj = Object.getPrototypeOf( obj ) ); - return props; -} - -onmessage = function(e) { - var allObjects = getAllPropertyNames(self); - var res = Array(); - for (var i in allObjects.sort()) { - res.push(allObjects[i]); - } - postMessage(res); -} diff --git a/test-data/workers/dom-objects-enumeration.html b/test-data/workers/dom-objects-enumeration.html deleted file mode 100644 index 6a2fc19..0000000 --- a/test-data/workers/dom-objects-enumeration.html +++ /dev/null @@ -1,15 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta charset="utf-8"> - - <title>Web Workers dom objects enumeration</title> - </head> - - <body> - <h1>Web Workers dom objects enumeration</h1> - - </body> - <script src="dom-objects-enumeration.js"></script> -</html> - diff --git a/test-data/workers/dom-objects-enumeration.js b/test-data/workers/dom-objects-enumeration.js deleted file mode 100644 index 56d4a64..0000000 --- a/test-data/workers/dom-objects-enumeration.js +++ /dev/null @@ -1,15 +0,0 @@ -var enumeration = document.createElement('div'); -enumeration.setAttribute("id", "enumeration"); - -if (window.Worker) { - var myWorker = new Worker("dom-objects-enumeration-worker.js"); - myWorker.postMessage("Hello"); - myWorker.onmessage = function(e) { - var allObjects = e.data; - for (var i in allObjects.sort()) { - var name = allObjects[i]; - enumeration.innerHTML += name + "<br/>"; - } - document.getElementsByTagName("body")[0].appendChild(enumeration); - } -}