fune/dom/performance/tests/test_performance_timing_json.html
Boris Zbarsky 85cfd5fbdf Bug 1375829 part 2. The default binding toJSON should skip over attributes that are not exposed in the current global. r=qdot
Without this, we will start including mozMemory in performance.toJSON() even if
the pref for it is not set, once 'object' becomes a JSON type.

This changes behavior in the following observable ways:

1) We stop exposing PerformanceResourceTiming's .serverTiming in the JSON
serialization in insecure contexts.

2) We stop exposing PerformanceTiming's timeToNonBlankPaint and
timeToDOMContentFlushed in the JSON serialization unless the relevant
preferences are turned on.
2018-05-17 23:39:52 -04:00

32 lines
887 B
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1375829
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1375829</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1375829 **/
var json = performance.timing.toJSON();
// Ensure it doesn't have any attributes that performance.timing doesn't have
for (let key of Object.keys(json)) {
ok(key in performance.timing, key + " should be a property of performance.timing");
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1375829">Mozilla Bug 1375829</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>