import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,5 @@
(function() {
test(function() {
assert_true(false);
}, 'Test suite not implemented yet.');
})();

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: Sensor readings must only be available in the top-level browsing context</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="support-iframe.html" id="frame" style="display:none">
</iframe>
<script>
async_test(function (t) {
document.getElementById('frame').onload = t.step_func_done(function(event) {
var iframe = document.getElementById('frame').contentWindow;
let reading = iframe.document.getElementById('reading').value;
assert_equals(reading, "null");
});
}, "sensor readings can not be fired within iframes");
test(function() {
let sensor = new AmbientLightSensor();
sensor.start();
var win = window.open('', '_blank');
let reading = String(sensor.reading);
win.close();
sensor.stop();
assert_equals(reading, "null");
}, "sensor readings can not be fired on the background tab");
</script>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: onchange</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<h2>Description</h2>
<p>
This test validates that the "onchange" event can be invoked when changing the ambient light illuminance of the device.
</p>
<h2>Precondition</h2>
<ol>
<li>
Change the ambient light illuminance of the device.
</li>
</ol>
<script>
async_test(function(t) {
let sensor = new AmbientLightSensor();
sensor.start();
sensor.onchange = t.step_func_done(function(event) {
sensor.stop();
});
sensor.onerror = t.step_func_done(function(event) {
assert_unreached(event.error.name + ":" + event.error.message);
});
}, "event change fired");
</script>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: onstatechange</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var sensor;
setup(function() {
sensor = new AmbientLightSensor();
});
test(function() {
assert_equals(sensor.state, "idle");
}, "The default sensor.state is 'idle'.");
async_test(function(t) {
sensor.onstatechange = t.step_func_done(function(event) {
assert_equals(sensor.state, "activating");
});
sensor.onerror = t.step_func_done(function(event) {
assert_unreached(event.error.name + ":" + event.error.message);
});
sensor.start();
}, "The sensor.state changes to 'activating' after sensor.start().");
async_test(function(t) {
sensor.onstatechange = t.step_func_done(function(event) {
assert_equals(sensor.state, "idle");
});
sensor.onerror = t.step_func_done(function(event) {
assert_unreached(event.error.name + ":" + event.error.message);
});
sensor.stop();
}, "The sensor.state changes to 'idle' after sensor.stop().");
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: start()</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var sensor, start_return;
setup(function() {
sensor = new AmbientLightSensor();
start_return = sensor.start();
});
test(function() {
assert_equals(String(sensor.reading), "[object AmbientLightSensorReading]");
}, "the sensor.reading is AmbientLightSensorReading after executing start() method");
test(function() {
assert_throws("InvalidStateError", function() { sensor.start(); }, "start() twice");
}, "throw an InvalidStateError exception when state is neither idle nor errored");
//TODO: The permission is not ready.
test(function() {
assert_equals(start_return, undefined);
}, "the sensor.start() return undefined");
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor Test: stop()</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var sensor, stop_return;
setup(function() {
sensor = new AmbientLightSensor();
sensor.start();
stop_return = sensor.stop();
});
test(function() {
assert_equals(String(sensor.reading), "null");
}, "the sensor.reading is null after executing stop() method");
test(function() {
assert_throws("InvalidStateError", function() { sensor.stop(); }, "stop() twice");
}, "throw an InvalidStateError exception when state is either idle or errored");
test(function() {
assert_equals(stop_return, undefined);
}, "the sensor.stop() returns undefined");
</script>

View file

@ -0,0 +1,11 @@
<!doctype html>
<meta charset=utf8>
<meta content=long name=timeout>
<meta content="width=device-width, initial-scale=1" name=viewport>
<title>Ambient Light Sensor Test Suite</title>
<link rel="help" href="http://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="AmbientLightSensor.js"></script>
<div id="log"></div>

View file

@ -0,0 +1,5 @@
@zqzhang
@Volker-E
@dontcallmedom
@tobie
@riju

View file

@ -0,0 +1,107 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Ambient Light Sensor IDL tests</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="http://www.w3.org/TR/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<style>
pre {
display: none;
}
</style>
<div id="log"></div>
<pre id="idl">
interface Event {
};
interface Error {
};
dictionary EventInit {
};
</pre>
<pre id="generic-idl">
interface Sensor : EventTarget {
readonly attribute SensorState state;
readonly attribute SensorReading? reading;
void start();
void stop();
attribute EventHandler onchange;
attribute EventHandler onstatechange;
attribute EventHandler onerror;
};
dictionary SensorOptions {
double? frequency;
};
enum SensorState {
"idle",
"activating",
"active",
"errored"
};
interface SensorReading {
readonly attribute DOMHighResTimeStamp timeStamp;
};
[Constructor(DOMString type, SensorReadingEventInit eventInitDict)]
interface SensorReadingEvent : Event {
readonly attribute SensorReading reading;
};
dictionary SensorReadingEventInit : EventInit {
SensorReading reading;
};
[Constructor(DOMString type, SensorErrorEventInit errorEventInitDict)]
interface SensorErrorEvent : Event {
readonly attribute Error error;
};
dictionary SensorErrorEventInit : EventInit {
Error error;
};
</pre>
<pre id="ambient-light-idl">
[Constructor(optional SensorOptions sensorOptions)]
interface AmbientLightSensor : Sensor {
readonly attribute AmbientLightSensorReading? reading;
};
[Constructor(AmbientLightSensorReadingInit ambientLightSensorReadingInit)]
interface AmbientLightSensorReading : SensorReading {
readonly attribute unrestricted double illuminance;
};
dictionary AmbientLightSensorReadingInit {
unrestricted double illuminance;
};
</pre>
<script>
(function() {
"use strict";
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById('idl').textContent);
idl_array.add_untested_idls(document.getElementById('generic-idl').textContent);
idl_array.add_idls(document.getElementById('ambient-light-idl').textContent);
idl_array.add_objects({
AmbientLightSensor: ['new AmbientLightSensor();'],
AmbientLightSensorReading: ['new AmbientLightSensorReading({ illuminance: 750 });'],
SensorReadingEvent: ['new SensorReadingEvent("reading", { reading: new AmbientLightSensorReading({ illuminance: 750 }) });']
});
idl_array.test();
})();
</script>

View file

@ -0,0 +1,11 @@
<!DOCTYPE HTML>
<meta charset="utf-8">
<input type="text" id="reading" />
<script>
let sensor = new AmbientLightSensor();
sensor.start();
document.getElementById("reading").value = String(sensor.reading);
sensor.stop();
</script>