4 https://bugzilla.mozilla.org/show_bug.cgi?id=766694
8 <title>Test for Bug
766694</title>
9 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=766694">Mozilla Bug
766694</a>
15 <div id=
"content" style=
"display: none">
19 <script type=
"application/javascript">
21 /** Test for Bug
766694 **/
23 // This is a list of all interfaces that are exposed to every webpage. Please only
24 // add things to this list with great care.
26 // IMPORTANT: Do not change this list without review from a JavaScript Engine peer!
31 {name:
"ArrayType", nightly: true},
35 {name:
"Data", nightly: true},
53 {name:
"ParallelArray", nightly: true},
61 {name:
"StructType", nightly: true},
63 {name:
"Type", nightly: true},
72 // IMPORTANT: Do not change this list without review from a JavaScript Engine peer!
74 // IMPORTANT: Do not change this list without review from a DOM peer!
75 var interfaceNamesInGlobalScope =
83 {name:
"AudioChannelManager", b2g: true},
85 "AudioBufferSourceNode",
86 "AudioDestinationNode",
90 "AudioProcessingEvent",
98 {name:
"BluetoothAdapter", b2g: true},
99 {name:
"BluetoothDevice", b2g: true},
100 {name:
"BluetoothDeviceEvent", b2g: true},
101 {name:
"BluetoothManager", b2g: true},
102 {name:
"BluetoothStatusChangedEvent", b2g: true},
103 {name:
"BoxObject", xbl: true},
104 {name:
"BrowserFeedWriter", desktop: true},
105 {name:
"CallEvent", b2g: true},
106 "CameraCapabilities",
111 "CanvasRenderingContext2D",
114 {name:
"CFStateChangeEvent", b2g: true},
116 "ChannelSplitterNode",
118 {name:
"ChromeWindow", xbl: true},
126 {name:
"CRMFObject", desktop: true},
133 {name:
"CSSFontFeatureValuesRule", release: false},
137 "CSSMozDocumentRule",
143 "CSSStyleDeclaration",
151 "DataContainerEvent",
152 {name:
"DataErrorEvent", b2g: true},
155 "DesktopNotification",
156 "DesktopNotificationCenter",
157 "DeviceAcceleration",
160 "DeviceOrientationEvent",
161 "DeviceProximityEvent",
162 "DeviceRotationRate",
164 "DeviceStorageChangeEvent",
168 {name:
"DOMConstructor", xbl: true},
178 "DOMSettableTokenList",
182 "DOMTransactionEvent",
184 "DynamicsCompressorNode",
186 "ElementReplaceEvent",
197 {name:
"FMRadio", b2g: true},
201 {name:
"Gamepad", desktop: true},
202 {name:
"GamepadAxisMoveEvent", desktop: true},
203 {name:
"GamepadButtonEvent", desktop: true},
204 {name:
"GamepadEvent", desktop: true},
218 "HTMLDataListElement",
219 "HTMLDirectoryElement",
225 "HTMLFieldSetElement",
227 "HTMLFormControlsCollection",
230 "HTMLFrameSetElement",
232 "HTMLHeadingElement",
245 "HTMLMenuItemElement",
251 "HTMLOptGroupElement",
253 "HTMLOptionsCollection",
255 "HTMLParagraphElement",
258 "HTMLProgressElement",
259 "HTMLPropertiesCollection",
266 "HTMLTableCaptionElement",
267 "HTMLTableCellElement",
268 "HTMLTableColElement",
270 "HTMLTableRowElement",
271 "HTMLTableSectionElement",
272 "HTMLTemplateElement",
273 "HTMLTextAreaElement",
277 "HTMLUnknownElement",
279 {name:
"IccCardLockErrorEvent", b2g: true},
281 "IDBCursorWithValue",
291 "IDBVersionChangeEvent",
294 {name:
"InstallTrigger", b2g: false, xbl: false},
301 "MediaElementAudioSourceNode",
307 "MediaStreamAudioDestinationNode",
308 "MediaStreamAudioSourceNode",
314 "ModalContentWindow",
317 {name:
"MozActivity", b2g: true},
318 "MozApplicationEvent",
319 {name:
"MozCellBroadcast", b2g: true},
320 {name:
"MozCellBroadcastEvent", b2g: true},
323 "MozContactChangeEvent",
324 "MozCSSKeyframeRule",
325 "MozCSSKeyframesRule",
326 {name:
"MozEmergencyCbModeEvent", b2g: true},
327 {name:
"MozIccManager", b2g: true},
328 {name:
"MozInputContext", b2g: true},
329 {name:
"MozInputMethodManager", b2g: true},
332 {name:
"MozMobileConnection", b2g: true},
333 "MozMobileMessageManager",
334 "MozMobileMessageThread",
336 {name:
"MozOtaStatusEvent", b2g: true},
338 "mozRTCIceCandidate",
339 "mozRTCPeerConnection",
340 "mozRTCSessionDescription",
346 {name:
"MozStkCommandEvent", b2g: true},
347 {name:
"MozTimeManager", b2g: true},
348 {name:
"MozVoicemail", b2g: true},
349 {name:
"MozVoicemailEvent", b2g: true},
351 {name:
"MozWifiConnectionInfoEvent", b2g: true},
352 {name:
"MozWifiStatusChangeEvent", b2g: true},
361 "NotifyAudioAvailableEvent",
364 "OfflineAudioCompletionEvent",
365 "OfflineAudioContext",
366 "OfflineResourceList",
369 "PageTransitionEvent",
374 "PerformanceNavigation",
377 "PhoneNumberService",
382 "ProcessingInstruction",
384 {name:
"Promise", b2g: false, release: false},
390 "RTCDataChannelEvent",
391 "RTCPeerConnectionIceEvent",
393 "ScriptProcessorNode",
398 "SimpleGestureEvent",
399 {name:
"SimpleTest", xbl: false},
401 "SpeechRecognitionError",
402 "SpeechRecognitionEvent",
403 "SpeechSynthesisEvent",
404 {name:
"SpeechSynthesis", b2g: true},
405 {name:
"SpeechSynthesisUtterance", b2g: true},
406 {name:
"SpeechSynthesisVoice", b2g: true},
407 {name:
"SpecialPowers", xbl: false},
410 "StyleRuleChangeEvent",
412 "StyleSheetApplicableStateChangeEvent",
413 "StyleSheetChangeEvent",
416 "SVGAltGlyphElement",
419 "SVGAnimatedBoolean",
420 "SVGAnimatedEnumeration",
421 "SVGAnimatedInteger",
423 "SVGAnimatedLengthList",
425 "SVGAnimatedNumberList",
426 "SVGAnimatedPreserveAspectRatio",
429 "SVGAnimatedTransformList",
431 "SVGAnimateMotionElement",
432 "SVGAnimateTransformElement",
433 "SVGAnimationElement",
435 "SVGClipPathElement",
436 "SVGComponentTransferFunctionElement",
443 "SVGFEColorMatrixElement",
444 "SVGFEComponentTransferElement",
445 "SVGFECompositeElement",
446 "SVGFEConvolveMatrixElement",
447 "SVGFEDiffuseLightingElement",
448 "SVGFEDisplacementMapElement",
449 "SVGFEDistantLightElement",
455 "SVGFEGaussianBlurElement",
458 "SVGFEMergeNodeElement",
459 "SVGFEMorphologyElement",
460 "SVGFEOffsetElement",
461 "SVGFEPointLightElement",
462 "SVGFESpecularLightingElement",
463 "SVGFESpotLightElement",
465 "SVGFETurbulenceElement",
467 "SVGForeignObjectElement",
469 "SVGGradientElement",
470 "SVGGraphicsElement",
474 "SVGLinearGradientElement",
479 "SVGMetadataElement",
487 "SVGPathSegClosePath",
488 "SVGPathSegCurvetoCubicAbs",
489 "SVGPathSegCurvetoCubicRel",
490 "SVGPathSegCurvetoCubicSmoothAbs",
491 "SVGPathSegCurvetoCubicSmoothRel",
492 "SVGPathSegCurvetoQuadraticAbs",
493 "SVGPathSegCurvetoQuadraticRel",
494 "SVGPathSegCurvetoQuadraticSmoothAbs",
495 "SVGPathSegCurvetoQuadraticSmoothRel",
496 "SVGPathSegLinetoAbs",
497 "SVGPathSegLinetoHorizontalAbs",
498 "SVGPathSegLinetoHorizontalRel",
499 "SVGPathSegLinetoRel",
500 "SVGPathSegLinetoVerticalAbs",
501 "SVGPathSegLinetoVerticalRel",
503 "SVGPathSegMovetoAbs",
504 "SVGPathSegMovetoRel",
509 "SVGPolylineElement",
510 "SVGPreserveAspectRatio",
511 "SVGRadialGradientElement",
522 "SVGTextContentElement",
524 "SVGTextPathElement",
525 "SVGTextPositioningElement",
535 {name:
"Telephony", b2g: true},
536 {name:
"TelephonyCall", b2g: true},
537 {name:
"TelephonyCallGroup", b2g: true},
549 {name:
"TreeColumn", xbl: true},
550 {name:
"TreeColumns", xbl: true},
551 {name:
"TreeContentView", xbl: true},
552 {name:
"TreeSelection", xbl: true},
557 {name:
"UserDataHandler", xbl: true},
558 "UserProximityEvent",
559 {name:
"USSDReceivedEvent", b2g: true},
568 "WebGLRenderingContext",
570 "WebGLShaderPrecisionFormat",
572 "WebGLUniformLocation",
580 "XMLHttpRequestUpload",
582 "XMLStylesheetProcessingInstruction",
589 {name:
"XULButtonElement", xbl: true},
590 {name:
"XULCheckboxElement", xbl: true},
591 {name:
"XULCommandDispatcher", xbl: true},
592 {name:
"XULCommandEvent", xbl: true},
593 {name:
"XULControlElement", xbl: true},
594 {name:
"XULControllers", xbl: true},
595 {name:
"XULDocument", xbl: true},
596 {name:
"XULElement", xbl: true},
597 {name:
"XULLabeledControlElement", xbl: true},
598 {name:
"XULPopupElement", xbl: true},
599 {name:
"XULTemplateBuilder", xbl: true},
600 {name:
"XULTreeBuilder", xbl: true},
602 // IMPORTANT: Do not change this list without review from a DOM peer!
604 function createInterfaceMap(isXBLScope) {
605 var version = SpecialPowers.Cc[
"@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version;
606 var isNightly = version.endsWith(
"a1");
607 var isRelease = !version.contains(
"a");
608 var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
609 var isB2G = !isDesktop && !navigator.userAgent.contains(
"Android");
610 var interfaceMap = {};
611 for (var entry of ecmaGlobals) {
612 if (typeof(entry) ===
"string") {
613 // Standard ECMAScript global objects are not defined on the XBL scope.
614 interfaceMap[entry] = !isXBLScope;
615 } else if (entry.nightly === isNightly) {
616 interfaceMap[entry.name] = !isXBLScope;
618 interfaceMap[entry.name] = false;
621 for (var entry of interfaceNamesInGlobalScope) {
622 if (typeof(entry) ===
"string") {
623 interfaceMap[entry] = true;
624 } else if (entry.xbl === !isXBLScope ||
625 entry.desktop === !isDesktop ||
626 entry.b2g === !isB2G ||
627 entry.release === !isRelease) {
628 interfaceMap[entry.name] = false;
630 interfaceMap[entry.name] = true;
636 function runTest(isXBLScope) {
637 var interfaceMap = createInterfaceMap(isXBLScope);
638 for (var name of Object.getOwnPropertyNames(window)) {
639 // An interfae name should start with an upper case character.
640 if (!/^(moz)?[A-Z]/.test(name)) {
643 ok(interfaceMap[name],
644 "If this is failing: DANGER, are you sure you want to expose the new interface " + name +
645 " to all webpages as a property on the window? Do not make a change to this file without a " +
646 " review from a DOM peer for that specific change!!! (or a JS peer for changes to ecmaGlobals)");
647 delete interfaceMap[name];
649 for (var name of Object.keys(interfaceMap)) {
650 ok(name in window === interfaceMap[name],
651 name +
" should " + (interfaceMap[name] ?
"" :
" NOT") +
" be defined on the " + (isXBLScope ?
"XBL" :
"global") +
" scope");
652 if (!interfaceMap[name]) {
653 delete interfaceMap[name];
657 todo_is(Object.keys(interfaceMap).length,
0,
658 "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(
", "));
660 is(Object.keys(interfaceMap).length,
0,
661 "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(
", "));
666 SimpleTest.waitForExplicitFinish();
669 <span id=
"span" style=
"-moz-binding: url(file_interfaces.xml)"></span>