Bug 1577746 - Enable ESLint rule object-shorthand for dom/. r=baku

Differential Revision: https://phabricator.services.mozilla.com/D44149
This commit is contained in:
Mark Banner
2019-09-02 11:22:27 +00:00
parent c9cb99e2ae
commit e596c9beb2
311 changed files with 1465 additions and 1496 deletions

View File

@@ -259,7 +259,6 @@ module.exports = {
"rules": {
"consistent-return": "off",
"dot-notation": "off",
"object-shorthand": "off",
"mozilla/avoid-removeChild": "off",
"mozilla/consistent-if-bracing": "off",
"mozilla/no-arbitrary-setTimeout": "off",

View File

@@ -43,7 +43,7 @@ function setupSynchronousObserver(t, target, subtree) {
t.add_cleanup(() => {
observer.disconnect();
});
observer.observe(target, { animations: true, subtree: subtree });
observer.observe(target, { animations: true, subtree });
return observer;
}

View File

@@ -54,7 +54,7 @@ function assert_properties_equal(actual, expected) {
// Shorthand for constructing a value object
function value(offset, value, composite, easing) {
return { offset: offset, value: value, easing: easing, composite: composite };
return { offset, value, easing, composite };
}
var gTests = [

View File

@@ -136,7 +136,7 @@ function assert_properties_equal(actual, expected) {
* e.g. { offset: 0.1, value: '1px', composite: 'replace', easing: 'ease'}
*/
function valueFormat(offset, value, composite, easing) {
return { offset: offset, value: value, easing: easing, composite: composite };
return { offset, value, easing, composite };
}
/**

View File

@@ -18,11 +18,11 @@ ContentAreaDropListener.prototype = {
classID: Components.ID("{1f34bc80-1bc7-11d6-a384-d705dd0746fc}"),
QueryInterface: ChromeUtils.generateQI([Ci.nsIDroppedLinkHandler]),
_addLink: function(links, url, name, type) {
_addLink(links, url, name, type) {
links.push({ url, name, type });
},
_addLinksFromItem: function(links, dt, i) {
_addLinksFromItem(links, dt, i) {
let types = dt.mozTypesAt(i);
let type, data;
@@ -107,7 +107,7 @@ ContentAreaDropListener.prototype = {
}
},
_getDropLinks: function(dt) {
_getDropLinks(dt) {
let links = [];
for (let i = 0; i < dt.mozItemCount; i++) {
this._addLinksFromItem(links, dt, i);
@@ -115,12 +115,7 @@ ContentAreaDropListener.prototype = {
return links;
},
_validateURI: function(
dataTransfer,
uriString,
disallowInherit,
triggeringPrincipal
) {
_validateURI(dataTransfer, uriString, disallowInherit, triggeringPrincipal) {
if (!uriString) {
return "";
}
@@ -159,7 +154,7 @@ ContentAreaDropListener.prototype = {
return uri.spec;
},
_getTriggeringPrincipalFromDataTransfer: function(
_getTriggeringPrincipalFromDataTransfer(
aDataTransfer,
fallbackToSystemPrincipal
) {
@@ -212,12 +207,12 @@ ContentAreaDropListener.prototype = {
);
},
getTriggeringPrincipal: function(aEvent) {
getTriggeringPrincipal(aEvent) {
let dataTransfer = aEvent.dataTransfer;
return this._getTriggeringPrincipalFromDataTransfer(dataTransfer, true);
},
getCSP: function(aEvent) {
getCSP(aEvent) {
let sourceNode = aEvent.dataTransfer.mozSourceNode;
if (aEvent.dataTransfer.mozCSP !== null) {
return aEvent.dataTransfer.mozCSP;
@@ -239,7 +234,7 @@ ContentAreaDropListener.prototype = {
return null;
},
canDropLink: function(aEvent, aAllowSameDocument) {
canDropLink(aEvent, aAllowSameDocument) {
if (this._eventTargetIsDisabled(aEvent)) {
return false;
}
@@ -287,7 +282,7 @@ ContentAreaDropListener.prototype = {
return true;
},
dropLink: function(aEvent, aName, aDisallowInherit) {
dropLink(aEvent, aName, aDisallowInherit) {
aName.value = "";
let links = this.dropLinks(aEvent, aDisallowInherit);
let url = "";
@@ -302,7 +297,7 @@ ContentAreaDropListener.prototype = {
return url;
},
dropLinks: function(aEvent, aDisallowInherit) {
dropLinks(aEvent, aDisallowInherit) {
if (aEvent && this._eventTargetIsDisabled(aEvent)) {
return [];
}
@@ -334,7 +329,7 @@ ContentAreaDropListener.prototype = {
return links;
},
validateURIsForDrop: function(aEvent, aURIs, aDisallowInherit) {
validateURIsForDrop(aEvent, aURIs, aDisallowInherit) {
let dataTransfer = aEvent.dataTransfer;
let triggeringPrincipal = this._getTriggeringPrincipalFromDataTransfer(
dataTransfer,
@@ -351,11 +346,11 @@ ContentAreaDropListener.prototype = {
}
},
queryLinks: function(aDataTransfer) {
queryLinks(aDataTransfer) {
return this._getDropLinks(aDataTransfer);
},
_eventTargetIsDisabled: function(aEvent) {
_eventTargetIsDisabled(aEvent) {
let ownerDoc = aEvent.originalTarget.ownerDocument;
if (!ownerDoc || !ownerDoc.defaultView) {
return false;

View File

@@ -59,7 +59,7 @@ DOMRequestIpcHelper.prototype = {
* - or only strings containing the message name, in which case the listener
* will be added as a strong reference by default.
*/
addMessageListeners: function(aMessages) {
addMessageListeners(aMessages) {
if (!aMessages) {
return;
}
@@ -100,7 +100,7 @@ DOMRequestIpcHelper.prototype = {
* 'aMessages' is expected to be a string or an array of strings containing
* the message names of the listeners to be removed.
*/
removeMessageListeners: function(aMessages) {
removeMessageListeners(aMessages) {
if (!this._listeners || !aMessages) {
return;
}
@@ -142,7 +142,7 @@ DOMRequestIpcHelper.prototype = {
* - or only strings containing the message name, in which case the listener
* will be added as a strong referred one by default.
*/
initDOMRequestHelper: function(aWindow, aMessages) {
initDOMRequestHelper(aWindow, aMessages) {
// Query our required interfaces to force a fast fail if they are not
// provided. These calls will throw if the interface is not available.
this.QueryInterface(Ci.nsISupportsWeakReference);
@@ -170,7 +170,7 @@ DOMRequestIpcHelper.prototype = {
);
},
destroyDOMRequestHelper: function() {
destroyDOMRequestHelper() {
if (this._destroyed) {
return;
}
@@ -198,7 +198,7 @@ DOMRequestIpcHelper.prototype = {
this._window = null;
},
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
if (aTopic !== "inner-window-destroyed") {
return;
}
@@ -211,7 +211,7 @@ DOMRequestIpcHelper.prototype = {
this.destroyDOMRequestHelper();
},
getRequestId: function(aRequest) {
getRequestId(aRequest) {
if (!this._requests) {
this._requests = {};
}
@@ -221,37 +221,37 @@ DOMRequestIpcHelper.prototype = {
return id;
},
getPromiseResolverId: function(aPromiseResolver) {
getPromiseResolverId(aPromiseResolver) {
// Delegates to getRequest() since the lookup table is agnostic about
// storage.
return this.getRequestId(aPromiseResolver);
},
getRequest: function(aId) {
getRequest(aId) {
if (this._requests && this._requests[aId]) {
return this._requests[aId];
}
},
getPromiseResolver: function(aId) {
getPromiseResolver(aId) {
// Delegates to getRequest() since the lookup table is agnostic about
// storage.
return this.getRequest(aId);
},
removeRequest: function(aId) {
removeRequest(aId) {
if (this._requests && this._requests[aId]) {
delete this._requests[aId];
}
},
removePromiseResolver: function(aId) {
removePromiseResolver(aId) {
// Delegates to getRequest() since the lookup table is agnostic about
// storage.
this.removeRequest(aId);
},
takeRequest: function(aId) {
takeRequest(aId) {
if (!this._requests || !this._requests[aId]) {
return null;
}
@@ -260,20 +260,20 @@ DOMRequestIpcHelper.prototype = {
return request;
},
takePromiseResolver: function(aId) {
takePromiseResolver(aId) {
// Delegates to getRequest() since the lookup table is agnostic about
// storage.
return this.takeRequest(aId);
},
_getRandomId: function() {
_getRandomId() {
return Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator)
.generateUUID()
.toString();
},
createRequest: function() {
createRequest() {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError(
@@ -289,7 +289,7 @@ DOMRequestIpcHelper.prototype = {
* PromiseInit callback. The promise constructor is obtained from the
* reference to window owned by this DOMRequestIPCHelper.
*/
createPromise: function(aPromiseInit) {
createPromise(aPromiseInit) {
// If we don't have a valid window object, throw.
if (!this._window) {
Cu.reportError(
@@ -304,7 +304,7 @@ DOMRequestIpcHelper.prototype = {
* createPromiseWithId() creates a new Promise, accepting a callback
* which is immediately called with the generated resolverId.
*/
createPromiseWithId: function(aCallback) {
createPromiseWithId(aCallback) {
return this.createPromise((aResolve, aReject) => {
let resolverId = this.getPromiseResolverId({
resolve: aResolve,
@@ -314,7 +314,7 @@ DOMRequestIpcHelper.prototype = {
});
},
forEachRequest: function(aCallback) {
forEachRequest(aCallback) {
if (!this._requests) {
return;
}
@@ -326,7 +326,7 @@ DOMRequestIpcHelper.prototype = {
});
},
forEachPromiseResolver: function(aCallback) {
forEachPromiseResolver(aCallback) {
if (!this._requests) {
return;
}

View File

@@ -4,7 +4,7 @@ add_task(async function() {
var statusTexts = [];
var xhr = new XMLHttpRequest();
var observer = {
observe: function(aSubject, aTopic, aData) {
observe(aSubject, aTopic, aData) {
try {
var channel = aSubject.QueryInterface(Ci.nsIHttpChannel);
channel.getResponseHeader("Location");

View File

@@ -194,9 +194,7 @@ var check_use_counter_iframe = async function(
await waitForPageLoad(gBrowser.selectedBrowser);
// Inject our desired file into the iframe of the newly-loaded page.
await ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(
opts
) {
await ContentTask.spawn(gBrowser.selectedBrowser, { file }, function(opts) {
let iframe = content.document.getElementById("content");
iframe.src = opts.file;
@@ -268,22 +266,20 @@ var check_use_counter_img = async function(file, use_counter_middlefix) {
await waitForPageLoad(gBrowser.selectedBrowser);
// Inject our desired file into the img of the newly-loaded page.
await ContentTask.spawn(
gBrowser.selectedBrowser,
{ file: file },
async function(opts) {
let img = content.document.getElementById("display");
img.src = opts.file;
await ContentTask.spawn(gBrowser.selectedBrowser, { file }, async function(
opts
) {
let img = content.document.getElementById("display");
img.src = opts.file;
return new Promise(resolve => {
let listener = event => {
img.removeEventListener("load", listener, true);
resolve();
};
img.addEventListener("load", listener, true);
});
}
);
return new Promise(resolve => {
let listener = event => {
img.removeEventListener("load", listener, true);
resolve();
};
img.addEventListener("load", listener, true);
});
});
// Tear down the page.
let tabClosed = BrowserTestUtils.waitForTabClosing(newTab);

View File

@@ -16,11 +16,11 @@ var gData1 = "TEST_DATA_1:ABCDEFGHIJKLMNOPQRSTUVWXYZ" + gPadding;
var gData2 = "TEST_DATA_2:1234567890" + gPadding;
function ok(a, msg) {
postMessage({ type: "status", status: !!a, msg: msg });
postMessage({ type: "status", status: !!a, msg });
}
function is(a, b, msg) {
postMessage({ type: "status", status: a === b, msg: msg });
postMessage({ type: "status", status: a === b, msg });
}
function checkData(xhr, data, mapped, cb) {

View File

@@ -453,7 +453,7 @@
}
function check( type, root, expect, fragment ){
var walker = document.createTreeWalker( root, NodeFilter.SHOW_ELEMENT, { acceptNode: function(){ return 1; } } );
var walker = document.createTreeWalker( root, NodeFilter.SHOW_ELEMENT, { acceptNode(){ return 1; } } );
while ( walker.nextNode() ) {
var div = walker.currentNode;

View File

@@ -8,5 +8,5 @@
threw = true;
}
var sandboxed = (location.search == "?sandboxed");
parent.postMessage({ threw: threw, sandboxed: sandboxed }, "*");
parent.postMessage({ threw, sandboxed }, "*");
</script>

View File

@@ -9,11 +9,11 @@ for (var i = 0; i < gPaddingSize; i++) {
}
function ok(a, msg) {
postMessage({ type: "status", status: !!a, msg: msg });
postMessage({ type: "status", status: !!a, msg });
}
function is(a, b, msg) {
postMessage({ type: "status", status: a === b, msg: msg });
postMessage({ type: "status", status: a === b, msg });
}
function checkData(response, data_head, cb) {

View File

@@ -9,13 +9,13 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
let SimpleTest = {
finish: function() {
parent.postMessage(JSON.stringify({fn: "finish"}), "*");
}
finish() {
parent.postMessage(JSON.stringify({fn: "finish"}), "*");
}
};
["ok", "is", "info"].forEach(fn => {
self[fn] = function (...args) {
parent.postMessage(JSON.stringify({fn: fn, args: args}), "*");
parent.postMessage(JSON.stringify({fn, args}), "*");
}
});
"use strict";

View File

@@ -16,7 +16,7 @@ SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();

View File

@@ -23,7 +23,7 @@ async function startTest() {
}
const observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
const expected = expectedNotifications.shift();
is(data, expected, `"${data}" is the right notification`);

View File

@@ -20,7 +20,7 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedPlaybackActive, "Corrrect audible state");
continueTest();

View File

@@ -21,7 +21,7 @@ var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedPlaybackActive, "Corrrect audible state");
is(ac.state, expectedPlaying, "Corrrect playing state");

View File

@@ -18,7 +18,7 @@ var expectedNotification = null;
var iframe = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();

View File

@@ -16,7 +16,7 @@ SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();

View File

@@ -16,7 +16,7 @@ SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();

View File

@@ -29,7 +29,7 @@ var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d
var policyName = "@mozilla.org/testpolicy;1";
var policy = {
// nsISupports implementation
QueryInterface: function(iid) {
QueryInterface(iid) {
iid = SpecialPowers.wrap(iid);
if (iid.equals(Ci.nsISupports) ||
@@ -41,12 +41,12 @@ var policy = {
},
// nsIFactory implementation
createInstance: function(outer, iid) {
createInstance(outer, iid) {
return this.QueryInterface(iid);
},
// nsIContentPolicy implementation
shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) {
shouldLoad(contentLocation, loadInfo, mimeTypeGuess) {
let contentType = loadInfo.externalContentPolicyType;
// Remember last content type seen for the test url
if (SpecialPowers.wrap(contentLocation).spec == testURL) {
@@ -57,7 +57,7 @@ var policy = {
return Ci.nsIContentPolicy.ACCEPT;
},
shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) {
shouldProcess(contentLocation, loadInfo, mimeTypeGuess) {
return Ci.nsIContentPolicy.ACCEPT;
}

View File

@@ -24,33 +24,33 @@ function fromCache(xhr)
var tests = [
// First just init the file with an ETag
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs?etag=a1");
},
loading: function(xhr)
loading(xhr)
{
},
done: function(xhr)
done(xhr)
{
},
},
// Try to load the file the first time regularly, we have to get 200 OK
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), false, "Not coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We get a fresh version of the file");
is(xhr.getResponseHeader("Etag"), "a1", "We got correct ETag");
@@ -60,18 +60,18 @@ var tests = [
// Try to load the file the second time regularly, we have to get 304 Not Modified
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a1");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a1", "We got correct ETag");
@@ -81,18 +81,18 @@ var tests = [
// Try to load the file the third time regularly, we have to get 304 Not Modified
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a1");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a1", "We got correct ETag");
@@ -102,34 +102,34 @@ var tests = [
// Now modify the ETag
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs?etag=a2");
},
loading: function(xhr)
loading(xhr)
{
},
done: function(xhr)
done(xhr)
{
},
},
// Try to load the file, we have to get 200 OK with the new content
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a2");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), false, "Not coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We get a fresh version of the file");
is(xhr.getResponseHeader("Etag"), "a2", "We got correct ETag");
@@ -139,18 +139,18 @@ var tests = [
// Try to load the file the second time regularly, we have to get 304 Not Modified
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a2");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a2", "We got correct ETag");
@@ -160,18 +160,18 @@ var tests = [
// Try to load the file the third time regularly, we have to get 304 Not Modified
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a2");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a2", "We got correct ETag");
@@ -181,34 +181,34 @@ var tests = [
// Now modify the ETag ones more
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs?etag=a3");
},
loading: function(xhr)
loading(xhr)
{
},
done: function(xhr)
done(xhr)
{
},
},
// Try to load the file, we have to get 200 OK with the new content
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a3");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), false, "Not coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We get a fresh version of the file");
is(xhr.getResponseHeader("Etag"), "a3", "We got correct ETag");
@@ -218,18 +218,18 @@ var tests = [
// Try to load the file the second time regularly, we have to get 304 Not Modified
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a3");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a3", "We got correct ETag");
@@ -239,18 +239,18 @@ var tests = [
// Try to load the file the third time regularly, we have to get 304 Not Modified
{
init: function(xhr)
init(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a3");
},
loading: function(xhr)
loading(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
done(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a3", "We got correct ETag");
@@ -260,15 +260,15 @@ var tests = [
// Load one last time to reset the state variable in the .sjs file
{
init: function (xhr) {
init (xhr) {
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a1");
},
loading: function (xhr) {
loading (xhr) {
},
done: function (xhr) {
done (xhr) {
},
},
]

View File

@@ -29,7 +29,7 @@ var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{65944d64-2390-4
var policyName = "@mozilla.org/498897_testpolicy;1";
var policy = {
// nsISupports implementation
QueryInterface: function(iid) {
QueryInterface(iid) {
if (iid.equals(Ci.nsISupports) ||
iid.equals(Ci.nsIFactory) ||
iid.equals(Ci.nsIContentPolicy))
@@ -39,12 +39,12 @@ var policy = {
},
// nsIFactory implementation
createInstance: function(outer, iid) {
createInstance(outer, iid) {
return this.QueryInterface(iid);
},
// nsIContentPolicy implementation
shouldLoad: function(contentLocation, loadInfo, mimeTypeGuess) {
shouldLoad(contentLocation, loadInfo, mimeTypeGuess) {
var url = window.location.href.substr(0, window.location.href.indexOf('test_bug498897'));
let loadingPrincipal = loadInfo.loadingPrincipal;
if (loadingPrincipal) {
@@ -58,7 +58,7 @@ var policy = {
return Ci.nsIContentPolicy.ACCEPT;
},
shouldProcess: function(contentLocation, loadInfo, mimeTypeGuess) {
shouldProcess(contentLocation, loadInfo, mimeTypeGuess) {
return Ci.nsIContentPolicy.ACCEPT;
}
}

View File

@@ -119,7 +119,7 @@ function noWhiteSpaceWalk()
var walker = document.createTreeWalker(document.getElementById('content'),
NodeFilter.SHOW_ALL,
{
acceptNode : function(node) {
acceptNode(node) {
if (node.nodeType == Node.TEXT_NODE &&
!(/[^\t\n\r ]/.test(node.nodeValue)))
return NodeFilter.FILTER_REJECT;
@@ -175,7 +175,7 @@ function onlyDivSubTreeWalk()
var walker = document.createTreeWalker(document.getElementById('content'),
NodeFilter.SHOW_ALL,
{
acceptNode : function(node) {
acceptNode(node) {
if (node.nodeType == Node.TEXT_NODE &&
!(/[^\t\n\r ]/.test(node.nodeValue)))
return NodeFilter.FILTER_REJECT;
@@ -213,7 +213,7 @@ function onlyDivDataWalk()
var walker = document.createTreeWalker(document.getElementById('content'),
NodeFilter.SHOW_ALL,
{
acceptNode : function(node) {
acceptNode(node) {
if (node.nodeName == "DIV" ||
(node.parentNode &&
node.parentNode.nodeName == "DIV"))

View File

@@ -45,19 +45,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1352882
encoder = getEncoder();
var stream = {
close: function() {
},
close() {
},
flush: function() {
},
flush() {
},
write: function(buffer, length) {
return length;
},
write(buffer, length) {
return length;
},
writeFrom: function(buffer, length) {
return length;
},
writeFrom(buffer, length) {
return length;
},
};
encoder.setCharset("utf-8");

View File

@@ -53,7 +53,7 @@
headers.set('User-Agent', 'custom-ua/20.0');
var response2 = await fetch('file_explicit_user_agent.sjs', {
method: 'GET',
headers: headers,
headers,
});
is(response2.headers.get("Result-User-Agent"), 'custom-ua/20.0',
"The user-agent is the custom UA");

View File

@@ -52,7 +52,7 @@ limitations under the License.
function it(msg, fn) {
tests.push({
msg: `${msg} [${curDescribeMsg}]`,
fn: fn
fn
});
}
@@ -74,14 +74,14 @@ limitations under the License.
function expect(val) {
return {
to: {
throwException: function (regexp) {
try {
val();
ok(false, `${curItMsg} - an exception should have beeen thrown`);
} catch (e) {
ok(regexp.test(e), `${curItMsg} - supplied regexp should match thrown exception`);
}
},
throwException (regexp) {
try {
val();
ok(false, `${curItMsg} - an exception should have beeen thrown`);
} catch (e) {
ok(regexp.test(e), `${curItMsg} - supplied regexp should match thrown exception`);
}
},
get be() {
var fn = function (expected) {
is(val, expected, curItMsg);
@@ -97,25 +97,25 @@ limitations under the License.
};
return fn;
},
eql: function (expected) {
if (Array.isArray(expected)) {
if (!Array.isArray(val)) {
ok(false, curItMsg, `${curItMsg} - should be an array,`);
return;
}
is(val.length, expected.length, curItMsg, `${curItMsg} - arrays should be the same length`);
if (expected.length != val.length) {
return;
}
for (var i = 0; i < expected.length; i++) {
is(val[i], expected[i], `${curItMsg} - array elements at position ${i} should be equal`);
if (expected[i] != val[i]) {
return;
}
}
ok(true);
eql (expected) {
if (Array.isArray(expected)) {
if (!Array.isArray(val)) {
ok(false, curItMsg, `${curItMsg} - should be an array,`);
return;
}
},
is(val.length, expected.length, curItMsg, `${curItMsg} - arrays should be the same length`);
if (expected.length != val.length) {
return;
}
for (var i = 0; i < expected.length; i++) {
is(val[i], expected[i], `${curItMsg} - array elements at position ${i} should be equal`);
if (expected[i] != val[i]) {
return;
}
}
ok(true);
}
},
}
}
}
@@ -149,22 +149,22 @@ limitations under the License.
}
var sinon = {
spy: function () {
var cbs = [];
var fn = function () {
fn.callCount++;
fn.lastCall = { args: arguments };
if (cbs.length) {
cbs.shift()();
}
};
fn.callCount = 0;
fn.lastCall = { args: [] };
fn.waitForNotification = (fn1) => {
cbs.push(fn1);
};
return fn;
}
spy () {
var cbs = [];
var fn = function () {
fn.callCount++;
fn.lastCall = { args: arguments };
if (cbs.length) {
cbs.shift()();
}
};
fn.callCount = 0;
fn.lastCall = { args: [] };
fn.waitForNotification = (fn1) => {
cbs.push(fn1);
};
return fn;
}
};
var ASYNC_TIMEOUT = 300;

View File

@@ -68,10 +68,10 @@ if (!("isnot" in window)) {
if (!("SimpleTest" in window)) {
window.SimpleTest =
{
finish: function() {
finish() {
document.getElementById("log").appendChild(document.createTextNode("DONE"));
},
waitForExplicitFinish: function() {}
waitForExplicitFinish() {}
}
}

View File

@@ -14,7 +14,7 @@
SimpleTest.waitForExplicitFinish();
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
ok(false, "should not receive audio-playback notification!");
}
};

View File

@@ -16,7 +16,7 @@ SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
if (expectedNotification !== null) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");

View File

@@ -16,7 +16,7 @@ SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
if (expectedNotification !== null) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");

View File

@@ -16,7 +16,7 @@ SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
if (expectedNotification !== null) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");

View File

@@ -15,7 +15,7 @@ SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("Testing an event not happening");
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
ok(false, "should not receive audio-playback notification!");
}
};

View File

@@ -316,7 +316,7 @@ function test_windowToWindow() {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: true,
transferableObjects: true,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
resolve = r;
@@ -329,7 +329,7 @@ function test_windowToWindow() {
});
},
finished: function() {
finished() {
onmessage = null;
next();
}
@@ -370,7 +370,7 @@ function test_windowToIframeURL(url) {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: true,
transferableObjects: true,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
resolve = r;
try {
@@ -382,7 +382,7 @@ function test_windowToIframeURL(url) {
});
},
finished: function() {
finished() {
document.body.removeChild(ifr);
onmessage = null;
next();
@@ -418,7 +418,7 @@ function test_workers() {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: true,
transferableObjects: true,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
resolve = r;
try {
@@ -430,7 +430,7 @@ function test_workers() {
});
},
finished: function() {
finished() {
onmessage = null;
next();
}
@@ -462,7 +462,7 @@ function test_broadcastChannel() {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: false,
transferableObjects: false,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
if (ports.length) {
rr();
@@ -474,7 +474,7 @@ function test_broadcastChannel() {
});
},
finished: function() {
finished() {
onmessage = null;
next();
}
@@ -508,7 +508,7 @@ function test_broadcastChannel_inWorkers() {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: false,
transferableObjects: false,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
if (ports.length) {
rr();
@@ -520,7 +520,7 @@ function test_broadcastChannel_inWorkers() {
});
},
finished: function() {
finished() {
onmessage = null;
next();
}
@@ -550,7 +550,7 @@ function test_messagePort() {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: false,
transferableObjects: true,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
resolve = r;
try {
@@ -562,7 +562,7 @@ function test_messagePort() {
});
},
finished: function() {
finished() {
onmessage = null;
next();
}
@@ -596,7 +596,7 @@ function test_messagePort_inWorkers() {
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: false,
transferableObjects: true,
send: function(what, ports) {
send(what, ports) {
return new Promise(function(r, rr) {
resolve = r;
try {
@@ -608,7 +608,7 @@ function test_messagePort_inWorkers() {
});
},
finished: function() {
finished() {
onmessage = null;
next();
}

View File

@@ -18,7 +18,7 @@ var expectedNotification = null;
var iframe = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
SimpleTest.executeSoon(runTest);

View File

@@ -18,7 +18,7 @@ var expectedNotification = null;
var iframe = null;
var observer = {
observe: function(subject, topic, data) {
observe(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();

View File

@@ -40,7 +40,7 @@ CaptureStreamTestHelper.prototype = {
* Perform the drawing operation on each animation frame until stop is called
* on the returned object.
*/
startDrawing: function(f) {
startDrawing(f) {
var stop = false;
var draw = () => {
if (stop) {
@@ -54,7 +54,7 @@ CaptureStreamTestHelper.prototype = {
},
/* Request a frame from the stream played by |video|. */
requestFrame: function(video) {
requestFrame(video) {
info("Requesting frame from " + video.id);
video.srcObject.requestFrame();
},
@@ -63,7 +63,7 @@ CaptureStreamTestHelper.prototype = {
* Returns the pixel at (|offsetX|, |offsetY|) (from top left corner) of
* |video| as an array of the pixel's color channels: [R,G,B,A].
*/
getPixel: function(video, offsetX = 0, offsetY = 0) {
getPixel(video, offsetX = 0, offsetY = 0) {
// Avoids old values in case of a transparent image.
CaptureStreamTestHelper2D.prototype.clear.call(this, this.cout);
@@ -89,7 +89,7 @@ CaptureStreamTestHelper.prototype = {
*
* Threshold defaults to 0 which is an exact match.
*/
isPixel: function(px, refColor, threshold = 0) {
isPixel(px, refColor, threshold = 0) {
return px.every((ch, i) => Math.abs(ch - refColor.data[i]) <= threshold);
},
@@ -100,14 +100,14 @@ CaptureStreamTestHelper.prototype = {
*
* Threshold defaults to 127 which should be far enough for most cases.
*/
isPixelNot: function(px, refColor, threshold = 127) {
isPixelNot(px, refColor, threshold = 127) {
return px.some((ch, i) => Math.abs(ch - refColor.data[i]) > threshold);
},
/*
* Behaves like isPixelNot but ignores the alpha channel.
*/
isOpaquePixelNot: function(px, refColor, threshold) {
isOpaquePixelNot(px, refColor, threshold) {
px[3] = refColor.data[3];
return this.isPixelNot(px, refColor, threshold);
},
@@ -116,7 +116,7 @@ CaptureStreamTestHelper.prototype = {
* Returns a promise that resolves when the provided function |test|
* returns true, or rejects when the optional `cancel` promise resolves.
*/
waitForPixel: async function(
async waitForPixel(
video,
test,
{
@@ -151,7 +151,7 @@ CaptureStreamTestHelper.prototype = {
* on all channels. Use |threshold| for fuzzy matching the color on each
* channel, in the range [0,255]. 0 means exact match, 255 accepts anything.
*/
pixelMustBecome: async function(
async pixelMustBecome(
video,
refColor,
{ threshold = 0, infoString = "n/a", cancel = new Promise(() => {}) } = {}
@@ -202,7 +202,7 @@ CaptureStreamTestHelper.prototype = {
* top left pixel of |video| becomes |refColor|. The test is failed if the
* time is not reached, or if the cancel promise resolves.
*/
pixelMustNotBecome: async function(
async pixelMustNotBecome(
video,
refColor,
{ threshold = 0, time = 5000, infoString = "n/a" } = {}
@@ -236,7 +236,7 @@ CaptureStreamTestHelper.prototype = {
},
/* Create an element of type |type| with id |id| and append it to the body. */
createAndAppendElement: function(type, id) {
createAndAppendElement(type, id) {
var e = document.createElement(type);
e.id = id;
e.width = this.elemWidth;

View File

@@ -1,7 +1,7 @@
importScripts("imagebitmap_bug1239300.js");
function ok(expect, msg) {
postMessage({ type: "status", status: !!expect, msg: msg });
postMessage({ type: "status", status: !!expect, msg });
}
function doneTask() {

View File

@@ -1,5 +1,5 @@
function ok(expect, msg) {
postMessage({ type: "status", status: !!expect, msg: msg });
postMessage({ type: "status", status: !!expect, msg });
}
onmessage = function(event) {
@@ -21,7 +21,7 @@ onmessage = function(event) {
);
// send the newly created ImageBitmap back to the main-thread
postMessage({ type: "bitmap2", bitmap: bitmap });
postMessage({ type: "bitmap2", bitmap });
// finish the test
postMessage({ type: "finish" });

View File

@@ -4,7 +4,7 @@
<script type="application/javascript">
function ok(expect, msg) {
window.parent.postMessage({"type": "status", status: !!expect, msg: msg}, "*");
window.parent.postMessage({"type": "status", status: !!expect, msg}, "*");
}
window.onmessage = function(event) {

View File

@@ -87,7 +87,7 @@ function compareImageBitmapWithImageElement(imageBitmap, imageElement) {
var yGap = imageElement.naturalHeight / 4;
for (var y = 0; y < imageElement.naturalHeight; y += yGap) {
for (var x = 0; x < imageElement.naturalWidth; x += xGap) {
pixels.push({ x: x, y: y });
pixels.push({ x, y });
}
}
@@ -123,7 +123,7 @@ function compareImageBitmapWithImageData(imageBitmap, imageData, info) {
var yGap = imageBitmap.height / 4;
for (var y = 0; y < imageBitmap.height; y += yGap) {
for (var x = 0; x < imageBitmap.width; x += xGap) {
pixels.push({ x: x, y: y });
pixels.push({ x, y });
}
}

View File

@@ -31,11 +31,11 @@
}
function drawCount(count) {
postMessageGeneral({ type: "draw", count: count });
postMessageGeneral({ type: "draw", count });
}
function sendBlob(blob) {
postMessageGeneral({ type: "blob", blob: blob });
postMessageGeneral({ type: "blob", blob });
}
function sendImageBitmap(img) {

View File

@@ -39,7 +39,7 @@ TaskWithCrop.prototype.constructor = TaskWithCrop;
var WORKER_TASKS = {
tasks: [], // an arrayf of Task objects
dispatch: function() {
dispatch() {
if (this.tasks.length) {
worker.postMessage(this.tasks.pop());
} else {

View File

@@ -43,7 +43,7 @@ function runTest() {
}
var offscreenCanvas = canvas.transferControlToOffscreen();
worker.postMessage({test: test, canvas: offscreenCanvas}, [offscreenCanvas]);
worker.postMessage({test, canvas: offscreenCanvas}, [offscreenCanvas]);
}
/* create 4 workers that do the regular drawing test and 4 workers

View File

@@ -123,16 +123,16 @@ DriverInfo = (function() {
dump(x => console.log(x));
return {
DRIVER: DRIVER,
OS: OS,
dump: dump,
getDriver: function() {
DRIVER,
OS,
dump,
getDriver() {
return kDriver;
},
getOS: function() {
getOS() {
return kOS;
},
getOSVersion: function() {
getOSVersion() {
return kOSVersion;
},
};

View File

@@ -161,15 +161,15 @@ WebGLUtil = (function() {
}
return {
setErrorFunc: setErrorFunc,
setWarningFunc: setWarningFunc,
setErrorFunc,
setWarningFunc,
getWebGL: getWebGL,
withWebGL2: withWebGL2,
createShaderById: createShaderById,
createProgramByIds: createProgramByIds,
getWebGL,
withWebGL2,
createShaderById,
createProgramByIds,
linkProgramByIds: function(gl, vertSrcElem, fragSrcElem) {
linkProgramByIds(gl, vertSrcElem, fragSrcElem) {
const prog = gl.createProgram();
function attachShaderById(type, srcElem) {

View File

@@ -206,7 +206,7 @@ function testDecodeValidBOMUTF16() {
];
testBOMCharset({
encoding: "utf-16be",
data: data,
data,
expected: expectedString,
msg: "decoder valid UTF-16BE test.",
});
@@ -218,7 +218,7 @@ function testBOMEncodingUTF8() {
var expectedString = " !\"#$%&'";
testBOMCharset({
encoding: "utf-8",
data: data,
data,
expected: expectedString,
msg: "utf-8 encoding.",
});
@@ -228,7 +228,7 @@ function testBOMEncodingUTF8() {
expectedString = " !\"#$%&'";
testBOMCharset({
encoding: "utf-8",
data: data,
data,
expected: expectedString,
msg: "valid utf-8 encoding provided with VALID utf-8 BOM test.",
});
@@ -238,7 +238,7 @@ function testBOMEncodingUTF8() {
testBOMCharset({
encoding: "utf-8",
fatal: true,
data: data,
data,
error: "TypeError",
msg: "valid utf-8 encoding provided with invalid utf-8 fatal BOM test.",
});
@@ -248,7 +248,7 @@ function testBOMEncodingUTF8() {
expectedString = "\ufffd\ufffd !\"#$%&'";
testBOMCharset({
encoding: "utf-8",
data: data,
data,
expected: expectedString,
msg: "valid utf-8 encoding provided with invalid utf-8 BOM test.",
});
@@ -257,7 +257,7 @@ function testBOMEncodingUTF8() {
data = [0xff, 0xfe, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27];
testBOMCharset({
encoding: "",
data: data,
data,
error: "RangeError",
msg: "empty encoding provided with invalid utf-8 BOM test.",
});
@@ -462,14 +462,14 @@ function testMoreBOMEncoding() {
testBOMCharset({
encoding: "utf-16be",
fatal: true,
data: data,
data,
expected: "\ufffe" + expectedString,
msg: "test decoder invalid BOM encoding for utf-16be fatal.",
});
testBOMCharset({
encoding: "utf-16be",
data: data,
data,
expected: "\ufffe" + expectedString,
msg: "test decoder invalid BOM encoding for utf-16be.",
});
@@ -1081,7 +1081,7 @@ function testMoreBOMEncoding() {
testBOMCharset({
encoding: "utf-8",
fatal: true,
data: data,
data,
error: "TypeError",
msg:
"test decoder invalid BOM encoding for valid utf-8 fatal provided label.",
@@ -1089,7 +1089,7 @@ function testMoreBOMEncoding() {
testBOMCharset({
encoding: "utf-8",
data: data,
data,
expected: "\ufffd\ufffd" + expectedString,
msg: "test decoder invalid BOM encoding for valid utf-8 provided label.",
});
@@ -1202,14 +1202,14 @@ function testMoreBOMEncoding() {
testBOMCharset({
encoding: "greek",
fatal: true,
data: data,
data,
error: "TypeError",
msg: "test decoder encoding provided with invalid BOM encoding for greek.",
});
testBOMCharset({
encoding: "greek",
data: data,
data,
expected: expectedString,
msg: "test decoder encoding provided with invalid BOM encoding for greek.",
});

View File

@@ -165,7 +165,7 @@ function testConstructorEncodingOption(aData, aExpectedString) {
// valid encoding passed
var encoding = "iso-8859-11";
testCharset({
encoding: encoding,
encoding,
input: aData,
expected: aExpectedString,
msg: "decoder testing constructor valid encoding.",
@@ -174,7 +174,7 @@ function testConstructorEncodingOption(aData, aExpectedString) {
// passing spaces for encoding
encoding = " ";
testCharset({
encoding: encoding,
encoding,
input: aData,
error: "RangeError",
errorMessage: errorMessage(encoding),
@@ -184,7 +184,7 @@ function testConstructorEncodingOption(aData, aExpectedString) {
// invalid encoding passed
encoding = "asdfasdf";
testCharset({
encoding: encoding,
encoding,
input: aData,
error: "RangeError",
errorMessage: errorMessage(encoding),
@@ -194,7 +194,7 @@ function testConstructorEncodingOption(aData, aExpectedString) {
// null encoding passed
encoding = null;
testCharset({
encoding: encoding,
encoding,
input: aData,
error: "RangeError",
errorMessage: errorMessage(encoding),
@@ -204,7 +204,7 @@ function testConstructorEncodingOption(aData, aExpectedString) {
// empty encoding passed
encoding = "";
testCharset({
encoding: encoding,
encoding,
input: aData,
error: "RangeError",
errorMessage: errorMessage(encoding),
@@ -519,7 +519,7 @@ function testDecodeStreamCompositions() {
}
testCharset({
encoding: t.encoding,
array: array,
array,
msg: "decode() stream test " + t.encoding + " " + a.join("-") + ".",
});
while (a[l] > 1) {

View File

@@ -122,8 +122,8 @@ var tests = [];
function test(func, msg) {
tests.push({
msg: msg,
func: func,
msg,
func,
filename: Components.stack.caller.filename,
});
}

View File

@@ -8,7 +8,7 @@ function runTestInWorker(files) {
var asserts;
test = function(func, msg) {
asserts = [];
tests.push({ asserts: asserts, msg: msg });
tests.push({ asserts, msg });
};
assert_equals = function(result, expected, msg) {
asserts.push(["assert_equals", result, expected, msg]);

View File

@@ -8,9 +8,9 @@ addEventListener("error", function(e) {
});
onerror = function(message, filename, lineno) {
var obj = {
message: message,
filename: filename,
lineno: lineno,
message,
filename,
lineno,
type: "callback",
};
postMessage(obj);

View File

@@ -69,7 +69,7 @@ var MouseEventHelper = (function() {
BUTTONS_5TH: utils.MOUSE_BUTTONS_5TH_BUTTON,
// Utils
computeButtonsMaskFromButton: function(aButton) {
computeButtonsMaskFromButton(aButton) {
// Since the range of button values is 0 ~ 2 (see nsIDOMWindowUtils.idl),
// we can use an array to find out the desired mask.
var mask = [
@@ -83,7 +83,7 @@ var MouseEventHelper = (function() {
return mask;
},
checkExitState: function() {
checkExitState() {
ok(!this.BUTTONS_STATE, "Mismatched mousedown/mouseup caught.");
},
};
@@ -179,7 +179,7 @@ var TouchEventHelper = {
TOUCH_STATE: false,
// Utils
checkExitState: function() {
checkExitState() {
ok(!this.TOUCH_STATE, "Mismatched touchstart/touchend caught.");
},
};

View File

@@ -26,7 +26,7 @@ function resultCallback(aTestObj) {
window.opener.postMessage(
{
type: "RESULT",
message: message,
message,
result: aTestObj["status"] === aTestObj["PASS"],
},
PARENT_ORIGIN

View File

@@ -49,16 +49,16 @@ function check_PointerEvent(event, testNamePrefix) {
// * if the attribute is "readonly", it cannot be changed
// TA: 1.1, 1.2
var idl_type_check = {
long: function(v) {
long(v) {
return typeof v === "number" && Math.round(v) === v;
},
float: function(v) {
float(v) {
return typeof v === "number";
},
string: function(v) {
string(v) {
return typeof v === "string";
},
boolean: function(v) {
boolean(v) {
return typeof v === "boolean";
},
};

View File

@@ -24,70 +24,70 @@
* aName specifies the event's type name. See each create() code for the detail of aProps.
*/
const kEventConstructors = {
Event: { create: function (aName, aProps) {
Event: { create (aName, aProps) {
return new Event(aName, aProps);
},
},
AnimationEvent: { create: function (aName, aProps) {
AnimationEvent: { create (aName, aProps) {
return new AnimationEvent(aName, aProps);
},
},
AnimationPlaybackEvent: { create: function (aName, aProps) {
AnimationPlaybackEvent: { create (aName, aProps) {
return new AnimationPlaybackEvent(aName, aProps);
},
},
AudioProcessingEvent: { create: null, // Cannot create untrusted event from JS.
},
BeforeUnloadEvent: { create: function (aName, aProps) {
BeforeUnloadEvent: { create (aName, aProps) {
var e = document.createEvent("beforeunloadevent");
e.initEvent(aName, aProps.bubbles, aProps.cancelable);
return e;
},
},
BlobEvent: { create: function (aName, aProps) {
BlobEvent: { create (aName, aProps) {
return new BlobEvent(aName, aProps);
},
},
CallEvent: { create: function (aName, aProps) {
CallEvent: { create (aName, aProps) {
return new CallEvent(aName, aProps);
},
},
CallGroupErrorEvent: { create: function (aName, aProps) {
CallGroupErrorEvent: { create (aName, aProps) {
return new CallGroupErrorEvent(aName, aProps);
},
},
CFStateChangeEvent: { create: function (aName, aProps) {
CFStateChangeEvent: { create (aName, aProps) {
return new CFStateChangeEvent(aName, aProps);
},
},
CloseEvent: { create: function (aName, aProps) {
CloseEvent: { create (aName, aProps) {
return new CloseEvent(aName, aProps);
},
},
ClipboardEvent: { create: function (aName, aProps) {
ClipboardEvent: { create (aName, aProps) {
return new ClipboardEvent(aName, aProps);
},
},
CompositionEvent: { create: function (aName, aProps) {
CompositionEvent: { create (aName, aProps) {
var e = document.createEvent("compositionevent");
e.initCompositionEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.data, aProps.locale);
return e;
},
},
CustomEvent: { create: function (aName, aProps) {
CustomEvent: { create (aName, aProps) {
return new CustomEvent(aName, aProps);
},
},
DataErrorEvent: { create: function (aName, aProps) {
DataErrorEvent: { create (aName, aProps) {
return new DataErrorEvent(aName, aProps);
},
},
DeviceLightEvent: { create: function (aName, aProps) {
DeviceLightEvent: { create (aName, aProps) {
return new DeviceLightEvent(aName, aProps);
},
},
DeviceMotionEvent: { create: function (aName, aProps) {
DeviceMotionEvent: { create (aName, aProps) {
var e = document.createEvent("devicemotionevent");
e.initDeviceMotionEvent(aName, aProps.bubbles, aProps.cancelable, aProps.acceleration,
aProps.accelerationIncludingGravity, aProps.rotationRate,
@@ -95,19 +95,19 @@ const kEventConstructors = {
return e;
},
},
DeviceOrientationEvent: { create: function (aName, aProps) {
DeviceOrientationEvent: { create (aName, aProps) {
return new DeviceOrientationEvent(aName, aProps);
},
},
DeviceProximityEvent: { create: function (aName, aProps) {
DeviceProximityEvent: { create (aName, aProps) {
return new DeviceProximityEvent(aName, aProps);
},
},
DownloadEvent: { create: function (aName, aProps) {
DownloadEvent: { create (aName, aProps) {
return new DownloadEvent(aName, aProps);
},
},
DragEvent: { create: function (aName, aProps) {
DragEvent: { create (aName, aProps) {
var e = document.createEvent("dragevent");
e.initDragEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.detail,
@@ -118,93 +118,93 @@ const kEventConstructors = {
return e;
},
},
ErrorEvent: { create: function (aName, aProps) {
ErrorEvent: { create (aName, aProps) {
return new ErrorEvent(aName, aProps);
},
},
FocusEvent: { create: function (aName, aProps) {
FocusEvent: { create (aName, aProps) {
return new FocusEvent(aName, aProps);
},
},
FontFaceSetLoadEvent: { create: function (aName, aProps) {
FontFaceSetLoadEvent: { create (aName, aProps) {
return new FontFaceSetLoadEvent(aName, aProps);
},
},
GamepadEvent: { create: function (aName, aProps) {
GamepadEvent: { create (aName, aProps) {
return new GamepadEvent(aName, aProps);
},
},
GamepadAxisMoveEvent: { create: function (aName, aProps) {
GamepadAxisMoveEvent: { create (aName, aProps) {
return new GamepadAxisMoveEvent(aName, aProps);
},
},
GamepadButtonEvent: { create: function (aName, aProps) {
GamepadButtonEvent: { create (aName, aProps) {
return new GamepadButtonEvent(aName, aProps);
},
},
HashChangeEvent: { create: function (aName, aProps) {
HashChangeEvent: { create (aName, aProps) {
return new HashChangeEvent(aName, aProps);
},
},
IDBVersionChangeEvent: { create: function (aName, aProps) {
IDBVersionChangeEvent: { create (aName, aProps) {
return new IDBVersionChangeEvent(aName, aProps);
},
},
ImageCaptureErrorEvent: { create: function (aName, aProps) {
ImageCaptureErrorEvent: { create (aName, aProps) {
return new ImageCaptureErrorEvent(aName, aProps);
},
},
InputEvent: { create: function (aName, aProps) {
InputEvent: { create (aName, aProps) {
return new InputEvent(aName, aProps);
},
},
KeyEvent: { create: function (aName, aProps) {
KeyEvent: { create (aName, aProps) {
return new KeyboardEvent(aName, aProps);
},
},
KeyboardEvent: { create: function (aName, aProps) {
KeyboardEvent: { create (aName, aProps) {
return new KeyboardEvent(aName, aProps);
},
},
MediaEncryptedEvent: { create: function (aName, aProps) {
MediaEncryptedEvent: { create (aName, aProps) {
return new MediaEncryptedEvent(aName, aProps);
},
},
MediaKeyMessageEvent: { create: function (aName, aProps) {
MediaKeyMessageEvent: { create (aName, aProps) {
return new MediaKeyMessageEvent(aName, {
messageType: "license-request",
message: new ArrayBuffer(0)
});
},
},
MediaQueryListEvent: { create: function (aName, aProps) {
MediaQueryListEvent: { create (aName, aProps) {
return new MediaQueryListEvent(aName, aProps);
},
},
MediaRecorderErrorEvent: { create: function (aName, aProps) {
MediaRecorderErrorEvent: { create (aName, aProps) {
aProps.error = new DOMException();
return new MediaRecorderErrorEvent(aName, aProps);
},
},
MediaStreamEvent: { create: function (aName, aProps) {
MediaStreamEvent: { create (aName, aProps) {
return new MediaStreamEvent(aName, aProps);
},
},
MediaStreamTrackEvent: {
// Difficult to test required arguments.
},
MessageEvent: { create: function (aName, aProps) {
MessageEvent: { create (aName, aProps) {
var e = new MessageEvent("messageevent", { bubbles: aProps.bubbles,
cancelable: aProps.cancelable, data: aProps.data, origin: aProps.origin,
lastEventId: aProps.lastEventId, source: aProps.source });
return e;
},
},
MouseEvent: { create: function (aName, aProps) {
MouseEvent: { create (aName, aProps) {
return new MouseEvent(aName, aProps);
},
},
MouseScrollEvent: { create: function (aName, aProps) {
MouseScrollEvent: { create (aName, aProps) {
var e = document.createEvent("mousescrollevents");
e.initMouseScrollEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.detail,
@@ -215,43 +215,43 @@ const kEventConstructors = {
return e;
},
},
MozApplicationEvent: { create: function (aName, aProps) {
MozApplicationEvent: { create (aName, aProps) {
return new MozApplicationEvent(aName, aProps);
},
},
MozClirModeEvent: { create: function (aName, aProps) {
MozClirModeEvent: { create (aName, aProps) {
return new MozClirModeEvent(aName, aProps);
},
},
MozContactChangeEvent: { create: function (aName, aProps) {
MozContactChangeEvent: { create (aName, aProps) {
return new MozContactChangeEvent(aName, aProps);
},
},
MozEmergencyCbModeEvent: { create: function (aName, aProps) {
MozEmergencyCbModeEvent: { create (aName, aProps) {
return new MozEmergencyCbModeEvent(aName, aProps);
},
},
MozMessageDeletedEvent: { create: function (aName, aProps) {
MozMessageDeletedEvent: { create (aName, aProps) {
return new MozMessageDeletedEvent(aName, aProps);
},
},
MozMmsEvent: { create: function (aName, aProps) {
MozMmsEvent: { create (aName, aProps) {
return new MozMmsEvent(aName, aProps);
},
},
MozOtaStatusEvent: { create: function (aName, aProps) {
MozOtaStatusEvent: { create (aName, aProps) {
return new MozOtaStatusEvent(aName, aProps);
},
},
MozSmsEvent: { create: function (aName, aProps) {
MozSmsEvent: { create (aName, aProps) {
return new MozSmsEvent(aName, aProps);
},
},
MozStkCommandEvent: { create: function (aName, aProps) {
MozStkCommandEvent: { create (aName, aProps) {
return new MozStkCommandEvent(aName, aProps);
},
},
MutationEvent: { create: function (aName, aProps) {
MutationEvent: { create (aName, aProps) {
var e = document.createEvent("mutationevent");
e.initMutationEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.relatedNode, aProps.prevValue, aProps.newValue,
@@ -268,32 +268,32 @@ const kEventConstructors = {
}
: null,
},
PageTransitionEvent: { create: function (aName, aProps) {
PageTransitionEvent: { create (aName, aProps) {
return new PageTransitionEvent(aName, aProps);
},
},
PointerEvent: { create: function (aName, aProps) {
PointerEvent: { create (aName, aProps) {
return new PointerEvent(aName, aProps);
},
},
PopStateEvent: { create: function (aName, aProps) {
PopStateEvent: { create (aName, aProps) {
return new PopStateEvent(aName, aProps);
},
},
PopupBlockedEvent: { create: function (aName, aProps) {
PopupBlockedEvent: { create (aName, aProps) {
return new PopupBlockedEvent(aName, aProps);
},
},
ProgressEvent: { create: function (aName, aProps) {
ProgressEvent: { create (aName, aProps) {
return new ProgressEvent(aName, aProps);
},
},
PromiseRejectionEvent: { create: function (aName, aProps) {
PromiseRejectionEvent: { create (aName, aProps) {
aProps.promise = new Promise(() => {});
return new PromiseRejectionEvent(aName, aProps);
},
},
RTCDataChannelEvent: { create: function (aName, aProps) {
RTCDataChannelEvent: { create (aName, aProps) {
let pc = new RTCPeerConnection();
aProps.channel = pc.createDataChannel("foo");
let e = new RTCDataChannelEvent(aName, aProps);
@@ -302,18 +302,18 @@ const kEventConstructors = {
return e;
},
},
RTCDTMFToneChangeEvent: { create: function (aName, aProps) {
RTCDTMFToneChangeEvent: { create (aName, aProps) {
return new RTCDTMFToneChangeEvent(aName, aProps);
},
},
RTCPeerConnectionIceEvent: { create: function (aName, aProps) {
RTCPeerConnectionIceEvent: { create (aName, aProps) {
return new RTCPeerConnectionIceEvent(aName, aProps);
},
},
RTCTrackEvent: {
// Difficult to test required arguments.
},
ScrollAreaEvent: { create: function (aName, aProps) {
ScrollAreaEvent: { create (aName, aProps) {
var e = document.createEvent("scrollareaevent");
e.initScrollAreaEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.details,
@@ -322,63 +322,63 @@ const kEventConstructors = {
return e;
},
},
SpeechRecognitionError: { create: function (aName, aProps) {
SpeechRecognitionError: { create (aName, aProps) {
return new SpeechRecognitionError(aName, aProps);
},
},
SpeechRecognitionEvent: { create: function (aName, aProps) {
SpeechRecognitionEvent: { create (aName, aProps) {
return new SpeechRecognitionEvent(aName, aProps);
},
},
SpeechSynthesisErrorEvent: { create: function (aName, aProps) {
SpeechSynthesisErrorEvent: { create (aName, aProps) {
aProps.error = "synthesis-unavailable";
aProps.utterance = new SpeechSynthesisUtterance("Hello World");
return new SpeechSynthesisErrorEvent(aName, aProps);
},
},
SpeechSynthesisEvent: { create: function (aName, aProps) {
SpeechSynthesisEvent: { create (aName, aProps) {
aProps.utterance = new SpeechSynthesisUtterance("Hello World");
return new SpeechSynthesisEvent(aName, aProps);
},
},
StorageEvent: { create: function (aName, aProps) {
StorageEvent: { create (aName, aProps) {
return new StorageEvent(aName, aProps);
},
},
StyleRuleChangeEvent: { create: function (aName, aProps) {
StyleRuleChangeEvent: { create (aName, aProps) {
return new StyleRuleChangeEvent(aName, aProps);
},
chromeOnly: true,
},
StyleSheetApplicableStateChangeEvent: { create: function (aName, aProps) {
StyleSheetApplicableStateChangeEvent: { create (aName, aProps) {
return new StyleSheetApplicableStateChangeEvent(aName, aProps);
},
chromeOnly: true,
},
StyleSheetChangeEvent: { create: function (aName, aProps) {
StyleSheetChangeEvent: { create (aName, aProps) {
return new StyleSheetChangeEvent(aName, aProps);
},
chromeOnly: true,
},
TCPSocketErrorEvent: { create: function(aName, aProps) {
TCPSocketErrorEvent: { create(aName, aProps) {
return new TCPSocketErrorEvent(aName, aProps);
},
},
TCPSocketEvent: { create: function(aName, aProps) {
TCPSocketEvent: { create(aName, aProps) {
return new TCPSocketEvent(aName, aProps);
},
},
TCPServerSocketEvent: { create: function(aName, aProps) {
TCPServerSocketEvent: { create(aName, aProps) {
return new TCPServerSocketEvent(aName, aProps);
},
},
TimeEvent: { create: function (aName, aProps) {
TimeEvent: { create (aName, aProps) {
var e = document.createEvent("timeevent");
e.initTimeEvent(aName, aProps.view, aProps.detail);
return e;
},
},
TouchEvent: { create: function (aName, aProps) {
TouchEvent: { create (aName, aProps) {
var e = document.createEvent("touchevent");
e.initTouchEvent(aName, aProps.bubbles, aProps.cancelable,
aProps.view, aProps.detail,
@@ -387,23 +387,23 @@ const kEventConstructors = {
return e;
},
},
TrackEvent: { create: function (aName, aProps) {
TrackEvent: { create (aName, aProps) {
return new TrackEvent(aName, aProps);
},
},
TransitionEvent: { create: function (aName, aProps) {
TransitionEvent: { create (aName, aProps) {
return new TransitionEvent(aName, aProps);
},
},
UIEvent: { create: function (aName, aProps) {
UIEvent: { create (aName, aProps) {
return new UIEvent(aName, aProps);
},
},
UserProximityEvent: { create: function (aName, aProps) {
UserProximityEvent: { create (aName, aProps) {
return new UserProximityEvent(aName, aProps);
},
},
USSDReceivedEvent: { create: function (aName, aProps) {
USSDReceivedEvent: { create (aName, aProps) {
return new USSDReceivedEvent(aName, aProps);
},
},
@@ -413,15 +413,15 @@ const kEventConstructors = {
// connected. When Bug 1229480 lands, this test can be
// updated to use the puppet VR device.
},
WheelEvent: { create: function (aName, aProps) {
WheelEvent: { create (aName, aProps) {
return new WheelEvent(aName, aProps);
},
},
WebGLContextEvent: { create: function (aName, aProps) {
WebGLContextEvent: { create (aName, aProps) {
return new WebGLContextEvent(aName, aProps);
},
},
SecurityPolicyViolationEvent: { create: function (aName, aProps) {
SecurityPolicyViolationEvent: { create (aName, aProps) {
return new SecurityPolicyViolationEvent(aName, aProps);
},
},

View File

@@ -42,7 +42,7 @@ function runTests()
var tests = [
{
prepare: function() {
prepare() {
scrollLeft = target.scrollLeft;
scrollTop = target.scrollTop;
},
@@ -61,14 +61,14 @@ function runTests()
lineOrPageDeltaX: 0,
lineOrPageDeltaY: 0
},
check: function() {
check() {
is(target.scrollLeft - scrollLeft, 1,
"not scrolled to right by 0.5px delta value with pending 0.5px delta");
is(target.scrollTop - scrollTop, 1,
"not scrolled to bottom by 0.5px delta value with pending 0.5px delta");
},
}, {
prepare: function() {
prepare() {
scrollLeft = target.scrollLeft;
scrollTop = target.scrollTop;
},
@@ -87,7 +87,7 @@ function runTests()
lineOrPageDeltaX: 1,
lineOrPageDeltaY: 1
},
check: function() {
check() {
is(target.scrollLeft - scrollLeft, 1,
"not scrolled to right by 0.5 line delta value with pending 0.5 line delta");
is(target.scrollTop - scrollTop, 1,

View File

@@ -130,7 +130,7 @@ function testSingleTouch(name) {
let touch1 = new testtouch({
page: {x: Math.round(bcr.left + bcr.width/2),
y: Math.round(bcr.top + bcr.height/2)},
target: target
target
});
let event = new touchEvent({
touches: [touch1],
@@ -176,7 +176,7 @@ function testSingleTouch2(name) {
identifier: 0,
page: {x: Math.round(bcr.left + bcr.width/2),
y: Math.round(bcr.top + bcr.height/2)},
target: target
target
});
let event1 = new touchEvent({
touches: [touch1],
@@ -395,7 +395,7 @@ function testPreventDefault() {
let touch1 = new testtouch({
page: {x: bcr.left + bcr.width/2,
y: bcr.top + bcr.height/2},
target: target
target
});
let event = new touchEvent({
touches: [touch1],
@@ -507,7 +507,7 @@ function testNAC() {
let touch1 = new testtouch({
page: {x: Math.round(bcr.left + bcr.width/2),
y: Math.round(bcr.top + bcr.height/2)},
target: target
target
});
let event = new touchEvent({
touches: [touch1],

View File

@@ -123,7 +123,7 @@ function testPreventDefault(name) {
let touch1 = new testtouch({
page: {x: Math.round(bcr.left + bcr.width/2),
y: Math.round(bcr.top + bcr.height/2)},
target: target
target
});
let event = new touchEvent({

View File

@@ -47,9 +47,9 @@ function createTestEventValue(name) {
return function() {
let event = new PointerEvent("pointerdown", {
bubbles: true, cancelable: true, view: window,
detail: detail, screenX: screenX, screenY: screenY, clientX: clientX, clientY: clientY,
ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey, metaKey: metaKey,
button: button, relatedTarget: null, pointerId: pointerId
detail, screenX, screenY, clientX, clientY,
ctrlKey, altKey, shiftKey, metaKey,
button, relatedTarget: null, pointerId
});

View File

@@ -73,7 +73,7 @@ function prepare(check)
var tests = [
{
check: function(event) {
check(event) {
is(event.target, container, "<input> vertical line scroll targets container");
ok(container.scrollTop > 0, "<input> vertical line scroll container.scrollTop");
is(container.scrollLeft, 0, "<input> vertical line scroll container.scrollLeft");
@@ -87,7 +87,7 @@ var tests = [
}
},
{
check: function(event) {
check(event) {
is(event.target, input, "<input> horizontal line scroll targets <input>");
is(input.scrollTop, 0, "<input> horizontal line scroll input.scrollTop");
ok(input.scrollLeft > 0, "<input> horizontal line scroll input.scrollLeft");
@@ -101,7 +101,7 @@ var tests = [
}
},
{
check: function(event) {
check(event) {
is(event.target, container, "<input> vertical page scroll targets container");
ok(container.scrollTop > 0, "<input> vertical line scroll container.scrollTop");
is(container.scrollLeft, 0, "<input> vertical line scroll container.scrollLeft");
@@ -115,7 +115,7 @@ var tests = [
}
},
{
check: function(event) {
check(event) {
is(event.target, input, "<input> horizontal page scroll targets <input>");
is(input.scrollTop, 0, "<input> horizontal page scroll input.scrollTop");
ok(input.scrollLeft > 0, "<input> horizontal page scroll input.scrollLeft");

View File

@@ -2666,7 +2666,7 @@ function* testContinuousTrustedEvents()
// Tests for accumulation delta when delta_multiplier_is customized.
{ description: "lineOrPageDelta should be recomputed by ESM (pixel) #1",
prepare: function () {
prepare () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 200],
["mousewheel.default.delta_multiplier_y", 300]]},
continueTest);
@@ -2720,7 +2720,7 @@ function* testContinuousTrustedEvents()
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor((gHorizontalLine / 4 + 1) * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.floor((gLineHeight / 8 + 1) * 3) } },
finished: function () {
finished () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 100]]},
continueTest);
@@ -2728,7 +2728,7 @@ function* testContinuousTrustedEvents()
},
{ description: "lineOrPageDelta should be recomputed by ESM (pixel, negative, shift) #1",
prepare: function () {
prepare () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.with_shift.delta_multiplier_x", 200],
["mousewheel.with_shift.delta_multiplier_y", 300]]},
continueTest);
@@ -2782,7 +2782,7 @@ function* testContinuousTrustedEvents()
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(-(gHorizontalLine / 4 + 1) * 2) },
vertical: { expected: true, preventDefault: false, detail: Math.ceil(-(gLineHeight / 8 + 1) * 3) } },
finished: function () {
finished () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.with_shift.delta_multiplier_x", 100],
["mousewheel.with_shift.delta_multiplier_y", 100]]},
continueTest);
@@ -2790,7 +2790,7 @@ function* testContinuousTrustedEvents()
},
{ description: "lineOrPageDelta should be recomputed by ESM (line) #1",
prepare: function () {
prepare () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 200],
["mousewheel.default.delta_multiplier_y", 100]]},
continueTest);
@@ -2844,7 +2844,7 @@ function* testContinuousTrustedEvents()
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gHorizontalLine * 0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
finished: function () {
finished () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 100]]},
continueTest);
@@ -2852,7 +2852,7 @@ function* testContinuousTrustedEvents()
},
{ description: "lineOrPageDelta should be recomputed by ESM (line, negative) #1",
prepare: function () {
prepare () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 200],
["mousewheel.default.delta_multiplier_y", -100]]},
continueTest);
@@ -2906,7 +2906,7 @@ function* testContinuousTrustedEvents()
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gHorizontalLine * -0.6) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gLineHeight * 0.4) } },
finished: function () {
finished () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 100]]},
continueTest);
@@ -2914,7 +2914,7 @@ function* testContinuousTrustedEvents()
},
{ description: "lineOrPageDelta should be recomputed by ESM (page) #1",
prepare: function () {
prepare () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 200]]},
continueTest);
@@ -2968,7 +2968,7 @@ function* testContinuousTrustedEvents()
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.floor(gPageWidth * 0.4) },
vertical: { expected: true, preventDefault: false, detail: Math.floor(gPageHeight * 0.8) } },
finished: function () {
finished () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 100]]},
continueTest);
@@ -2976,7 +2976,7 @@ function* testContinuousTrustedEvents()
},
{ description: "lineOrPageDelta should be recomputed by ESM (page, negative) #1",
prepare: function () {
prepare () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 200]]},
continueTest);
@@ -3030,7 +3030,7 @@ function* testContinuousTrustedEvents()
MozMousePixelScroll: {
horizontal: { expected: true, preventDefault: false, detail: Math.ceil(gPageWidth * -0.4) },
vertical: { expected: true, preventDefault: false, detail: Math.ceil(gPageHeight * -0.8) } },
finished: function () {
finished () {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 100]]},
continueTest);

View File

@@ -888,7 +888,7 @@ is(e.eventPhase, Event.NONE, "Wrong event phase");
// InputEvent
let dataTransfer = new DataTransfer();
dataTransfer.setData("text/plain", "foo");
e = new InputEvent("hello", {data: "something data", dataTransfer: dataTransfer, inputType: "invalid input type", isComposing: true});
e = new InputEvent("hello", {data: "something data", dataTransfer, inputType: "invalid input type", isComposing: true});
is(e.type, "hello", "InputEvent should set type attribute");
is(e.data, "something data", "InputEvent should have data attribute");
is(e.dataTransfer, dataTransfer, "InputEvent should have the dataTransfer");
@@ -903,7 +903,7 @@ is(e.inputType, "invalid input type", "InputEvent should have inputType attribut
is(e.isComposing, true, "InputEvent should have isComposing attribute");
dataTransfer = new DataTransfer();
e = new InputEvent("hello", {data: "", dataTransfer: dataTransfer, inputType: "insertText"});
e = new InputEvent("hello", {data: "", dataTransfer, inputType: "insertText"});
is(e.data, "", "InputEvent.data should be empty string when empty string is specified explicitly");
is(e.dataTransfer, dataTransfer, "InputEvent.dataTransfer should have the empty dataTransfer");
is(e.inputType, "insertText", "InputEvent.inputType should return valid inputType from EditorInputType enum");

View File

@@ -228,11 +228,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: gScrollable128
@@ -243,11 +243,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: gScrollable128
@@ -258,11 +258,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: gScrollable96
@@ -273,11 +273,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: gScrollable96
@@ -288,11 +288,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: gScrollable64
@@ -303,11 +303,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: gScrollable64
@@ -318,11 +318,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: gScrollable32
@@ -333,11 +333,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: gScrollable32
@@ -348,9 +348,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: gRoot
@@ -361,9 +361,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: gRoot
@@ -374,11 +374,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable128
@@ -389,11 +389,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable128
@@ -404,11 +404,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable96
@@ -419,11 +419,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable96
@@ -434,11 +434,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable64
@@ -449,11 +449,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable64
@@ -464,11 +464,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable32
@@ -479,11 +479,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable32
@@ -494,9 +494,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gRoot
@@ -507,9 +507,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gRoot
@@ -520,11 +520,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: null
@@ -535,11 +535,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: null
@@ -550,11 +550,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: null
@@ -565,11 +565,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: null
@@ -580,11 +580,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: null
@@ -595,11 +595,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: null
@@ -610,11 +610,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: null
@@ -625,11 +625,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: null
@@ -640,9 +640,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: null
@@ -653,9 +653,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: null
@@ -668,11 +668,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: gScrollable128
@@ -683,11 +683,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: gScrollable128
@@ -698,11 +698,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: gScrollable96
@@ -713,11 +713,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: gScrollable96
@@ -728,11 +728,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: gScrollable64
@@ -743,11 +743,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: gScrollable64
@@ -758,11 +758,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: gScrollable32
@@ -773,11 +773,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: gScrollable32
@@ -788,9 +788,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: gRoot
@@ -801,9 +801,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: -1.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: gRoot
@@ -814,11 +814,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable128
@@ -829,11 +829,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable128
@@ -844,11 +844,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable96
@@ -859,11 +859,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable96
@@ -874,11 +874,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable64
@@ -889,11 +889,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable64
@@ -904,11 +904,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable32
@@ -919,11 +919,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gScrollable32
@@ -934,9 +934,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gRoot
@@ -947,9 +947,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 0.0, deltaY: -1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: null, y: gRoot
@@ -960,11 +960,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: null
@@ -975,11 +975,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable128.scrollLeft = 0;
gScrollable128.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable128, y: null
@@ -990,11 +990,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: null
@@ -1005,11 +1005,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable96, y: null
@@ -1020,11 +1020,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: null
@@ -1035,11 +1035,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable64, y: null
@@ -1050,11 +1050,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: null
@@ -1065,11 +1065,11 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable32.scrollLeft = 0;
gScrollable32.scrollTop = 0;
},
cleanup: function () {
cleanup () {
},
expected: {
x: gScrollable32, y: null
@@ -1080,9 +1080,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: null
@@ -1093,9 +1093,9 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_PAGE,
deltaX: -1.0, deltaY: 0.0, lineOrPageDeltaX: -1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
},
cleanup: function () {
cleanup () {
},
expected: {
x: gRoot, y: null
@@ -1108,14 +1108,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.style.overflow = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {
@@ -1127,14 +1127,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.style.overflowX = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {
@@ -1146,14 +1146,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.style.overflowY = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {
@@ -1165,14 +1165,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.style.overflowX = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {
@@ -1184,14 +1184,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 0.0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 },
prepare: function () {
prepare () {
gScrollable64.style.overflowY = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {
@@ -1203,14 +1203,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable64.style.overflowX = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {
@@ -1222,14 +1222,14 @@ function* doTests()
event: {
deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 0.0, lineOrPageDeltaX: 1, lineOrPageDeltaY: 0 },
prepare: function () {
prepare () {
gScrollable64.style.overflowY = "hidden";
gScrollable96.scrollLeft = 0;
gScrollable96.scrollTop = 0;
gScrollable64.scrollLeft = 0;
gScrollable64.scrollTop = 0;
},
cleanup: function () {
cleanup () {
gScrollable64.style.overflow = "auto";
},
expected: {

View File

@@ -541,8 +541,8 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: true, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll,
prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
prepare (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
cleanup (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
// momentum scroll should cause scroll even if the action is history, but if the default action is none,
// shouldn't do it.
@@ -644,8 +644,8 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: true, metaKey: false, osKey: false },
expected: kNoScroll,
prepare: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
cleanup: function (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
prepare (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 0]]}, cb); },
cleanup (cb) { SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.action", 1]]}, cb); } },
// Don't scroll along axis whose overflow style is hidden.
{ description: "Scroll to only bottom by oblique pixel wheel event with overflow-x: hidden",
@@ -655,7 +655,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollDown,
prepare: function(cb) { gScrollableElement.style.overflowX = "hidden"; cb(); } },
prepare(cb) { gScrollableElement.style.overflowX = "hidden"; cb(); } },
{ description: "Scroll to only bottom by oblique line wheel event with overflow-x: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@@ -691,7 +691,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollUp,
cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
cleanup (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
@@ -699,7 +699,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollRight,
prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
prepare(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@@ -735,7 +735,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: -1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollLeft,
cleanup: function (cb) { gScrollableElement.style.overflowY = "auto"; cb(); } },
cleanup (cb) { gScrollableElement.style.overflowY = "auto"; cb(); } },
{ description: "Don't be scrolled by oblique pixel wheel event with overflow: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
@@ -743,7 +743,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 1, expectedOverflowDeltaY: 1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll,
prepare: function(cb) { gScrollableElement.style.overflow = "hidden"; cb(); } },
prepare(cb) { gScrollableElement.style.overflow = "hidden"; cb(); } },
{ description: "Don't be scrolled by oblique line wheel event with overflow: hidden",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@@ -779,7 +779,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: -1, expectedOverflowDeltaY: -1,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kNoScroll,
cleanup: function (cb) { gScrollableElement.style.overflow = "auto"; cb(); } },
cleanup (cb) { gScrollableElement.style.overflow = "auto"; cb(); } },
// Don't scroll along axis whose overflow style is hidden and overflow delta values should
// be zero if there is ancestor scrollable element.
@@ -790,7 +790,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollDown,
prepare: function(cb) {
prepare(cb) {
gScrollableElement.style.overflowX = "hidden";
gScrollableElement.style.position = "fixed";
gScrollableElement.style.top = "30px";
@@ -836,7 +836,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollUp,
cleanup: function (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
cleanup (cb) { gScrollableElement.style.overflowX = "auto"; cb(); } },
{ description: "Scroll to only right by oblique pixel wheel event with overflow-y: hidden (body is scrollable)",
event: { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
deltaX: 16.0, deltaY: 16.0, deltaZ: 0.0,
@@ -844,7 +844,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollRight,
prepare: function(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
prepare(cb) { gScrollableElement.style.overflowY = "hidden"; cb(); } },
{ description: "Scroll to only right by oblique line wheel event with overflow-y: hidden (body is scrollable)",
event: { deltaMode: WheelEvent.DOM_DELTA_LINE,
deltaX: 1.0, deltaY: 1.0, deltaZ: 0.0,
@@ -880,7 +880,7 @@ function doTestScroll(aSettings, aCallback)
expectedOverflowDeltaX: 0, expectedOverflowDeltaY: 0,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
expected: kScrollLeft,
cleanup: function (cb) {
cleanup (cb) {
gScrollableElement.style.overflowY = "auto";
gScrollableElement.style.position = "static";
gSpacerForBodyElement.style.width = "";
@@ -1414,7 +1414,7 @@ function getFirstWritingModeStyle()
return false;
}
}
return {typeIndex: typeIndex, styleIndex: 0};
return {typeIndex, styleIndex: 0};
}
function getNextWritingModeStyle(curStyle)
@@ -1423,7 +1423,7 @@ function getNextWritingModeStyle(curStyle)
let styleIndex = curStyle.styleIndex + 1;
while (typeIndex < kWritingModes.length) {
if (styleIndex < kWritingModes[typeIndex].styles.length) {
return {typeIndex: typeIndex, styleIndex: styleIndex};
return {typeIndex, styleIndex};
}
typeIndex++;
styleIndex = 0;
@@ -1520,7 +1520,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: false,
expected: kScrollDown,
prepare: function (cb) {
prepare (cb) {
// Static contents will not start from the topleft side in some
// writing modes, for ease of coding, we simply absolutely
// position the target to the topleft in every case.
@@ -1869,7 +1869,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: true,
expected: kAdjustedForDown.result,
prepare: function (cb) {
prepare (cb) {
gScrollableElement.style.overflowX = "auto";
gScrollableElement.style.overflowY = "hidden";
cb();
@@ -1957,7 +1957,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: false,
expected: kScrollDown,
prepare: function (cb) {
prepare (cb) {
gScrollableElement.style.overflowX = "hidden";
gScrollableElement.style.overflowY = "auto";
cb();
@@ -2047,7 +2047,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: true,
expected: kAdjustedForDown.result,
prepare: function (cb) {
prepare (cb) {
gScrollableElement.style.overflowX = "auto";
gScrollableElement.style.overflowY = "hidden";
cb();
@@ -2135,7 +2135,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: false,
expected: kScrollDown,
prepare: function (cb) {
prepare (cb) {
gScrollableElement.style.overflowX = "hidden";
gScrollableElement.style.overflowY = "auto";
cb();
@@ -2225,7 +2225,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: true,
expected: kAdjustedForDown.result,
prepare: function (cb) {
prepare (cb) {
gScrollableElement.style.overflowX = "auto";
gScrollableElement.style.overflowY = "hidden";
cb();
@@ -2313,7 +2313,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: false,
expected: kScrollDown,
prepare: function (cb) {
prepare (cb) {
gScrollableElement.style.overflowX = "hidden";
gScrollableElement.style.overflowY = "auto";
cb();
@@ -2385,7 +2385,7 @@ function doTestAutoDirScroll2(aSettings, aAutoDirTrait,
shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, osKey: false },
adjusted: true,
expected: kAdjustedForLeft.result,
cleanup: function (cb) {
cleanup (cb) {
gScrollableElement.style.position = "static";
gScrollableElement.style.top = "auto";
gScrollableElement.style.left = "auto";
@@ -3009,7 +3009,7 @@ function doTestWholeScroll2(aCallback)
{
const kTests = [
{ description: "try whole-scroll to top (line)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3027,7 +3027,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 1000
},
{ description: "try whole-scroll to bottom (line)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3045,7 +3045,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 1000
},
{ description: "try whole-scroll to left (line)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3063,7 +3063,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 0
},
{ description: "try whole-scroll to right (line)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3083,7 +3083,7 @@ function doTestWholeScroll2(aCallback)
{ description: "try whole-scroll to top (pixel)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3101,7 +3101,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 1000
},
{ description: "try whole-scroll to bottom (pixel)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3119,7 +3119,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 1000
},
{ description: "try whole-scroll to left (pixel)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3137,7 +3137,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 0
},
{ description: "try whole-scroll to right (pixel)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3157,7 +3157,7 @@ function doTestWholeScroll2(aCallback)
{ description: "try whole-scroll to top (page)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3175,7 +3175,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 1000
},
{ description: "try whole-scroll to bottom (page)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3193,7 +3193,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 1000
},
{ description: "try whole-scroll to left (page)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},
@@ -3211,7 +3211,7 @@ function doTestWholeScroll2(aCallback)
expectedScrollLeft: 0
},
{ description: "try whole-scroll to right (page)",
prepare: function () {
prepare () {
gScrollableElement.scrollTop = 1000;
gScrollableElement.scrollLeft = 1000;
},

View File

@@ -34,11 +34,11 @@ HTMLMenuBuilder.prototype = {
items: {},
nestedStack: [],
toJSONString: function() {
toJSONString() {
return JSON.stringify(this.root);
},
openContainer: function(aLabel) {
openContainer(aLabel) {
if (!this.currentNode) {
this.root = {
type: "menu",
@@ -57,7 +57,7 @@ HTMLMenuBuilder.prototype = {
}
},
addItemFor: function(aElement, aCanLoadIcon) {
addItemFor(aElement, aCanLoadIcon) {
// Since we no longer type check this at the IDL level, make sure we've got
// the right element type here.
if (ChromeUtils.getClassName(aElement) !== "HTMLMenuItemElement") {
@@ -96,7 +96,7 @@ HTMLMenuBuilder.prototype = {
this.items[item.id] = aElement;
},
addSeparator: function() {
addSeparator() {
if (!("children" in this.currentNode)) {
return;
}
@@ -104,7 +104,7 @@ HTMLMenuBuilder.prototype = {
this.currentNode.children.push({ type: "separator" });
},
undoAddSeparator: function() {
undoAddSeparator() {
if (!("children" in this.currentNode)) {
return;
}
@@ -115,13 +115,13 @@ HTMLMenuBuilder.prototype = {
}
},
closeContainer: function() {
closeContainer() {
this.currentNode = this.nestedStack.length
? this.nestedStack.pop()
: this.root;
},
click: function(id) {
click(id) {
let item = this.items[id];
if (item) {
item.click();

View File

@@ -107,7 +107,7 @@ function getCoords(elt)
y += elt.offsetTop;
} while ((elt = elt.offsetParent));
return { x: x, y: y };
return { x, y };
}
var elts = ["txt", "empty", "whitespace", "static", "fixed", "absolute",

View File

@@ -8,7 +8,7 @@
</head>
<script type="text/javascript">
function ok(result, desc) {
window.parent.postMessage({ok: result, desc: desc}, "*");
window.parent.postMessage({ok: result, desc}, "*");
}
function doStuff() {

View File

@@ -8,7 +8,7 @@
</head>
<script type="text/javascript">
function ok(result, desc) {
window.parent.postMessage({ok: result, desc: desc}, "*");
window.parent.postMessage({ok: result, desc}, "*");
}
function doStuff() {

View File

@@ -10,7 +10,7 @@
<script type="text/javascript">
function ok(result, desc) {
window.parent.ok_wrapper(result, desc);
window.parent.postMessage({ok: result, desc: desc}, "*");
window.parent.postMessage({ok: result, desc}, "*");
}
function doStuff() {

View File

@@ -7,7 +7,7 @@
</head>
<script type="text/javascript">
function ok(result, desc) {
window.parent.postMessage({ok: result, desc: desc}, "*");
window.parent.postMessage({ok: result, desc}, "*");
}
function doStuff() {

View File

@@ -7,7 +7,7 @@
</head>
<script type="text/javascript">
function ok(result, desc) {
window.parent.postMessage({ok: result, desc: desc}, "*");
window.parent.postMessage({ok: result, desc}, "*");
}
function doStuff() {

View File

@@ -8,7 +8,7 @@
</head>
<script type="text/javascript">
function ok(result, desc) {
window.parent.postMessage({ok: result, desc: desc}, "*");
window.parent.postMessage({ok: result, desc}, "*");
}
function doStuff() {

View File

@@ -48,7 +48,7 @@ var anyFailedDelayedTests = false;
function delayed_is(actual, expected, description)
{
var result = actual == expected;
delayedTests.push({ actual: actual, expected: expected, description: description });
delayedTests.push({ actual, expected, description });
if (!result) {
anyFailedDelayedTests = true;
}

View File

@@ -43,57 +43,57 @@ var testCases = [
// Dynamic checks: changing disable value.
{ html: "<option></option>",
modifier: function(c) { c.querySelector('option').disabled = true; },
modifier(c) { c.querySelector('option').disabled = true; },
result: { attr: "", idl: true, pseudo: true } },
{ html: "<option disabled></option>",
modifier: function(c) { c.querySelector('option').disabled = false; },
modifier(c) { c.querySelector('option').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup><option></option></otpgroup>",
modifier: function(c) { c.querySelector('optgroup').disabled = true; },
modifier(c) { c.querySelector('optgroup').disabled = true; },
result: { attr: null, idl: false, pseudo: true } },
{ html: "<optgroup><option disabled></option></optgroup>",
modifier: function(c) { c.querySelector('option').disabled = false; },
modifier(c) { c.querySelector('option').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup disabled><option disabled></option></optgroup>",
modifier: function(c) { c.querySelector('optgroup').disabled = false; },
modifier(c) { c.querySelector('optgroup').disabled = false; },
result: { attr: "", idl: true, pseudo: true } },
{ html: "<optgroup disabled><option disabled></option></optgroup>",
modifier: function(c) { c.querySelector('option').disabled = false; },
modifier(c) { c.querySelector('option').disabled = false; },
result: { attr: null, idl: false, pseudo: true } },
{ html: "<optgroup disabled><option disabled></option></optgroup>",
modifier: function(c) { c.querySelector('optgroup').disabled = c.querySelector('option').disabled = false; },
modifier(c) { c.querySelector('optgroup').disabled = c.querySelector('option').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup disabled><option></option></optgroup>",
modifier: function(c) { c.querySelector('optgroup').disabled = false; },
modifier(c) { c.querySelector('optgroup').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup><optgroup disabled><option></option></optgroup></optgroup>",
modifier: function(c) { c.querySelector('optgroup[disabled]').disabled = false; },
modifier(c) { c.querySelector('optgroup[disabled]').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup disabled><optgroup><option></option></optgroup></optgroup>",
modifier: function(c) { c.querySelector('optgroup[disabled]').disabled = false; },
modifier(c) { c.querySelector('optgroup[disabled]').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup disabled><optgroup><option disabled></option></optgroup></optgroup>",
modifier: function(c) { c.querySelector('optgroup').disabled = false; },
modifier(c) { c.querySelector('optgroup').disabled = false; },
result: { attr: "", idl: true, pseudo: true } },
{ html: "<optgroup disabled><optgroup><option disabled></option></optgroup></optgroup>",
modifier: function(c) { c.querySelector('option').disabled = false; },
modifier(c) { c.querySelector('option').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup disabled><optgroup><option disabled></option></optgroup></optgroup>",
modifier: function(c) { c.querySelector('option').disabled = c.querySelector('option').disabled = false; },
modifier(c) { c.querySelector('option').disabled = c.querySelector('option').disabled = false; },
result: { attr: null, idl: false, pseudo: false } },
// Dynamic checks: moving option element.
{ html: "<optgroup id='a'><option></option></optgroup><optgroup id='b'></optgroup>",
modifier: function(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
result: { attr: null, idl: false, pseudo: false } },
{ html: "<optgroup id='a'><option disabled></option></optgroup><optgroup id='b'></optgroup>",
modifier: function(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
result: { attr: "", idl: true, pseudo: true } },
{ html: "<optgroup id='a'><option></option></optgroup><optgroup disabled id='b'></optgroup>",
modifier: function(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
result: { attr: null, idl: false, pseudo: true } },
{ html: "<optgroup disabled id='a'><option></option></optgroup><optgroup id='b'></optgroup>",
modifier: function(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
modifier(c) { c.querySelector('#b').appendChild(c.querySelector('option')); },
result: { attr: null, idl: false, pseudo: false } },
];

View File

@@ -412,7 +412,7 @@ function checkTimeSet()
// Some NaN values (should set to empty string).
{ value: NaN, result: "" },
{ value: "foobar", result: "" },
{ value: function() {}, result: "" },
{ value() {}, result: "" },
// Inifinity (should throw).
{ value: Infinity, throw: true },
{ value: -Infinity, throw: true },

View File

@@ -29,7 +29,7 @@ function promiseWaitForEvent(
function waitForDocLoadComplete(aBrowser = gBrowser) {
return new Promise(resolve => {
let listener = {
onStateChange: function(webProgress, req, flags, status) {
onStateChange(webProgress, req, flags, status) {
let docStop =
Ci.nsIWebProgressListener.STATE_IS_NETWORK |
Ci.nsIWebProgressListener.STATE_STOP;

View File

@@ -122,7 +122,7 @@ function reflectString(aParameters) {
// ES5, verse 8.12.8.
[
{
toString: function() {
toString() {
return "foo";
},
},
@@ -130,7 +130,7 @@ function reflectString(aParameters) {
],
[
{
valueOf: function() {
valueOf() {
return "foo";
},
},
@@ -138,7 +138,7 @@ function reflectString(aParameters) {
],
[
{
valueOf: function() {
valueOf() {
return "quux";
},
toString: undefined,
@@ -147,10 +147,10 @@ function reflectString(aParameters) {
],
[
{
valueOf: function() {
valueOf() {
return "foo";
},
toString: function() {
toString() {
return "bar";
},
},
@@ -681,7 +681,7 @@ function reflectBoolean(aParameters) {
// ES5, verse 9.2.
{
value: {
toString: function() {
toString() {
return "foo";
},
},
@@ -690,7 +690,7 @@ function reflectBoolean(aParameters) {
},
{
value: {
valueOf: function() {
valueOf() {
return "foo";
},
},
@@ -699,7 +699,7 @@ function reflectBoolean(aParameters) {
},
{
value: {
valueOf: function() {
valueOf() {
return "quux";
},
toString: undefined,
@@ -709,10 +709,10 @@ function reflectBoolean(aParameters) {
},
{
value: {
valueOf: function() {
valueOf() {
return "foo";
},
toString: function() {
toString() {
return "bar";
},
},
@@ -721,7 +721,7 @@ function reflectBoolean(aParameters) {
},
{
value: {
valueOf: function() {
valueOf() {
return false;
},
},

View File

@@ -29,7 +29,7 @@ testWidth("xxx");
testWidth(null);
testWidth(undefined);
testWidth({});
testWidth({ valueOf: function() { return 10; } });
testWidth({ valueOf() { return 10; } });
function testHeight(h) {
var img = new Image(100, h);
@@ -42,7 +42,7 @@ testHeight("xxx");
testHeight(null);
testHeight(undefined);
testHeight({});
testHeight({ valueOf: function() { return 10; } });
testHeight({ valueOf() { return 10; } });
</script>
</pre>

View File

@@ -107,7 +107,7 @@ function* testGenerator() {
for (var openWinFunc of OPEN_WINDOW_FUNCS) {
for (var actionFunc of ACTION_FUNCS) {
info(`Testing ${openWinFunc.name}, ${actionFunc.name}`);
yield { openWinFunc: openWinFunc, actionFunc: actionFunc };
yield { openWinFunc, actionFunc };
}
}
}

View File

@@ -126,7 +126,7 @@ AudioStreamAnalyser.prototype = {
*
* @returns {array} A Uint8Array containing the frequency domain data.
*/
getByteFrequencyData: function() {
getByteFrequencyData() {
this.analyser.getByteFrequencyData(this.data);
return this.data;
},
@@ -135,7 +135,7 @@ AudioStreamAnalyser.prototype = {
* Append a canvas to the DOM where the frequency data are drawn.
* Useful to debug tests.
*/
enableDebugCanvas: function() {
enableDebugCanvas() {
var cvs = (this.debugCanvas = document.createElement("canvas"));
const content = document.getElementById("content");
content.insertBefore(cvs, content.children[0]);
@@ -166,7 +166,7 @@ AudioStreamAnalyser.prototype = {
* Stop drawing of and remove the debug canvas from the DOM if it was
* previously added.
*/
disableDebugCanvas: function() {
disableDebugCanvas() {
if (!this.debugCanvas || !this.debugCanvas.parentElement) {
return;
}
@@ -180,7 +180,7 @@ AudioStreamAnalyser.prototype = {
* Call this to reduce main thread processing, mostly necessary on slow
* devices.
*/
disconnect: function() {
disconnect() {
this.disableDebugCanvas();
this.sourceNodes.forEach(n => n.disconnect());
this.sourceNodes = [];
@@ -198,7 +198,7 @@ AudioStreamAnalyser.prototype = {
* @param {promise} cancel
* A promise that on resolving will reject the promise we returned.
*/
waitForAnalysisSuccess: async function(
async waitForAnalysisSuccess(
analysisFunction,
cancel = wait(60000, new Error("Audio analysis timed out"))
) {
@@ -223,7 +223,7 @@ AudioStreamAnalyser.prototype = {
* The frequency for whicht to return the bin number.
* @returns {integer} the index of the bin in the FFT array.
*/
binIndexForFrequency: function(frequency) {
binIndexForFrequency(frequency) {
return (
1 +
Math.round(
@@ -238,7 +238,7 @@ AudioStreamAnalyser.prototype = {
* @param {integer} index an index in an FFT array
* @returns {double} the frequency for this bin
*/
frequencyForBinIndex: function(index) {
frequencyForBinIndex(index) {
return ((index - 1) * this.audioContext.sampleRate) / this.analyser.fftSize;
},
};
@@ -932,7 +932,7 @@ CommandChain.prototype = {
* Start the command chain. This returns a promise that always resolves
* cleanly (this catches errors and fails the test case).
*/
execute: function() {
execute() {
return this.commands
.reduce((prev, next, i) => {
if (typeof next !== "function" || !next.name) {
@@ -959,7 +959,7 @@ CommandChain.prototype = {
/**
* Add new commands to the end of the chain
*/
append: function(commands) {
append(commands) {
this.commands = this.commands.concat(commands);
},
@@ -968,7 +968,7 @@ CommandChain.prototype = {
* @param {occurrence} Optional param specifying which occurrence to match,
* with 0 representing the first occurrence.
*/
indexOf: function(functionOrName, occurrence) {
indexOf(functionOrName, occurrence) {
occurrence = occurrence || 0;
return this.commands.findIndex(func => {
if (typeof functionOrName === "string") {
@@ -986,7 +986,7 @@ CommandChain.prototype = {
});
},
mustHaveIndexOf: function(functionOrName, occurrence) {
mustHaveIndexOf(functionOrName, occurrence) {
var index = this.indexOf(functionOrName, occurrence);
if (index == -1) {
throw new Error("Unknown test: " + functionOrName);
@@ -997,25 +997,25 @@ CommandChain.prototype = {
/**
* Inserts the new commands after the specified command.
*/
insertAfter: function(functionOrName, commands, all, occurrence) {
insertAfter(functionOrName, commands, all, occurrence) {
this._insertHelper(functionOrName, commands, 1, all, occurrence);
},
/**
* Inserts the new commands after every occurrence of the specified command
*/
insertAfterEach: function(functionOrName, commands) {
insertAfterEach(functionOrName, commands) {
this._insertHelper(functionOrName, commands, 1, true);
},
/**
* Inserts the new commands before the specified command.
*/
insertBefore: function(functionOrName, commands, all, occurrence) {
insertBefore(functionOrName, commands, all, occurrence) {
this._insertHelper(functionOrName, commands, 0, all, occurrence);
},
_insertHelper: function(functionOrName, commands, delta, all, occurrence) {
_insertHelper(functionOrName, commands, delta, all, occurrence) {
occurrence = occurrence || 0;
for (
var index = this.mustHaveIndexOf(functionOrName, occurrence);
@@ -1036,7 +1036,7 @@ CommandChain.prototype = {
/**
* Removes the specified command, returns what was removed.
*/
remove: function(functionOrName, occurrence) {
remove(functionOrName, occurrence) {
return this.commands.splice(
this.mustHaveIndexOf(functionOrName, occurrence),
1
@@ -1046,7 +1046,7 @@ CommandChain.prototype = {
/**
* Removes all commands after the specified one, returns what was removed.
*/
removeAfter: function(functionOrName, occurrence) {
removeAfter(functionOrName, occurrence) {
return this.commands.splice(
this.mustHaveIndexOf(functionOrName, occurrence) + 1
);
@@ -1055,7 +1055,7 @@ CommandChain.prototype = {
/**
* Removes all commands before the specified one, returns what was removed.
*/
removeBefore: function(functionOrName, occurrence) {
removeBefore(functionOrName, occurrence) {
return this.commands.splice(
0,
this.mustHaveIndexOf(functionOrName, occurrence)
@@ -1065,7 +1065,7 @@ CommandChain.prototype = {
/**
* Replaces a single command, returns what was removed.
*/
replace: function(functionOrName, commands) {
replace(functionOrName, commands) {
this.insertBefore(functionOrName, commands);
return this.remove(functionOrName);
},
@@ -1073,7 +1073,7 @@ CommandChain.prototype = {
/**
* Replaces all commands after the specified one, returns what was removed.
*/
replaceAfter: function(functionOrName, commands, occurrence) {
replaceAfter(functionOrName, commands, occurrence) {
var oldCommands = this.removeAfter(functionOrName, occurrence);
this.append(commands);
return oldCommands;
@@ -1082,7 +1082,7 @@ CommandChain.prototype = {
/**
* Replaces all commands before the specified one, returns what was removed.
*/
replaceBefore: function(functionOrName, commands) {
replaceBefore(functionOrName, commands) {
var oldCommands = this.removeBefore(functionOrName);
this.insertBefore(functionOrName, commands);
return oldCommands;
@@ -1091,7 +1091,7 @@ CommandChain.prototype = {
/**
* Remove all commands whose name match the specified regex.
*/
filterOut: function(id_match) {
filterOut(id_match) {
this.commands = this.commands.filter(c => !id_match.test(c.name));
},
};
@@ -1101,7 +1101,7 @@ function AudioStreamHelper() {
}
AudioStreamHelper.prototype = {
checkAudio: function(stream, analyser, fun) {
checkAudio(stream, analyser, fun) {
/*
analyser.enableDebugCanvas();
return analyser.waitForAnalysisSuccess(fun)
@@ -1110,13 +1110,13 @@ AudioStreamHelper.prototype = {
return analyser.waitForAnalysisSuccess(fun);
},
checkAudioFlowing: function(stream) {
checkAudioFlowing(stream) {
var analyser = new AudioStreamAnalyser(this._context, stream);
var freq = analyser.binIndexForFrequency(TEST_AUDIO_FREQ);
return this.checkAudio(stream, analyser, array => array[freq] > 200);
},
checkAudioNotFlowing: function(stream) {
checkAudioNotFlowing(stream) {
var analyser = new AudioStreamAnalyser(this._context, stream);
var freq = analyser.binIndexForFrequency(TEST_AUDIO_FREQ);
return this.checkAudio(stream, analyser, array => array[freq] < 50);

View File

@@ -5,7 +5,7 @@
// This is needed so that we can have a "working" IdP served
// from two different locations in the tree.
global.rtcIdentityProvider.register({
generateAssertion: function(payload, origin, usernameHint) {
generateAssertion(payload, origin, usernameHint) {
dump("idp: generateAssertion(" + payload + ")\n");
return Promise.resolve({
idp: { domain: "example.com", protocol: "idp.js" },
@@ -13,7 +13,7 @@
});
},
validateAssertion: function(assertion, origin) {
validateAssertion(assertion, origin) {
dump("idp: validateAssertion(" + assertion + ")\n");
return Promise.resolve({
identity: "user@example.com",

View File

@@ -20,12 +20,12 @@
}
IDPJS.prototype = {
getLogin: function() {
getLogin() {
return fetch(
"https://example.com/.well-known/idp-proxy/idp.sjs?" + this.id
).then(response => response.status === 200);
},
checkLogin: function(result) {
checkLogin(result) {
return this.getLogin().then(loggedIn => {
if (loggedIn) {
return result;
@@ -38,7 +38,7 @@
});
},
borkResult: function(result) {
borkResult(result) {
if (instructions.some(is("throw"))) {
throw new Error("Throwing!");
}
@@ -55,7 +55,7 @@
return Promise.resolve(result);
},
_selectUsername: function(usernameHint) {
_selectUsername(usernameHint) {
dump("_selectUsername: usernameHint(" + usernameHint + ")\n");
var username = "someone@" + this.domain;
if (usernameHint) {
@@ -69,7 +69,7 @@
return username;
},
generateAssertion: function(payload, origin, options) {
generateAssertion(payload, origin, options) {
dump(
"idp: generateAssertion(" +
payload +
@@ -95,7 +95,7 @@
});
},
validateAssertion: function(assertion, origin) {
validateAssertion(assertion, origin) {
dump("idp: validateAssertion(" + assertion + ")\n");
var assertion = JSON.parse(assertion);
if (instructions.some(is("bad-validate"))) {

View File

@@ -18,7 +18,7 @@ var dummyPayload = JSON.stringify({
function test_domain_sandbox() {
var diabolical = {
toString : function() {
toString() {
return 'example.com/path';
}
};

View File

@@ -31,7 +31,7 @@ MediaStreamPlayback.prototype = {
* @param {Boolean} isResume specifies if this media element is being resumed
* from a previous run
*/
playMedia: function(isResume) {
playMedia(isResume) {
this.startMedia(isResume);
return this.verifyPlaying()
.then(() => this.stopTracksForStreamInMediaPlayback())
@@ -45,7 +45,7 @@ MediaStreamPlayback.prototype = {
* Precondition: The media stream and element should both be actively
* being played. All the stream's tracks must be local.
*/
stopTracksForStreamInMediaPlayback: function() {
stopTracksForStreamInMediaPlayback() {
var elem = this.mediaElement;
return Promise.all([
haveEvent(
@@ -66,7 +66,7 @@ MediaStreamPlayback.prototype = {
* @param {Boolean} isResume specifies if this media element is being resumed
* from a previous run
*/
playMediaWithoutStoppingTracks: function(isResume) {
playMediaWithoutStoppingTracks(isResume) {
this.startMedia(isResume);
return this.verifyPlaying().then(() => this.detachFromMediaElement());
},
@@ -77,7 +77,7 @@ MediaStreamPlayback.prototype = {
* @param {Boolean} isResume specifies if the media element playback
* is being resumed from a previous run
*/
startMedia: function(isResume) {
startMedia(isResume) {
// If we're playing media element for the first time, check that time is zero.
if (!isResume) {
is(
@@ -100,7 +100,7 @@ MediaStreamPlayback.prototype = {
/**
* Verifies that media is playing.
*/
verifyPlaying: function() {
verifyPlaying() {
var lastElementTime = this.mediaElement.currentTime;
var mediaTimeProgressed = listenUntil(
@@ -164,7 +164,7 @@ MediaStreamPlayback.prototype = {
* Precondition: The media stream and element should both be actively
* being played.
*/
detachFromMediaElement: function() {
detachFromMediaElement() {
this.mediaElement.pause();
this.mediaElement.srcObject = null;
},

View File

@@ -4,7 +4,7 @@
function removeTrickleOption(desc) {
var sdp = desc.sdp.replace(/\r\na=ice-options:trickle\r\n/, "\r\n");
return new mozRTCSessionDescription({ type: desc.type, sdp: sdp });
return new mozRTCSessionDescription({ type: desc.type, sdp });
}
function makeOffererNonTrickle(chain) {

View File

@@ -83,7 +83,7 @@ var ParseRtpPacket = buffer => {
// | .... |
let addExtension = (id, len) =>
header.extensions.push({
id: id,
id,
data: new DataView(buffer, offset, len),
});
let extensionId = view.getUint16(offset);
@@ -127,5 +127,5 @@ var ParseRtpPacket = buffer => {
}
}
}
return { type: "rtp", header: header, payload: new DataView(buffer, offset) };
return { type: "rtp", header, payload: new DataView(buffer, offset) };
};

View File

@@ -841,7 +841,7 @@ DataChannelWrapper.prototype = {
/**
* Close the data channel
*/
close: function() {
close() {
info(this + ": Closing channel");
this._channel.close();
},
@@ -852,7 +852,7 @@ DataChannelWrapper.prototype = {
* @param {String|Object} data
* Data which has to be sent through the data channel
*/
send: function(data) {
send(data) {
info(this + ": Sending data '" + data + "'");
this._channel.send(data);
},
@@ -862,7 +862,7 @@ DataChannelWrapper.prototype = {
*
* @returns {String} The string representation
*/
toString: function() {
toString() {
return (
"DataChannelWrapper (" + this._pc.label + "_" + this._channel.label + ")"
);
@@ -974,7 +974,7 @@ PeerConnectionWrapper.prototype = {
*
* @returns {sequence<RTCRtpSender>} the senders
*/
getSenders: function() {
getSenders() {
return this._pc.getSenders();
},
@@ -983,7 +983,7 @@ PeerConnectionWrapper.prototype = {
*
* @returns {sequence<RTCRtpReceiver>} the receivers
*/
getReceivers: function() {
getReceivers() {
return this._pc.getReceivers();
},
@@ -1022,7 +1022,7 @@ PeerConnectionWrapper.prototype = {
return this._pc.iceConnectionState;
},
setIdentityProvider: function(provider, options) {
setIdentityProvider(provider, options) {
this._pc.setIdentityProvider(provider, options);
},
@@ -1030,17 +1030,17 @@ PeerConnectionWrapper.prototype = {
return [this.label, direction].join("_");
},
getMediaElementForTrack: function(track, direction) {
getMediaElementForTrack(track, direction) {
var prefix = this.elementPrefix(direction);
return getMediaElementForTrack(track, prefix);
},
createMediaElementForTrack: function(track, direction) {
createMediaElementForTrack(track, direction) {
var prefix = this.elementPrefix(direction);
return createMediaElementForTrack(track, prefix);
},
ensureMediaElement: function(track, direction) {
ensureMediaElement(track, direction) {
var prefix = this.elementPrefix(direction);
var element = this.getMediaElementForTrack(track, direction);
if (!element) {
@@ -1059,18 +1059,18 @@ PeerConnectionWrapper.prototype = {
element.play();
},
addSendStream: function(stream) {
addSendStream(stream) {
// The PeerConnection will not necessarily know about this stream
// automatically, because replaceTrack is not told about any streams the
// new track might be associated with. Only content really knows.
this._sendStreams.push(stream);
},
getStreamForSendTrack: function(track) {
getStreamForSendTrack(track) {
return this._sendStreams.find(str => str.getTrackById(track.id));
},
getStreamForRecvTrack: function(track) {
getStreamForRecvTrack(track) {
return this._pc.getRemoteStreams().find(s => !!s.getTrackById(track.id));
},
@@ -1086,7 +1086,7 @@ PeerConnectionWrapper.prototype = {
* @param {MediaStream} stream
* MediaStream to use as container for `track` on remote side
*/
attachLocalTrack: function(track, stream) {
attachLocalTrack(track, stream) {
info("Got a local " + track.kind + " track");
this.expectNegotiationNeeded();
@@ -1119,7 +1119,7 @@ PeerConnectionWrapper.prototype = {
* @param {MediaStream} stream
* Media stream to handle
*/
attachLocalStream: function(stream, useAddTransceiver) {
attachLocalStream(stream, useAddTransceiver) {
info("Got local media stream: (" + stream.id + ")");
this.expectNegotiationNeeded();
@@ -1163,7 +1163,7 @@ PeerConnectionWrapper.prototype = {
return this.observedNegotiationNeeded;
},
removeSender: function(index) {
removeSender(index) {
var sender = this._pc.getSenders()[index];
this.expectedLocalTrackInfo = this.expectedLocalTrackInfo.filter(
i => i.sender != sender
@@ -1173,7 +1173,7 @@ PeerConnectionWrapper.prototype = {
return this.observedNegotiationNeeded;
},
senderReplaceTrack: function(sender, withTrack, stream) {
senderReplaceTrack(sender, withTrack, stream) {
const info = this.expectedLocalTrackInfo.find(i => i.sender == sender);
if (!info) {
return; // replaceTrack on a null track, probably
@@ -1184,7 +1184,7 @@ PeerConnectionWrapper.prototype = {
return sender.replaceTrack(withTrack);
},
getUserMedia: async function(constraints) {
async getUserMedia(constraints) {
var stream = await getUserMedia(constraints);
if (constraints.audio) {
stream.getAudioTracks().forEach(track => {
@@ -1217,7 +1217,7 @@ PeerConnectionWrapper.prototype = {
* @param {array} constraintsList
* Array of constraints for GUM calls
*/
getAllUserMedia: function(constraintsList) {
getAllUserMedia(constraintsList) {
if (constraintsList.length === 0) {
info("Skipping GUM: no UserMedia requested");
return Promise.resolve();
@@ -1229,7 +1229,7 @@ PeerConnectionWrapper.prototype = {
);
},
getAllUserMediaAndAddStreams: async function(constraintsList) {
async getAllUserMediaAndAddStreams(constraintsList) {
var streams = await this.getAllUserMedia(constraintsList);
if (!streams) {
return;
@@ -1237,7 +1237,7 @@ PeerConnectionWrapper.prototype = {
return Promise.all(streams.map(stream => this.attachLocalStream(stream)));
},
getAllUserMediaAndAddTransceivers: async function(constraintsList) {
async getAllUserMediaAndAddTransceivers(constraintsList) {
var streams = await this.getAllUserMedia(constraintsList);
if (!streams) {
return;
@@ -1251,7 +1251,7 @@ PeerConnectionWrapper.prototype = {
* Create a new data channel instance. Also creates a promise called
* `this.nextDataChannel` that resolves when the next data channel arrives.
*/
expectDataChannel: function(message) {
expectDataChannel(message) {
this.nextDataChannel = new Promise(resolve => {
this.ondatachannel = e => {
ok(e.channel, message);
@@ -1272,7 +1272,7 @@ PeerConnectionWrapper.prototype = {
* Options which get forwarded to nsIPeerConnection.createDataChannel
* @returns {DataChannelWrapper} The created data channel
*/
createDataChannel: function(options) {
createDataChannel(options) {
var label = "channel_" + this.dataChannels.length;
info(this + ": Create data channel '" + label);
@@ -1289,7 +1289,7 @@ PeerConnectionWrapper.prototype = {
/**
* Creates an offer and automatically handles the failure case.
*/
createOffer: function() {
createOffer() {
return this._pc.createOffer(this.offerOptions).then(offer => {
info("Got offer: " + JSON.stringify(offer));
// note: this might get updated through ICE gathering
@@ -1301,7 +1301,7 @@ PeerConnectionWrapper.prototype = {
/**
* Creates an answer and automatically handles the failure case.
*/
createAnswer: function() {
createAnswer() {
return this._pc.createAnswer().then(answer => {
info(this + ": Got answer: " + JSON.stringify(answer));
this._last_answer = answer;
@@ -1315,7 +1315,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} desc
* RTCSessionDescriptionInit for the local description request
*/
setLocalDescription: function(desc) {
setLocalDescription(desc) {
this.observedNegotiationNeeded = undefined;
return this._pc.setLocalDescription(desc).then(() => {
info(this + ": Successfully set the local description");
@@ -1331,7 +1331,7 @@ PeerConnectionWrapper.prototype = {
* @returns {Promise}
* A promise that resolves to the expected error
*/
setLocalDescriptionAndFail: function(desc) {
setLocalDescriptionAndFail(desc) {
return this._pc
.setLocalDescription(desc)
.then(
@@ -1349,7 +1349,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} desc
* RTCSessionDescriptionInit for the remote description request
*/
setRemoteDescription: function(desc) {
setRemoteDescription(desc) {
this.observedNegotiationNeeded = undefined;
return this._pc.setRemoteDescription(desc).then(() => {
info(this + ": Successfully set remote description");
@@ -1372,7 +1372,7 @@ PeerConnectionWrapper.prototype = {
* @returns {Promise}
* a promise that resolve to the returned error
*/
setRemoteDescriptionAndFail: function(desc) {
setRemoteDescriptionAndFail(desc) {
return this._pc
.setRemoteDescription(desc)
.then(
@@ -1388,7 +1388,7 @@ PeerConnectionWrapper.prototype = {
* Registers a callback for the signaling state change and
* appends the new state to an array for logging it later.
*/
logSignalingState: function() {
logSignalingState() {
this.signalingStateLog = [this._pc.signalingState];
this._pc.addEventListener("signalingstatechange", e => {
var newstate = this._pc.signalingState;
@@ -1415,15 +1415,15 @@ PeerConnectionWrapper.prototype = {
});
},
isTrackOnPC: function(track) {
isTrackOnPC(track) {
return !!this.getStreamForRecvTrack(track);
},
allExpectedTracksAreObserved: function(expected, observed) {
allExpectedTracksAreObserved(expected, observed) {
return Object.keys(expected).every(trackId => observed[trackId]);
},
setupStreamEventHandlers: function(stream) {
setupStreamEventHandlers(stream) {
const myTrackIds = new Set(stream.getTracks().map(t => t.id));
stream.addEventListener("addtrack", ({ track }) => {
@@ -1472,7 +1472,7 @@ PeerConnectionWrapper.prototype = {
});
},
setupTrackEventHandler: function() {
setupTrackEventHandler() {
this._pc.addEventListener("track", ({ track, streams }) => {
info(`${this}: 'ontrack' event fired for ${track.id}`);
ok(this.isTrackOnPC(track), `Found track ${track.id}`);
@@ -1518,7 +1518,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} candidate
* The RTCIceCandidate to be added or stored
*/
storeOrAddIceCandidate: function(candidate) {
storeOrAddIceCandidate(candidate) {
this._remote_ice_candidates.push(candidate);
if (this.signalingState === "closed") {
info("Received ICE candidate for closed PeerConnection - discarding");
@@ -1544,7 +1544,7 @@ PeerConnectionWrapper.prototype = {
* Registers a callback for the ICE connection state change and
* appends the new state to an array for logging it later.
*/
logIceConnectionState: function() {
logIceConnectionState() {
this.iceConnectionLog = [this._pc.iceConnectionState];
this.ice_connection_callbacks.logIceStatus = () => {
var newstate = this._pc.iceConnectionState;
@@ -1595,7 +1595,7 @@ PeerConnectionWrapper.prototype = {
* Resets the ICE connected Promise and allows ICE connection state monitoring
* to go backwards to 'checking'.
*/
expectIceChecking: function() {
expectIceChecking() {
this.iceCheckingRestartExpected = true;
this.iceConnected = new Promise((resolve, reject) => {
this.iceConnectedResolve = resolve;
@@ -1609,7 +1609,7 @@ PeerConnectionWrapper.prototype = {
* @returns {Promise}
* resolves when connected, rejects on failure
*/
waitForIceConnected: function() {
waitForIceConnected() {
return this.iceConnected;
},
@@ -1620,7 +1620,7 @@ PeerConnectionWrapper.prototype = {
* A PeerConnectionTest object to which the ice candidates gets
* forwarded.
*/
setupIceCandidateHandler: function(test, candidateHandler) {
setupIceCandidateHandler(test, candidateHandler) {
candidateHandler = candidateHandler || test.iceCandidateHandler.bind(test);
var resolveEndOfTrickle;
@@ -1661,7 +1661,7 @@ PeerConnectionWrapper.prototype = {
};
},
checkLocalMediaTracks: function() {
checkLocalMediaTracks() {
info(
`${this}: Checking local tracks ${JSON.stringify(
this.expectedLocalTrackInfo
@@ -1687,11 +1687,11 @@ PeerConnectionWrapper.prototype = {
/**
* Checks that we are getting the media tracks we expect.
*/
checkMediaTracks: function() {
checkMediaTracks() {
this.checkLocalMediaTracks();
},
checkLocalMsids: function() {
checkLocalMsids() {
const sdp = this.localDescription.sdp;
const msections = sdputils.getMSections(sdp);
const expectedStreamIdCounts = new Map();
@@ -1753,7 +1753,7 @@ PeerConnectionWrapper.prototype = {
* @returns {Promise}
* A promise that resolves when media data is flowing.
*/
waitForMediaElementFlow: function(element) {
waitForMediaElementFlow(element) {
info("Checking data flow for element: " + element.id);
is(
element.ended,
@@ -1849,7 +1849,7 @@ PeerConnectionWrapper.prototype = {
);
},
getExpectedActiveReceiveTracks: function() {
getExpectedActiveReceiveTracks() {
return this._pc
.getTransceivers()
.filter(t => {
@@ -1876,7 +1876,7 @@ PeerConnectionWrapper.prototype = {
.filter(t => t);
},
getExpectedSendTracks: function() {
getExpectedSendTracks() {
return this._pc
.getSenders()
.map(s => s.track)
@@ -1890,7 +1890,7 @@ PeerConnectionWrapper.prototype = {
* @returns {Promise}
* A promise that resolves when media flows for all elements and tracks
*/
waitForMediaFlow: function() {
waitForMediaFlow() {
return Promise.all(
[].concat(
this.localMediaElements.map(element =>
@@ -1963,7 +1963,7 @@ PeerConnectionWrapper.prototype = {
* @returns {Promise}
* A promise that resolves when we're receiving the tone/s from |from|.
*/
checkReceivingToneFrom: async function(
async checkReceivingToneFrom(
audiocontext,
from,
cancel = wait(60000, new Error("Tone not detected"))
@@ -2067,7 +2067,7 @@ PeerConnectionWrapper.prototype = {
/**
* Check that stats are present by checking for known stats.
*/
getStats: function(selector) {
getStats(selector) {
return this._pc.getStats(selector).then(stats => {
info(this + ": Got stats: " + JSON.stringify(stats));
this._last_stats = stats;
@@ -2081,7 +2081,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} stats
* The stats to check from this PeerConnectionWrapper
*/
checkStats: function(stats, twoMachines) {
checkStats(stats, twoMachines) {
// Allow for clock drift observed on Windows 7. (Bug 979649)
const isWin7 = navigator.userAgent.includes("Windows NT 6.1");
const clockDriftAllowanceMs = isWin7 ? 1000 : 250;
@@ -2231,7 +2231,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} stats
* The stats to be verified for relayed vs. direct connection.
*/
checkStatsIceConnectionType: function(stats, expectedLocalCandidateType) {
checkStatsIceConnectionType(stats, expectedLocalCandidateType) {
let lId;
let rId;
for (let stat of stats.values()) {
@@ -2299,7 +2299,7 @@ PeerConnectionWrapper.prototype = {
* @param {object} testOptions
* The test options object from the PeerConnectionTest
*/
checkStatsIceConnections: function(stats, testOptions) {
checkStatsIceConnections(stats, testOptions) {
var numIceConnections = 0;
stats.forEach(stat => {
if (stat.type === "candidate-pair" && stat.selected) {
@@ -2359,7 +2359,7 @@ PeerConnectionWrapper.prototype = {
}
},
expectNegotiationNeeded: function() {
expectNegotiationNeeded() {
if (!this.observedNegotiationNeeded) {
this.observedNegotiationNeeded = new Promise(resolve => {
this.onnegotiationneeded = resolve;
@@ -2376,7 +2376,7 @@ PeerConnectionWrapper.prototype = {
* The properties to look for
* @returns {boolean} Whether an entry containing all match-props was found.
*/
hasStat: function(stats, props) {
hasStat(stats, props) {
for (let res of stats.values()) {
var match = true;
for (let prop in props) {
@@ -2395,7 +2395,7 @@ PeerConnectionWrapper.prototype = {
/**
* Closes the connection
*/
close: function() {
close() {
this._pc.close();
this.localMediaElements.forEach(e => e.pause());
info(this + ": Closed connection.");
@@ -2406,7 +2406,7 @@ PeerConnectionWrapper.prototype = {
*
* @returns {String} The string representation
*/
toString: function() {
toString() {
return "PeerConnectionWrapper (" + this.label + ")";
},
};

View File

@@ -6,7 +6,7 @@ var sdputils = {
// Finds the codec id / payload type given a codec format
// (e.g., "VP8", "VP9/90000"). `offset` tells us which one to use in case of
// multiple matches.
findCodecId: function(sdp, format, offset = 0) {
findCodecId(sdp, format, offset = 0) {
let regex = new RegExp("rtpmap:([0-9]+) " + format, "gi");
let match;
for (let i = 0; i <= offset; ++i) {
@@ -32,7 +32,7 @@ var sdputils = {
// Finds all the extmap ids in the given sdp. Note that this does NOT
// consider m-sections, so a more generic version would need to
// look at each m-section separately.
findExtmapIds: function(sdp) {
findExtmapIds(sdp) {
var sdpExtmapIds = [];
extmapRegEx = /^a=extmap:([0-9+])/gm;
// must call exec on the regex to get each match in the string
@@ -45,7 +45,7 @@ var sdputils = {
return sdpExtmapIds;
},
findExtmapIdsUrnsDirections: function(sdp) {
findExtmapIdsUrnsDirections(sdp) {
var sdpExtmap = [];
extmapRegEx = /^a=extmap:([0-9+])([A-Za-z/]*) ([A-Za-z0-9_:\-\/\.]+)/gm;
// must call exec on the regex to get each match in the string
@@ -62,7 +62,7 @@ var sdputils = {
return sdpExtmap;
},
verify_unique_extmap_ids: function(sdp) {
verify_unique_extmap_ids(sdp) {
const sdpExtmapIds = sdputils.findExtmapIdsUrnsDirections(sdp);
return sdpExtmapIds.reduce(function(result, item, index) {
@@ -76,26 +76,26 @@ var sdputils = {
}, {});
},
getMSections: function(sdp) {
getMSections(sdp) {
return sdp
.split(new RegExp("^m=", "gm"))
.slice(1)
.map(s => "m=" + s);
},
getAudioMSections: function(sdp) {
getAudioMSections(sdp) {
return this.getMSections(sdp).filter(section =>
section.startsWith("m=audio")
);
},
getVideoMSections: function(sdp) {
getVideoMSections(sdp) {
return this.getMSections(sdp).filter(section =>
section.startsWith("m=video")
);
},
checkSdpAfterEndOfTrickle: function(description, testOptions, label) {
checkSdpAfterEndOfTrickle(description, testOptions, label) {
info("EOC-SDP: " + JSON.stringify(description));
const checkForTransportAttributes = msection => {
@@ -155,7 +155,7 @@ var sdputils = {
// Note, we don't bother removing the fmtp lines, which makes a good test
// for some SDP parsing issues.
removeCodec: function(sdp, codec) {
removeCodec(sdp, codec) {
var updated_sdp = sdp.replace(
new RegExp("a=rtpmap:" + codec + ".*\\/90000\\r\\n", ""),
""
@@ -179,59 +179,59 @@ var sdputils = {
return updated_sdp;
},
removeAllButPayloadType: function(sdp, pt) {
removeAllButPayloadType(sdp, pt) {
return sdp.replace(
new RegExp("m=(\\w+ \\w+) UDP/TLS/RTP/SAVPF .*" + pt + ".*\\r\\n", "gi"),
"m=$1 UDP/TLS/RTP/SAVPF " + pt + "\r\n"
);
},
removeRtpMapForPayloadType: function(sdp, pt) {
removeRtpMapForPayloadType(sdp, pt) {
return sdp.replace(new RegExp("a=rtpmap:" + pt + ".*\\r\\n", "gi"), "");
},
removeRtcpMux: function(sdp) {
removeRtcpMux(sdp) {
return sdp.replace(/a=rtcp-mux\r\n/g, "");
},
removeSSRCs: function(sdp) {
removeSSRCs(sdp) {
return sdp.replace(/a=ssrc.*\r\n/g, "");
},
removeBundle: function(sdp) {
removeBundle(sdp) {
return sdp.replace(/a=group:BUNDLE .*\r\n/g, "");
},
reduceAudioMLineToPcmuPcma: function(sdp) {
reduceAudioMLineToPcmuPcma(sdp) {
return sdp.replace(
/m=audio .*\r\n/g,
"m=audio 9 UDP/TLS/RTP/SAVPF 0 8\r\n"
);
},
setAllMsectionsInactive: function(sdp) {
setAllMsectionsInactive(sdp) {
return sdp
.replace(/\r\na=sendrecv/g, "\r\na=inactive")
.replace(/\r\na=sendonly/g, "\r\na=inactive")
.replace(/\r\na=recvonly/g, "\r\na=inactive");
},
removeAllRtpMaps: function(sdp) {
removeAllRtpMaps(sdp) {
return sdp.replace(/a=rtpmap:.*\r\n/g, "");
},
reduceAudioMLineToDynamicPtAndOpus: function(sdp) {
reduceAudioMLineToDynamicPtAndOpus(sdp) {
return sdp.replace(
/m=audio .*\r\n/g,
"m=audio 9 UDP/TLS/RTP/SAVPF 101 109\r\n"
);
},
addTiasBps: function(sdp, bps) {
addTiasBps(sdp, bps) {
return sdp.replace(/c=IN (.*)\r\n/g, "c=IN $1\r\nb=TIAS:" + bps + "\r\n");
},
removeSimulcastProperties: function(sdp) {
removeSimulcastProperties(sdp) {
return sdp
.replace(/a=simulcast:.*\r\n/g, "")
.replace(/a=rid:.*\r\n/g, "")
@@ -241,7 +241,7 @@ var sdputils = {
);
},
transferSimulcastProperties: function(offer_sdp, answer_sdp) {
transferSimulcastProperties(offer_sdp, answer_sdp) {
if (!offer_sdp.includes("a=simulcast:")) {
return answer_sdp;
}
@@ -269,7 +269,7 @@ var sdputils = {
return new_answer_sdp;
},
verifySdp: function(
verifySdp(
desc,
expectedType,
offerConstraintsList,
@@ -365,7 +365,7 @@ var sdputils = {
* @param constraints
* The contraint to be examined.
*/
countTracksInConstraint: function(type, constraints) {
countTracksInConstraint(type, constraints) {
if (!Array.isArray(constraints)) {
return 0;
}

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var source = context.createBufferSource();
var analyser = context.createAnalyser();
@@ -25,7 +25,7 @@ var gTest = {
source.start(0);
return analyser;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var source = context.createBufferSource();
var analyser = context.createAnalyser();
@@ -29,7 +29,7 @@ var gTest = {
source.start(0);
return analyser;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
this.buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
this.buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);

View File

@@ -12,7 +12,7 @@
var gTest = {
length: 4096,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
@@ -23,7 +23,7 @@ var gTest = {
source.buffer = buffer;
return source;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var buffers = [];
var buffer = context.createBuffer(2, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {

View File

@@ -27,7 +27,7 @@ var worker = new Worker("audioBufferSourceNodeDetached_worker.js");
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 10000000, context.sampleRate);
var data = buffer.getChannelData(0);
for (var i = 0; i < data.length; ++i) {

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 4096,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
// silence for half of the buffer, ones after that.
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 1024; i < 2048; i++) {
@@ -30,7 +30,7 @@ var gTest = {
source.start(0, 1024 / context.sampleRate, 1024 / context.sampleRate);
return source;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var expectedBuffer = context.createBuffer(1, 4096, context.sampleRate);
for (var i = 0; i < 4096; i++) {
expectedBuffer.getChannelData(0)[i] = 1;

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048 * 4,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
@@ -26,7 +26,7 @@ var gTest = {
source.loop = true;
return source;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var expectedBuffer = context.createBuffer(1, 2048 * 4, context.sampleRate);
for (var i = 0; i < 4; ++i) {
for (var j = 0; j < 2048; ++j) {

View File

@@ -13,17 +13,17 @@
var gTest = {
length: 2048 * 4,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
}
var source = new AudioBufferSourceNode(context, {buffer: buffer, loop: true, loopStart: buffer.duration * 0.25, loopEnd: buffer.duration * 0.75 });
var source = new AudioBufferSourceNode(context, {buffer, loop: true, loopStart: buffer.duration * 0.25, loopEnd: buffer.duration * 0.75 });
source.start(0);
return source;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var expectedBuffer = context.createBuffer(1, 2048 * 4, context.sampleRate);
for (var i = 0; i < 1536; ++i) {
expectedBuffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
@@ -27,7 +27,7 @@ var gTest = {
source.start(0);
return source;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
var data = buffer.getChannelData(0);
for (var i = 0; i < data.length; ++i) {

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var source = context.createBufferSource();
source.start(0);

View File

@@ -13,7 +13,7 @@
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var buffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
buffer.getChannelData(0)[i] = Math.sin(440 * 2 * Math.PI * i / context.sampleRate);
@@ -30,7 +30,7 @@ var gTest = {
source.start(0);
return source;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
return [expectedBuffer];

View File

@@ -17,7 +17,7 @@ var T0 = 0;
var gTest = {
length: 2048,
numberOfChannels: 1,
createGraph: function(context) {
createGraph(context) {
var sourceBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {
sourceBuffer.getChannelData(0)[i] = 1;
@@ -35,7 +35,7 @@ var gTest = {
source.start(0);
return gain;
},
createExpectedBuffers: function(context) {
createExpectedBuffers(context) {
var T1 = 2048 / context.sampleRate;
var expectedBuffer = context.createBuffer(1, 2048, context.sampleRate);
for (var i = 0; i < 2048; ++i) {

Some files were not shown because too many files have changed in this diff Show More