1 <p>This test dumps all of the properties that are reachable from the window.DeviceMotionEvent window.ondevicemotion, window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types.
2 These properties are currently enabled by a runtime flag.
</p>
8 testRunner
.dumpAsText();
16 var pre
= document
.getElementById('pre');
19 var logMessage
= logBuffer
.join("");
20 pre
.appendChild(document
.createTextNode(logMessage
));
23 function tryEval(string
)
28 return new String("Caught exception: " + e
);
32 function typeOfNullAware(value
)
34 if (typeof value
== "object" && value
== null)
39 function typeStringNullAware(value
)
41 var valueType
= typeOfNullAware(value
);
42 return valueType
== "object"
43 ? Object
.prototype.toString
.call(value
)
44 : "[" + valueType
+ "]";
47 function logValue(valueName
)
49 var value
= tryEval(valueName
);
50 var valueType
= typeOfNullAware(value
);
52 // Don't taint the test with our own variables
53 if (value
== logBuffer
|| value
== pre
)
56 // Don't taint the test with our own properties
57 if (/__visitedByLogValue__/.test(valueName
) || /__nameWhenVisitedByLogValue__/.test(valueName
))
60 // Work around Firefox infinite recursion
61 if (/\.[0-9]/.test(valueName
))
64 // Avoid infinite recursion
65 if (valueType
== "object" && value
.__visitedByLogValue__
) {
66 log(valueName
+ " [printed above as " + value
.__nameWhenVisitedByLogValue__
+ "]\n");
70 log(valueName
+ " " + typeStringNullAware(value
) + "\n");
72 if (valueType
== "object") {
73 value
.__visitedByLogValue__
= true;
74 value
.__nameWhenVisitedByLogValue__
= valueName
;
75 logProperties(value
, valueName
);
79 function logProperties(object
, objectName
)
81 var array
= new Array
;
82 for (var property
in object
) {
86 for (var i
= 0; i
< array
.length
; i
++) {
87 var property
= array
[i
];
88 logValue(objectName
+ "." + property
);
92 logValue('window.DeviceMotionEvent');
93 logValue('window.ondevicemotion');
94 logValue('window.DeviceOrientationEvent');
95 logValue('window.ondeviceorientation');