Merge m-c to autoland, a=merge

This commit is contained in:
Wes Kocher 2016-12-01 15:46:49 -08:00
commit b5de71ec44
472 changed files with 16035 additions and 15926 deletions

View File

@ -52,7 +52,7 @@ const ChildPageMod = Class({
// like `onMessage`, as it'll get piped.
setListeners(this, model);
function deserializeRules(rules) {
function* deserializeRules(rules) {
for (let rule of rules) {
yield rule.type == "string" ? rule.value
: new RegExp(rule.pattern, rule.flags);

View File

@ -118,7 +118,7 @@ const PageMod = Class({
pagemods.set(model.id, this);
workers.set(this, []);
function serializeRules(rules) {
function* serializeRules(rules) {
for (let rule of rules) {
yield isRegExp(rule) ? { type: "regexp", pattern: rule.source, flags: rule.flags }
: { type: "string", value: rule };

View File

@ -21,7 +21,7 @@ const BOOTSTRAP_REASONS = {
ADDON_DOWNGRADE : 8
};
exports["test install/startup/shutdown/uninstall all return a promise"] = function(assert) {
exports["test install/startup/shutdown/uninstall all return a promise"] = function*(assert) {
let uri = require.resolve("./fixtures/addon/bootstrap.js");
let id = "test-min-boot@jetpack";
let bootstrapScope = create({

View File

@ -416,7 +416,7 @@ exports["test iframe context"] = withTab(function*(assert) {
label: "element",
context: [new Contexts.Selector("*")]
})
}, function(_) {
}, function*(_) {
assert.deepEqual((yield captureContextMenu("iframe")),
menugroup(menuseparator(),
menuitem({label: "page"}),

View File

@ -263,7 +263,7 @@ exports['test listen to all events'] = function(assert) {
'wildcard listener called for unbound event name');
};
exports['test once'] = function(assert, done) {
exports['test once'] = function*(assert, done) {
let target = {};
let called = false;
let { resolve, promise } = defer();

View File

@ -15,7 +15,7 @@ function countListeners(target, type) {
return listeners.filter(listener => listener.type == type).length;
}
exports['test window close clears listeners'] = function(assert) {
exports['test window close clears listeners'] = function*(assert) {
let window = yield openWindow();
let loader = Loader(module);

View File

@ -150,6 +150,7 @@
@RESPATH@/components/dom_activities.xpt
@RESPATH@/components/dom_audiochannel.xpt
@RESPATH@/components/dom_base.xpt
@RESPATH@/components/dom_file.xpt
@RESPATH@/components/dom_system.xpt
@RESPATH@/components/dom_workers.xpt
#ifdef MOZ_WIDGET_GONK

View File

@ -155,6 +155,13 @@ this.DownloadsViewUI.DownloadElementShell.prototype = {
this.element.setAttribute("progressmode", "undetermined");
}
if (this.download.stopped && this.download.canceled &&
this.download.hasPartialData) {
this.element.setAttribute("progresspaused", "true");
} else {
this.element.removeAttribute("progresspaused");
}
// Dispatch the ValueChange event for accessibility, if possible.
if (this._progressElement) {
let event = this.element.ownerDocument.createEvent("Events");

View File

@ -45,7 +45,7 @@
class="downloadProgress"
min="0"
max="100"
xbl:inherits="mode=progressmode,value=progress"/>
xbl:inherits="mode=progressmode,value=progress,paused=progresspaused"/>
<xul:description class="downloadDetails"
crop="end"
xbl:inherits="value=status,tooltiptext=statusTip"/>

View File

@ -44,9 +44,15 @@ support-files =
test_firstParty_html_redirect.html
test_firstParty_http_redirect.html
test_firstParty_http_redirect.html^headers^
test_firstParty_http_redirect_to_same_domain.html
test_firstParty_http_redirect_to_same_domain.html^headers^
test_firstParty_iframe_http_redirect.html
test_firstParty_postMessage.html
test_form.html
window.html
window2.html
window3.html
window_redirect.html
worker_blobify.js
worker_deblobify.js

View File

@ -172,3 +172,108 @@ add_task(function* openWindow_test() {
yield BrowserTestUtils.closeWindow(win);
});
/**
* When the web page calls window.open, the top-level docshell in the new
* created window will have firstPartyDomain set.
*/
add_task(function* window_open_redirect_test() {
Services.prefs.setIntPref("browser.link.open_newwindow", 2);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.link.open_newwindow");
});
let tab = gBrowser.addTab(BASE_URL + "window_redirect.html");
let win = yield BrowserTestUtils.waitForNewWindow();
yield BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
yield ContentTask.spawn(win.gBrowser.selectedBrowser, { firstPartyDomain: "mochi.test" }, function* (attrs) {
Assert.equal(docShell.getOriginAttributes().firstPartyDomain, attrs.firstPartyDomain,
"window.open() should have firstPartyDomain attribute");
Assert.equal(content.document.nodePrincipal.originAttributes.firstPartyDomain,
attrs.firstPartyDomain, "The document should have firstPartyDomain");
});
gBrowser.removeTab(tab);
yield BrowserTestUtils.closeWindow(win);
});
/**
* When the web page calls window.open, the top-level docshell in the new
* created window will inherit the firstPartyDomain attribute.
* However the top-level document will override the firstPartyDomain if the
* document is from another domain.
*/
add_task(function* window_open_iframe_test() {
Services.prefs.setIntPref("browser.link.open_newwindow", 2);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.link.open_newwindow");
});
let tab = gBrowser.addTab(BASE_URL + "window2.html");
let win = yield BrowserTestUtils.waitForNewWindow();
yield BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser, true);
yield ContentTask.spawn(win.gBrowser.selectedBrowser, { firstPartyDomain: "mochi.test" }, function* (attrs) {
Assert.equal(docShell.getOriginAttributes().firstPartyDomain, attrs.firstPartyDomain,
"window.open() should have firstPartyDomain attribute");
// The document is http://example.com/browser/browser/components/originattributes/test/browser/test_firstParty.html
// so the firstPartyDomain will be overriden to 'example.com'.
Assert.equal(content.document.nodePrincipal.originAttributes.firstPartyDomain,
"example.com", "The document should have firstPartyDomain");
let iframe = content.document.getElementById("iframe1");
Assert.equal(iframe.frameLoader.docShell.getOriginAttributes().firstPartyDomain,
"example.com", "iframe's docshell should have firstPartyDomain");
Assert.equal(iframe.contentDocument.nodePrincipal.originAttributes.firstPartyDomain,
"example.com", "iframe should have firstPartyDomain");
});
gBrowser.removeTab(tab);
yield BrowserTestUtils.closeWindow(win);
});
/**
* Test for the loadInfo->TriggeringPrincipal is the document itself.
*/
add_task(function* form_test() {
let tab = gBrowser.addTab(BASE_URL + "test_form.html");
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
yield ContentTask.spawn(tab.linkedBrowser, { firstPartyDomain: "mochi.test" }, function* (attrs) {
Assert.equal(content.document.nodePrincipal.originAttributes.firstPartyDomain,
attrs.firstPartyDomain, "The document should have firstPartyDomain");
let submit = content.document.getElementById("submit");
submit.click();
});
gBrowser.removeTab(tab);
});
/**
* Another test for loadInfo->TriggeringPrincipal in the window.open case.
*/
add_task(function* window_open_form_test() {
Services.prefs.setIntPref("browser.link.open_newwindow", 2);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.link.open_newwindow");
});
let tab = gBrowser.addTab(BASE_URL + "window3.html");
let win = yield BrowserTestUtils.waitForNewWindow();
yield BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser, true);
yield ContentTask.spawn(win.gBrowser.selectedBrowser, { firstPartyDomain: "mochi.test" }, function* (attrs) {
Assert.equal(docShell.getOriginAttributes().firstPartyDomain, attrs.firstPartyDomain,
"window.open() should have firstPartyDomain attribute");
Assert.equal(content.document.nodePrincipal.originAttributes.firstPartyDomain,
"example.com", "The document should have firstPartyDomain");
let submit = content.document.getElementById("submit");
submit.click();
});
gBrowser.removeTab(tab);
yield BrowserTestUtils.closeWindow(win);
});

View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<title>Test for Bug 1260931</title>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,2 @@
HTTP 302 Found
Location: http://mochi.test:8888/browser/browser/components/originattributes/test/browser/dummy.html

View File

@ -0,0 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for Bug 1260931</title>
</head>
<body>
<form action="test_firstParty_http_redirect_to_same_domain.html" method="POST">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" id="submit" value="Submit">
</form>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<meta charset="utf8">
<title>Page creating a popup</title>
</head>
<body>
<script type="text/javascript">
var w = window.open("http://example.com/browser/browser/components/originattributes/test/browser/test_firstParty.html", "test");
</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<meta charset="utf8">
<title>Page creating a popup</title>
</head>
<body>
<script type="text/javascript">
var w = window.open("http://example.com/browser/browser/components/originattributes/test/browser/test_form.html", "test");
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta charset="utf8">
<title>Page creating a popup</title>
</head>
<body>
<script type="text/javascript">
var w = window.open('test_firstParty_http_redirect_to_same_domain.html', "test");
</script>
</body>
</html>

View File

@ -190,6 +190,7 @@
@RESPATH@/components/docshell.xpt
@RESPATH@/components/dom.xpt
@RESPATH@/components/dom_base.xpt
@RESPATH@/components/dom_file.xpt
@RESPATH@/components/dom_system.xpt
@RESPATH@/components/dom_canvas.xpt
@RESPATH@/components/dom_core.xpt

View File

@ -9,3 +9,11 @@
:root {
--downloads-item-height: 6em;
}
.downloadProgress > .progress-bar {
background-color: #3c9af8;
}
.downloadProgress[paused="true"] > .progress-bar {
background-color: #a6a6a6;
}

View File

@ -35,6 +35,14 @@
color: #aa1b08;
}
.downloadProgress > .progress-bar {
background-color: #3c9af8;
}
.downloadProgress[paused="true"] > .progress-bar {
background-color: #a6a6a6;
}
/*** Highlighted list items ***/
@keyfocus@ @itemFocused@ {

View File

@ -71,13 +71,11 @@
.downloadTarget {
margin-bottom: 3px;
cursor: inherit;
}
.downloadDetails {
opacity: 0.7;
font-size: 95%;
cursor: inherit;
}
.downloadButton {
@ -146,3 +144,6 @@
.downloadIconRetry > .button-box > .button-icon {
list-style-image: url("chrome://browser/skin/panel-icons.svg#retry");
}
/*** Progressmeter ***/
%include progressmeter.inc.css

View File

@ -151,7 +151,6 @@ toolbarseparator.downloadsDropmarkerSplitter {
#downloadsSummary {
padding: 0 12px;
cursor: pointer;
-moz-user-focus: normal;
}
@ -235,7 +234,6 @@ richlistitem[type="download"] > .downloadMainArea {
#downloadsSummaryDescription,
.downloadTarget {
margin-bottom: var(--downloads-item-target-margin-bottom);
cursor: inherit;
}
.downloadTarget {
@ -246,7 +244,6 @@ richlistitem[type="download"] > .downloadMainArea {
.downloadDetails {
margin-top: var(--downloads-item-details-margin-top);
opacity: var(--downloads-item-details-opacity);
cursor: inherit;
}
@item@[verdict] > toolbarseparator {
@ -389,3 +386,6 @@ richlistitem[type="download"] > .downloadMainArea {
-moz-margin-start: 64px;
-moz-margin-end: 16px;
}
/*** Progressmeter ***/
%include progressmeter.inc.css

View File

@ -0,0 +1,72 @@
/*** Common-styled progressmeter ***/
.downloadProgress {
height: 8px;
border-radius: 1px;
margin-top: 2px;
margin-bottom: 2px;
margin-inline-start: 6px;
margin-inline-end: 12px;
/* for overriding rules in progressmeter.css */
-moz-appearance: none;
border-style: none;
background-color: transparent;
min-width: initial;
min-height: initial;
}
.downloadProgress[mode="undetermined"] {
/* for overriding rules on global.css in Linux. */
-moz-binding: url("chrome://global/content/bindings/progressmeter.xml#progressmeter");
}
.downloadProgress > .progress-bar {
background-color: Highlight;
/* for overriding rules in progressmeter.css */
-moz-appearance: none;
}
.downloadProgress[paused="true"] > .progress-bar {
background-color: GrayText;
}
.downloadProgress[mode="undetermined"] > .progress-bar {
/* Make a white reflecting animation.
Create a gradient with 2 identical pattern, and enlarge the size to 200%.
This allows us to animate background-position with percentage. */
background-image: linear-gradient(90deg, transparent 0%,
rgba(255,255,255,0.5) 25%,
transparent 50%,
rgba(255,255,255,0.5) 75%,
transparent 100%);
background-blend-mode: lighten;
background-size: 200% 100%;
animation: downloadProgressSlideX 1.5s linear infinite;
}
.downloadProgress > .progress-remainder {
border: solid ButtonShadow;
border-block-start-width: 1px;
border-block-end-width: 1px;
border-inline-start-width: 0;
border-inline-end-width: 1px;
background-color: ButtonFace;
}
.downloadProgress[value="0"] > .progress-remainder {
border-width: 1px;
}
.downloadProgress > .progress-remainder[mode="undetermined"] {
border: none;
}
@keyframes downloadProgressSlideX {
0% {
background-position: 0 0;
}
100% {
background-position: -100% 0;
}
}

View File

@ -10,6 +10,12 @@
--downloads-item-height: 6em;
}
@media (-moz-windows-default-theme) {
.downloadProgress > .progress-bar {
background-color: #3c9af8;
}
}
/*** Highlighted list items ***/
@media not all and (-moz-os-version: windows-xp) {

View File

@ -6,45 +6,6 @@
/*** Panel and outer controls ***/
#downloadsSummary {
background-color: hsla(210,4%,10%,.04);
box-shadow: 0 1px 0 hsla(210,4%,10%,.08) inset;
transition-duration: 150ms;
transition-property: background-color;
}
#downloadsSummary:hover {
background-color: hsla(210,4%,10%,.05);
}
#downloadsSummary:hover:active {
background-color: hsla(210,4%,10%,.1);
box-shadow: 0 2px 0 0 hsla(210,4%,10%,.1) inset;
}
@media (-moz-os-version: windows-xp),
(-moz-os-version: windows-vista),
(-moz-os-version: windows-win7) {
@media (-moz-windows-default-theme) {
#downloadsSummary,
#downloadsSummary:hover,
#downloadsSummary:hover:active {
background-color: #f1f5fb;
box-shadow: 0px 1px 2px rgb(204,214,234) inset;
transition-duration: 0s;
cursor: pointer;
}
@media (-moz-os-version: windows-xp) {
#downloadsSummary,
#downloadsSummary:hover,
#downloadsSummary:hover:active {
background-color: hsla(216,45%,88%,.98);
}
}
}
}
@keyfocus@ #downloadsSummary:focus,
@keyfocus@ .downloadsPanelFooterButton:focus {
outline: 1px -moz-dialogtext dotted;
@ -77,6 +38,16 @@
@item@[verdict="Malware"] {
color: #aa1b08;
}
/* Use unified color for the progressbar on default theme */
.downloadProgress > .progress-bar {
background-color: #3c9af8;
}
.downloadProgress[paused="true"] > .progress-bar {
background-color: #a6a6a6;
}
}
/*** Highlighted list items ***/

View File

@ -753,16 +753,27 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
currentURI->GetScheme(scheme);
currentOtherURI->GetScheme(otherScheme);
bool schemesMatch = scheme.Equals(otherScheme, stringComparator);
bool isSamePage;
// about: URIs are special snowflakes.
if (scheme.EqualsLiteral("about")) {
nsAutoCString module, otherModule;
isSamePage = schemesMatch &&
NS_SUCCEEDED(NS_GetAboutModuleName(currentURI, module)) &&
NS_SUCCEEDED(NS_GetAboutModuleName(currentOtherURI, otherModule)) &&
module.Equals(otherModule);
} else {
bool equalExceptRef = false;
rv = currentURI->EqualsExceptRef(currentOtherURI, &equalExceptRef);
isSamePage = NS_SUCCEEDED(rv) && equalExceptRef;
}
// If schemes are not equal, or they're equal but the target URI
// is different from the source URI and doesn't always allow linking
// from the same scheme, check if the URI flags of the current target
// URI allow the current source URI to link to it.
// The policy is specified by the protocol flags on both URIs.
bool equalExceptRef = false;
if (!scheme.Equals(otherScheme, stringComparator) ||
(denySameSchemeLinks &&
(!NS_SUCCEEDED(currentURI->EqualsExceptRef(currentOtherURI, &equalExceptRef)) ||
!equalExceptRef))) {
if (!schemesMatch || (denySameSchemeLinks && !isSamePage)) {
return CheckLoadURIFlags(currentURI, currentOtherURI,
sourceBaseURI, targetBaseURI, aFlags);
}

View File

@ -52,6 +52,18 @@ const URLs = new Map([
["view-source:data:text/html,Hi", true, false, true],
["javascript:alert('hi')", true, false, true],
]],
["about:foo", [
["about:foo?", true, true, true],
["about:foo?bar", true, true, true],
["about:foo#", true, true, true],
["about:foo#bar", true, true, true],
["about:foo?#", true, true, true],
["about:foo?bar#baz", true, true, true],
["about:bar", false, false, true],
["about:bar?foo#baz", false, false, true],
["about:bar?foo", false, false, true],
["http://www.example.com/", true, true, true],
]],
]);
function testURL(source, target, canLoad, canLoadWithoutInherit, canCreate, flags) {

View File

@ -77,7 +77,6 @@ function* ifTestingSupported() {
}
function testFunctionCallTimestamp(functionCalls, currentTime) {
info("Check the timestamps of function calls");
for ( let i = 0; i < functionCalls.length-1; i += 2 ) {
@ -85,7 +84,4 @@ function testFunctionCallTimestamp(functionCalls, currentTime) {
ok( functionCalls[i].timestamp < currentTime, "The timestamp has been minus the frame start time." );
ok( functionCalls[i+1].timestamp > functionCalls[i].timestamp, "The timestamp of the called function is correct." );
}
yield removeTab(target.tab);
finish();
}

View File

@ -73,20 +73,20 @@ function test() {
return deferred.promise;
}
Task.spawn(function(){
(async function(){
let onCaretUpdated = waitForCaretAndScopes(gPanel, 16);
callInTab(gTab, "runDebuggerStatement");
yield onCaretUpdated;
await onCaretUpdated;
is(gDebugger.gThreadClient.state, "paused",
"The debugger statement was reached.");
ok(isCaretPos(gPanel, 16),
"The source editor caret position is incorrect (1).");
yield actions.addBreakpoint({ actor: getSourceActor(gSources, TAB_URL), line: 20 });
yield testResume();
yield testBreakpointHit();
await actions.addBreakpoint({ actor: getSourceActor(gSources, TAB_URL), line: 20 });
await testResume();
await testBreakpointHit();
resumeDebuggerThenCloseAndFinish(gPanel);
});
})();
});
}

View File

@ -16,63 +16,57 @@ function test() {
// test is too slow on some platforms due to the number of test cases
requestLongerTimeout(3);
Task.spawn(function*() {
yield testHosts(["bottom", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
yield testHosts(["side", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
yield testHosts(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
yield testHosts(["side", "window:big", "side"], ["vertical", "horizontal", "vertical"]);
yield testHosts(["window:big", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
yield testHosts(["window:small", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
yield testHosts(["window:small", "window:big", "window:small"], ["vertical", "horizontal", "vertical"]);
(async function() {
await testHosts(["bottom", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
await testHosts(["side", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
await testHosts(["bottom", "side", "bottom"], ["horizontal", "vertical", "horizontal"]);
await testHosts(["side", "window:big", "side"], ["vertical", "horizontal", "vertical"]);
await testHosts(["window:big", "side", "window:big"], ["horizontal", "vertical", "horizontal"]);
await testHosts(["window:small", "bottom", "side"], ["vertical", "horizontal", "vertical"]);
await testHosts(["window:small", "window:big", "window:small"], ["vertical", "horizontal", "vertical"]);
finish();
});
})();
}
function testHosts(aHostTypes, aLayoutTypes) {
async function testHosts(aHostTypes, aLayoutTypes) {
let [firstHost, secondHost, thirdHost] = aHostTypes;
let [firstLayout, secondLayout, thirdLayout] = aLayoutTypes;
Services.prefs.setCharPref("devtools.toolbox.host", getHost(firstHost));
return Task.spawn(function*() {
let [tab, debuggee, panel] = yield initDebugger();
if (getHost(firstHost) === "window") {
yield resizeToolboxWindow(panel, firstHost);
}
let [tab, debuggee, panel] = await initDebugger();
if (getHost(firstHost) === "window") {
await resizeToolboxWindow(panel, firstHost);
}
yield testHost(panel, getHost(firstHost), firstLayout);
yield switchAndTestHost(tab, panel, secondHost, secondLayout);
yield switchAndTestHost(tab, panel, thirdHost, thirdLayout);
yield teardown(panel);
});
await testHost(panel, getHost(firstHost), firstLayout);
await switchAndTestHost(tab, panel, secondHost, secondLayout);
await switchAndTestHost(tab, panel, thirdHost, thirdLayout);
await teardown(panel);
}
function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
async function switchAndTestHost(aTab, aPanel, aHostType, aLayoutType) {
let gToolbox = aPanel._toolbox;
let gDebugger = aPanel.panelWin;
return Task.spawn(function*() {
let layoutChanged = waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
let hostChanged = gToolbox.switchHost(getHost(aHostType));
let layoutChanged = waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
let hostChanged = gToolbox.switchHost(getHost(aHostType));
yield hostChanged;
info("The toolbox's host has changed.");
await hostChanged;
info("The toolbox's host has changed.");
if (getHost(aHostType) === "window") {
yield resizeToolboxWindow(aPanel, aHostType);
}
if (getHost(aHostType) === "window") {
await resizeToolboxWindow(aPanel, aHostType);
}
yield layoutChanged;
info("The debugger's layout has changed.");
await layoutChanged;
info("The debugger's layout has changed.");
yield testHost(aPanel, getHost(aHostType), aLayoutType);
});
await testHost(aPanel, getHost(aHostType), aLayoutType);
}
function waitEventOnce(aTarget, aEvent) {
let deferred = promise.defer();
aTarget.once(aEvent, deferred.resolve);
return deferred.promise;
return new Promise(resolve => aTarget.once(aEvent, resolve));
}
function getHost(host) {
@ -82,7 +76,7 @@ function getHost(host) {
return host;
}
function resizeToolboxWindow(panel, host) {
async function resizeToolboxWindow(panel, host) {
let sizeOption = host.split(":")[1];
let win = panel._toolbox.win.parent;
@ -90,22 +84,22 @@ function resizeToolboxWindow(panel, host) {
let breakpoint = 850;
if (sizeOption == "big" && win.outerWidth <= breakpoint) {
yield resizeAndWaitForLayoutChange(panel, breakpoint + 300);
await resizeAndWaitForLayoutChange(panel, breakpoint + 300);
} else if (sizeOption == "small" && win.outerWidth >= breakpoint) {
yield resizeAndWaitForLayoutChange(panel, breakpoint - 300);
await resizeAndWaitForLayoutChange(panel, breakpoint - 300);
} else {
info("Window resize unnecessary for host " + host);
}
}
function resizeAndWaitForLayoutChange(panel, width) {
info("Updating toolbox window width to " + width);
async function resizeAndWaitForLayoutChange(panel, width) {
info("Updating toolbox window width to " + width);
let win = panel._toolbox.win.parent;
let gDebugger = panel.panelWin;
let win = panel._toolbox.win.parent;
let gDebugger = panel.panelWin;
win.resizeTo(width, window.screen.availHeight);
yield waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
win.resizeTo(width, window.screen.availHeight);
await waitEventOnce(gDebugger, gDebugger.EVENTS.LAYOUT_CHANGED);
}
function testHost(aPanel, aHostType, aLayoutType) {

View File

@ -26,7 +26,7 @@
/* Firebug theme is using slightly different height. */
.theme-firebug .tabs .tabs-navigation {
height: 24px;
height: 28px;
}
.tabs .tabs-menu-item a {

View File

@ -28,12 +28,12 @@ localStorage.setItem("ls2", "foobar-2");
sessionStorage.setItem("ss1", "foobar-3");
dump("added cookies and storage from main page\n");
let idbGenerator = function*() {
let idbGenerator = async function() {
let request = indexedDB.open("idb1", 1);
request.onerror = function() {
throw new Error("error opening db connection");
};
let db = yield new Promise(done => {
let db = await new Promise(done => {
request.onupgradeneeded = event => {
let db = event.target.result;
let store1 = db.createObjectStore("obj1", { keyPath: "id" });
@ -47,7 +47,7 @@ let idbGenerator = function*() {
});
// Prevents AbortError
yield new Promise(done => {
await new Promise(done => {
request.onsuccess = done;
});
@ -64,14 +64,14 @@ let idbGenerator = function*() {
extra: "baz"
});
// Prevents AbortError during close()
yield new Promise(success => {
await new Promise(success => {
transaction.oncomplete = success;
});
db.close();
request = indexedDB.open("idb2", 1);
let db2 = yield new Promise(done => {
let db2 = await new Promise(done => {
request.onupgradeneeded = event => {
let db2 = event.target.result;
let store3 = db2.createObjectStore("obj3", { keyPath: "id3" });
@ -82,7 +82,7 @@ let idbGenerator = function*() {
};
});
// Prevents AbortError during close()
yield new Promise(done => {
await new Promise(done => {
request.onsuccess = done;
});
db2.close();
@ -97,15 +97,15 @@ function deleteDB(dbName) {
});
}
function fetchPut(cache, url) {
let response = yield fetch(url);
yield cache.put(url, response);
async function fetchPut(cache, url) {
let response = await fetch(url);
await cache.put(url, response);
}
let cacheGenerator = function*() {
let cache = yield caches.open("plop");
yield fetchPut(cache, "404_cached_file.js");
yield fetchPut(cache, "browser_storage_basic.js");
let cacheGenerator = async function() {
let cache = await caches.open("plop");
await fetchPut(cache, "404_cached_file.js");
await fetchPut(cache, "browser_storage_basic.js");
};
window.setup = function*() {

View File

@ -81,7 +81,7 @@
.theme-firebug .devtools-tab,
.theme-firebug .devtools-sidebar-tabs tab {
margin: 3px 0 -1px 0;
padding: 2px 0 0 0;
padding: 2px 4px 0 4px;
border: 1px solid transparent !important;
border-radius: 4px 4px 0 0;
font-weight: bold;

View File

@ -20,7 +20,7 @@ window.onload = function() {
var gWalker, gDoc;
addAsyncTest(function() {
addAsyncTest(function*() {
let url = document.getElementById("inspectorContent").href;
let def = promise.defer();
@ -37,7 +37,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.parents(nodeFront) before the load completes shouldn't fail");
@ -51,7 +51,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.children(nodeFront) before the load completes shouldn't fail");
@ -65,7 +65,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.siblings(nodeFront) before the load completes shouldn't fail");
@ -79,7 +79,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.nextSibling(nodeFront) before the load completes shouldn't fail");
@ -93,7 +93,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.previousSibling(nodeFront) before the load completes shouldn't fail");
@ -107,7 +107,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.addPseudoClassLock(nodeFront) before the load completes " +
"shouldn't fail");
@ -122,7 +122,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.removePseudoClassLock(nodeFront) before the load completes " +
"shouldn't fail");
@ -137,7 +137,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.clearPseudoClassLocks(nodeFront) before the load completes " +
"shouldn't fail");
@ -152,7 +152,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.innerHTML(nodeFront) before the load completes shouldn't fail");
@ -166,7 +166,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.setInnerHTML(nodeFront) before the load completes shouldn't fail");
@ -180,7 +180,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.outerHTML(nodeFront) before the load completes shouldn't fail");
@ -194,7 +194,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.setOuterHTML(nodeFront) before the load completes shouldn't fail");
@ -208,7 +208,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.insertAdjacentHTML(nodeFront) before the load completes shouldn't " +
"fail");
@ -224,7 +224,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.removeNode(nodeFront) before the load completes should throw");
@ -243,7 +243,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.removeNodes([nodeFront]) before the load completes should throw");
@ -264,7 +264,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.insertBefore(nodeFront, parent, null) before the load completes " +
"shouldn't fail");
@ -280,7 +280,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.insertBefore(nodeFront, parent, sibling) before the load completes " +
"shouldn't fail");
@ -297,7 +297,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.editTagName(nodeFront) before the load completes shouldn't fail");
@ -311,7 +311,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.hideNode(nodeFront) before the load completes shouldn't fail");
@ -325,7 +325,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.unhideNode(nodeFront) before the load completes shouldn't fail");
@ -339,7 +339,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.releaseNode(nodeFront) before the load completes shouldn't fail");
@ -353,7 +353,7 @@ addAsyncTest(function() {
runNextTest();
});
addAsyncTest(function() {
addAsyncTest(function*() {
info("Getting a nodeFront, reloading the page, and calling " +
"walker.querySelector(nodeFront) before the load completes shouldn't fail");

View File

@ -13,9 +13,6 @@ Test decoding a simple message
window.onload = function() {
const { utils: Cu } = Components;
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const { Task } = require("devtools/shared/task");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const QR = require("devtools/shared/qrcode/index");
@ -31,29 +28,28 @@ window.onload = function() {
"t3jVw2dwTPwJq1KYG3gAklCgu37yGxeScYKyiCc+7DR34hPVQiuQ7UhJMagyEb" +
"lymmzJk0a9q8iTOnzp0NCgAAOw==";
Task.spawn(function() {
let result = yield QR.decodeFromURI(testImage);
(async function() {
let result = await QR.decodeFromURI(testImage);
is(result, "HELLO", "Decoded data URI result matches");
let canvas = yield drawToCanvas(testImage);
let canvas = await drawToCanvas(testImage);
result = QR.decodeFromCanvas(canvas);
is(result, "HELLO", "Decoded canvas result matches");
}).then(SimpleTest.finish, ok.bind(null, false));
})().then(SimpleTest.finish, ok.bind(null, false));
function drawToCanvas(src) {
let deferred = defer();
let canvas = document.createElement("canvas");
let context = canvas.getContext("2d");
let image = new Image();
return new Promise(resolve => {
let canvas = document.createElement("canvas");
let context = canvas.getContext("2d");
let image = new Image();
image.onload = () => {
canvas.width = image.width;
canvas.height = image.height;
context.drawImage(image, 0, 0);
deferred.resolve(canvas);
};
image.src = src;
return deferred.promise;
image.onload = () => {
canvas.width = image.width;
canvas.height = image.height;
context.drawImage(image, 0, 0);
resolve(canvas);
};
image.src = src;
});
}
};
</script>

View File

@ -3007,29 +3007,6 @@ nsDocShell::TopSessionStorageManager()
return mSessionStorageManager;
}
NS_IMETHODIMP
nsDocShell::GetSessionStorageForPrincipal(nsIPrincipal* aPrincipal,
const nsAString& aDocumentURI,
bool aCreate,
nsIDOMStorage** aStorage)
{
nsCOMPtr<nsIDOMStorageManager> manager = TopSessionStorageManager();
if (!manager) {
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsPIDOMWindowOuter> domWin = GetWindow();
AssertOriginAttributesMatchPrivateBrowsing();
if (aCreate) {
return manager->CreateStorage(domWin->GetCurrentInnerWindow(), aPrincipal,
aDocumentURI, aStorage);
}
return manager->GetStorage(domWin->GetCurrentInnerWindow(), aPrincipal,
aStorage);
}
nsresult
nsDocShell::AddSessionStorage(nsIPrincipal* aPrincipal, nsIDOMStorage* aStorage)
{
@ -9587,7 +9564,7 @@ public:
InternalLoadEvent(nsDocShell* aDocShell, nsIURI* aURI,
nsIURI* aOriginalURI, bool aLoadReplace,
nsIURI* aReferrer, uint32_t aReferrerPolicy,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit, uint32_t aFlags,
const char* aTypeHint, nsIInputStream* aPostData,
nsIInputStream* aHeadersData, uint32_t aLoadType,
@ -9922,7 +9899,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
bool inherits;
// One more twist: Don't inherit the principal for external loads.
if (aLoadType != LOAD_NORMAL_EXTERNAL && !principalToInherit &&
(aFlags & INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL) &&
(aFlags & INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL) &&
NS_SUCCEEDED(nsContentUtils::URIInheritsSecurityContext(aURI,
&inherits)) &&
inherits) {
@ -10329,7 +10306,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
nsCOMPtr<nsIPrincipal> triggeringPrincipal, principalToInherit;
if (mOSHE) {
mOSHE->GetTriggeringPrincipal(getter_AddRefs(triggeringPrincipal));
mOSHE->GetPrincipalToInherit(getter_AddRefs(principalToInherit));
mOSHE->GetPrincipalToInherit(getter_AddRefs(principalToInherit));
}
// Pass true for aCloneSHChildren, since we're not
// changing documents here, so all of our subframes are

View File

@ -52,7 +52,7 @@ interface nsIDocShell : nsIDocShellTreeItem
{
/**
* Loads a given URI. This will give priority to loading the requested URI
* in the object implementing this interface. If it can't be loaded here
* in the object implementing this interface. If it can't be loaded here
* however, the URL dispatcher will go through its normal process of content
* loading.
*
@ -527,21 +527,6 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
void historyPurged(in long numEntries);
/*
* @deprecated, use nsIDocShell.QueryInterface(nsIDOMStorageManager) instead.
*
* Retrieves the WebApps session storage object for the supplied principal.
*
* @param principal returns a storage for this principal
* @param documentURI new storage will be created with reference to this
* document.documentURI that will appear in storage event
* @param create If true and a session storage object doesn't
* already exist, a new one will be created.
*/
nsIDOMStorage getSessionStorageForPrincipal(in nsIPrincipal principal,
in DOMString documentURI,
in boolean create);
/*
* @deprecated, use nsIDocShell.QueryInterface(nsIDOMStorageManager) instead.
*

View File

@ -2,8 +2,8 @@ add_task(function* test() {
const secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
const uris = [undefined, "about:blank"];
function checkContentProcess(uri) {
yield ContentTask.spawn(newBrowser, uri, function* (uri) {
function checkContentProcess(newBrowser, uri) {
return ContentTask.spawn(newBrowser, uri, function* (uri) {
var prin = content.document.nodePrincipal;
Assert.notEqual(prin, null, "Loaded principal must not be null when adding " + uri);
Assert.notEqual(prin, undefined, "Loaded principal must not be undefined when loading " + uri);
@ -28,7 +28,7 @@ add_task(function* test() {
// Belt-and-suspenders e10s check: make sure that the same checks hold
// true in the content process.
checkContentProcess(uri);
yield checkContentProcess(newBrowser, uri);
yield BrowserTestUtils.browserLoaded(newBrowser);
@ -40,7 +40,7 @@ add_task(function* test() {
// Belt-and-suspenders e10s check: make sure that the same checks hold
// true in the content process.
checkContentProcess(uri);
yield checkContentProcess(newBrowser, uri);
});
}
});

View File

@ -76,14 +76,10 @@
}
function nextTest() {
try {
gTestsIterator.next();
} catch (err if err instanceof StopIteration) {
finish();
}
gTestsIterator.next();
}
function testsIterator() {
function* testsIterator() {
// Load a secure page with a no-cache header, followed by a simple page.
// no-cache should not interfere with the bfcache in the way no-store
// does.
@ -110,6 +106,8 @@
{type: "pageshow", title: "test1", persisted: true}];
gBrowser.goBack();
yield undefined;
finish();
}
]]></script>

View File

@ -53,14 +53,10 @@
}
function nextTest() {
try {
gTestsIterator.next();
} catch (err if err instanceof StopIteration) {
finish();
}
gTestsIterator.next();
}
function testsIterator() {
function* testsIterator() {
// No-store tests
var testName = "[nostore]";
@ -156,10 +152,7 @@
var formValue = gBrowser.contentDocument.getElementById("inp").value;
is(formValue, text, testName + " form value not correctly restored");
// nextTest has to be called from here, as no events are fired in this
// step
setTimeout(nextTest, 0);
yield undefined;
finish();
}
]]></script>

View File

@ -42,7 +42,7 @@
// to it when displayed on a page which was fetched from
// the bfcache.
//
function testIterator()
function* testIterator()
{
// Register our observer to know when the link lookup is complete.
let testURI = NetUtil.newURI(getHttpUrl("bug293235_p2.html"));
@ -150,10 +150,8 @@
ok(snapshotsEqual(refVisited, snapshotWindow(TestWindow.getWindow())),
"visited link should be purple");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -28,7 +28,7 @@
// Generator function for test steps for bug 294258:
// Form values should be preserved on reload.
//
function testIterator()
function* testIterator()
{
// Load a page containing a form.
doPageNavigation( {
@ -64,10 +64,8 @@
is($("radio1").checked, true, "Radio value changed");
is($("select").selectedIndex, 2, "Select value changed");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -29,7 +29,7 @@
// Find should work correctly on a page loaded from the
// bfcache.
//
function testIterator()
function* testIterator()
{
// Make sure bfcache is on.
enableBFCache(true);
@ -131,10 +131,8 @@
"find this",
"find failed on page loaded from bfcache");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -43,7 +43,7 @@
// navigating back and forwards, when the parent page
// occupies multiple spots in the session history.
//
function testIterator()
function* testIterator()
{
// Make sure the bfcache is enabled.
enableBFCache(8);
@ -238,10 +238,8 @@
verifyIframeInnerHtml("You made it");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -27,7 +27,7 @@
// displayed from the bfcache, the script globals should
// remain intact from the page's initial load.
//
function testIterator()
function* testIterator()
{
// Load an initial test page which should be saved in the bfcache.
var navData = {
@ -82,10 +82,8 @@
isnot(originalHTML,
newHTML, "HTML not updated on pageshow; javascript broken?");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
////

View File

@ -34,7 +34,7 @@
// should be retained when moving backwards and forwards through pages
// when bfcache is enabled.
//
function testIterator()
function* testIterator()
{
// Variable to hold the scroll positions of the test pages.
var scrollPositions = [];
@ -121,10 +121,8 @@
"Scroll position not restored while going forward!");
}
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -27,7 +27,7 @@
// Fragment uri's in session history should be restored correctly
// upon back navigation.
//
function testIterator()
function* testIterator()
{
// Case 1: load a page containing a fragment link; the page should be
// stored in the bfcache.
@ -122,10 +122,8 @@
"document.location is not the original url");
}
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -72,14 +72,10 @@
}
function nextTest() {
try {
gTestsIterator.next();
} catch (err if err instanceof StopIteration) {
finish();
}
gTestsIterator.next();
}
function testsIterator() {
function* testsIterator() {
// Tests 1 + 2:
// Back/forward between two simple documents. Bfcache will be used.
@ -266,10 +262,7 @@
is(gBrowser.currentURI.spec, "data:text/plain,aaa",
"Navigation is blocked when clicking link");
// nextTest has to be called from here, as no events are fired in this
// step
setTimeout(nextTest, 0);
yield undefined;
finish();
}
]]></script>

View File

@ -92,14 +92,10 @@
}
function nextTest() {
try {
gTestsIterator.next();
} catch (err if err instanceof StopIteration) {
finish();
}
gTestsIterator.next();
}
function testsIterator() {
function* testsIterator() {
// Tests 1 + 2:
// Back/forward between two simple documents. Bfcache will be used.
@ -162,6 +158,8 @@
gExpected = [false, false, true, true, false, false];
gBrowser.gotoIndex(5);
yield undefined;
finish();
}
]]></script>

View File

@ -40,7 +40,7 @@
// viewers should be evicted from bfcache when going back if more
// than MAX_BFCACHE_PAGES from the current index.
//
function testIterator()
function* testIterator()
{
// Make sure bfcache is on.
enableBFCache(true);
@ -110,10 +110,8 @@
yield undefined;
}
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -37,7 +37,7 @@
return $(id).contentDocument.documentElement.innerHTML;
}
var tester = (function() {
var tester = (function*() {
var origDOM = getDOM("f1");
$("f1").contentDocument.body.textContent = "Modified";
var modifiedDOM = getDOM("f1");
@ -62,7 +62,6 @@
is(getDOM("f2"), origDOM, "Should have not have been bfcached");
window.close();
SimpleTest.finish();
yield undefined;
})();
function testDriver() {

View File

@ -26,7 +26,7 @@
// Generator function for test steps for bug 582176:
// Description goes here.
//
function testIterator()
function* testIterator()
{
var browser = document.getElementById('content');
browser.addEventListener("pageshow", nextTestAsync, true);
@ -77,10 +77,8 @@
os.removeObserver(observer, "content-document-global-created")
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -28,7 +28,7 @@
// Generator function for test steps for bug 662200:
// Description goes here.
//
function testIterator()
function* testIterator()
{
// Load the first test page
var navData = {
@ -117,10 +117,8 @@
is(TestWindow.getBrowser().canGoForward, true, "Should be able to go forward!");
is(shistory.requestedIndex, -1, "Requested index should be cleared!");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -18,7 +18,7 @@
}
// Makes sure that we fire the visibilitychange events
function testIterator() {
function* testIterator() {
// Enable bfcache
enableBFCache(8);
@ -165,10 +165,8 @@
});
yield undefined;
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -35,7 +35,7 @@
// to it when displayed on a page which was fetched from
// the bfcache.
//
function testIterator()
function* testIterator()
{
// Load a test page containing an image referring to the sjs that returns
// a different redirect every time it's loaded.
@ -70,10 +70,8 @@
ok(!snapshotsEqual(third, second), "going back should not be the same as about:blank");
ok(snapshotsEqual(first, third), "going back should be the same as the initial load");
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
// Tell the framework the test is finished.
finish();
yield undefined;
}
]]></script>

View File

@ -76,14 +76,10 @@
}
function nextTest() {
try {
gTestsIterator.next();
} catch (err if err instanceof StopIteration) {
finish();
}
gTestsIterator.next();
}
function testsIterator() {
function* testsIterator() {
// Load a page with a no-cache header, followed by a simple page
// On pagehide, first page should report it is not being persisted
var test1DocURI = "http://mochi.test:8888/tests/docshell/test/chrome/92598_nostore.html";
@ -111,6 +107,8 @@
{type: "pageshow", title: "test1", persisted: false}];
gBrowser.goBack();
yield undefined;
finish();
}
]]></script>

View File

@ -23,7 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
var iter = runTests();
nextTest();
function runTests() {
function* runTests() {
var iframe = document.createElement("iframe");
iframe.style.width = "300px";
iframe.style.height = "300px";
@ -40,6 +40,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
h1.style.width = "300px";
waitForReflow(iframe.docShell);
yield is(300, h1.offsetWidth, "h1 has correct width");
SimpleTest.finish();
}
function waitForInterruptibleReflow(docShell) {
@ -97,11 +99,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
}
function nextTest() {
try {
iter.next();
} catch (e if e instanceof StopIteration) {
SimpleTest.finish();
}
iter.next();
}
]]>

View File

@ -50,7 +50,7 @@ function nextTest() {
gen.next();
}
function doTest() {
function* doTest() {
var container = document.getElementById('container');
setCachePref(true);
@ -105,7 +105,6 @@ function doTest() {
os.removeObserver(observer, "chrome-document-global-created");
os.removeObserver(observer, "content-document-global-created");
SimpleTest.finish();
yield undefined;
}

View File

@ -47,9 +47,6 @@ function childLoad(n) {
// Spin the event loop before calling gGen.next() so the generator runs
// outside the onload handler. This prevents us from encountering all
// sorts of docshell quirks.
//
// (I don't know why I need to wrap gGen.next() in a function, but it
// throws an error otherwise.)
setTimeout(function() { gGen.next() }, 0);
}
else {
@ -84,7 +81,7 @@ function waitForShow(n) {
expectedPageshowNum = n;
}
function test() {
function* test() {
var popup = window.open('data:text/html,' +
'<html><body onload="opener.childLoad(1)" ' +
'onpageshow="opener.childPageshow(1)">' +
@ -106,9 +103,6 @@ function test() {
popup.close();
SimpleTest.finish();
// Yield once more so we don't throw a StopIteration exception.
yield undefined;
}
var gGen = test();

View File

@ -197,7 +197,6 @@ function run_test() {
"hasn't finished loading.");
SimpleTest.finish();
yield undefined;
}
var gGen = run_test();

View File

@ -27,19 +27,19 @@ gen = runTests();
window.private = 42;
window.addEventListener("message", function(e) {
gen.send(e.data);
gen.next(e.data);
}, false);
var url = "file_bug475636.sjs?";
function runTests() {
function* runTests() {
var loader = document.getElementById('loader');
for (var testNum = 1; ; ++testNum) {
loader.src = url + testNum;
let res = (yield);
if (res == "done") {
SimpleTest.finish();
yield undefined;
return;
}
is(res, "pass");
}

View File

@ -40,7 +40,7 @@ function onChildLoad(e) {
gGen.next();
}
function runTest() {
function* runTest() {
var popup = window.open("file_bug509055.html", "popup 0",
"height=200,width=200,location=yes," +
"menubar=yes,status=yes,toolbar=yes,dependent=yes");
@ -82,8 +82,6 @@ function runTest() {
popup.close();
SimpleTest.executeSoon(SimpleTest.finish);
dump('Final yield.\n');
yield undefined;
}
window.addEventListener('load', function() {

View File

@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=640387
<script type='application/javascript;version=1.7'>
SimpleTest.waitForExplicitFinish();
function test() {
function* test() {
/* Spin the event loop so we get out of the onload handler. */
SimpleTest.executeSoon(function() { gGen.next() });
yield undefined;
@ -71,7 +71,6 @@ function test() {
popup.close();
SimpleTest.finish();
yield undefined;
}
gGen = null;

View File

@ -45,7 +45,7 @@ function childHashchange() {
}
}
function run_test() {
function* run_test() {
var iframe = $('iframe').contentWindow;
ok(true, 'Got first load');
@ -76,7 +76,6 @@ function run_test() {
yield undefined;
SimpleTest.finish();
yield undefined;
}
callbackOnLoad = true;

View File

@ -65,7 +65,7 @@ function checkPopupLoadCount()
return origCount;
}
function test()
function* test()
{
// Step 0 - Make sure the count is reset to 0 in case of reload
popup.location = 'file_bug669671.sjs?countreset';
@ -132,7 +132,6 @@ function test()
popup.close();
SimpleTest.finish();
yield undefined;
}
// This will call into onChildLoad once it loads.

View File

@ -3,8 +3,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var testGenerator;
function runTest()
{
SimpleTest.waitForExplicitFinish();
@ -12,8 +10,7 @@ function runTest()
SpecialPowers.pushPrefEnv({'set': [ ["dom.archivereader.enabled", true] ]}, function() {
SpecialPowers.createFiles(filesToCreate(),
function (files) {
testGenerator = testSteps(files);
return testGenerator.next();
testSteps(files);
},
function (msg) {
ok(false, "File creation error: " + msg);
@ -25,7 +22,6 @@ function runTest()
function finishTest()
{
SpecialPowers.popPrefEnv(function() {
testGenerator.close();
SimpleTest.finish();
});
}

View File

@ -212,7 +212,6 @@
ok(false, "ArchiveReader.getFiles() should not return an 'error'");
markTestDone();
}
yield undefined;
}
</script>

View File

@ -51,7 +51,6 @@
function testSteps(files)
{
test1(files[0]);
yield undefined;
}

View File

@ -25,8 +25,6 @@
// The input is 4 nested zip archives:
doLoop(binaryFile, 4);
yield undefined;
}
function doLoop(blob, loop)

View File

@ -6,6 +6,7 @@
#include "mozilla/dom/Dispatcher.h"
#include "mozilla/Move.h"
#include "nsINamed.h"
using namespace mozilla;
@ -14,12 +15,21 @@ DispatcherTrait::Dispatch(const char* aName,
TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
return NS_DispatchToMainThread(Move(aRunnable));
nsCOMPtr<nsIRunnable> runnable(aRunnable);
if (aName) {
if (nsCOMPtr<nsINamed> named = do_QueryInterface(runnable)) {
named->SetName(aName);
}
}
if (NS_IsMainThread()) {
return NS_DispatchToCurrentThread(runnable.forget());
} else {
return NS_DispatchToMainThread(runnable.forget());
}
}
already_AddRefed<nsIEventTarget>
DispatcherTrait::CreateEventTarget(const char* aName,
TaskCategory aCategory)
DispatcherTrait::EventTargetFor(TaskCategory aCategory) const
{
nsCOMPtr<nsIEventTarget> main = do_GetMainThread();
return main.forget();
@ -30,15 +40,11 @@ namespace {
class DispatcherEventTarget final : public nsIEventTarget
{
RefPtr<dom::Dispatcher> mDispatcher;
const char* mName;
TaskCategory mCategory;
public:
DispatcherEventTarget(dom::Dispatcher* aDispatcher,
const char* aName,
TaskCategory aCategory)
DispatcherEventTarget(dom::Dispatcher* aDispatcher, TaskCategory aCategory)
: mDispatcher(aDispatcher)
, mName(aName)
, mCategory(aCategory)
{}
@ -67,7 +73,7 @@ DispatcherEventTarget::Dispatch(already_AddRefed<nsIRunnable> aRunnable, uint32_
if (NS_WARN_IF(aFlags != NS_DISPATCH_NORMAL)) {
return NS_ERROR_UNEXPECTED;
}
return mDispatcher->Dispatch(mName, mCategory, Move(aRunnable));
return mDispatcher->Dispatch(nullptr, mCategory, Move(aRunnable));
}
NS_IMETHODIMP
@ -84,9 +90,9 @@ DispatcherEventTarget::IsOnCurrentThread(bool* aIsOnCurrentThread)
}
already_AddRefed<nsIEventTarget>
Dispatcher::CreateEventTarget(const char* aName, TaskCategory aCategory)
Dispatcher::CreateEventTargetFor(TaskCategory aCategory)
{
RefPtr<DispatcherEventTarget> target =
new DispatcherEventTarget(this, aName, aCategory);
new DispatcherEventTarget(this, aCategory);
return target.forget();
}

View File

@ -34,6 +34,8 @@ enum class TaskCategory {
// Most DOM events (postMessage, media, plugins)
Other,
Count
};
// This trait should be attached to classes like nsIGlobalObject and nsIDocument
@ -52,7 +54,7 @@ public:
// it is safe. For nsIGlobalWindow it is not safe. The nsIEventTarget can
// always be used off the main thread.
virtual already_AddRefed<nsIEventTarget>
CreateEventTarget(const char* aName, TaskCategory aCategory);
EventTargetFor(TaskCategory aCategory) const;
};
// Base class for DocGroup and TabGroup.
@ -66,7 +68,11 @@ public:
// This method is always safe to call off the main thread. The nsIEventTarget
// can always be used off the main thread.
virtual already_AddRefed<nsIEventTarget>
CreateEventTarget(const char* aName, TaskCategory aCategory);
EventTargetFor(TaskCategory aCategory) const = 0;
protected:
virtual already_AddRefed<nsIEventTarget>
CreateEventTargetFor(TaskCategory aCategory);
};
} // namespace dom

View File

@ -60,7 +60,13 @@ DocGroup::Dispatch(const char* aName,
TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
return NS_DispatchToMainThread(Move(aRunnable));
return mTabGroup->Dispatch(aName, aCategory, Move(aRunnable));
}
already_AddRefed<nsIEventTarget>
DocGroup::EventTargetFor(TaskCategory aCategory) const
{
return mTabGroup->EventTargetFor(aCategory);
}
}

View File

@ -69,6 +69,9 @@ public:
TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual already_AddRefed<nsIEventTarget>
EventTargetFor(TaskCategory aCategory) const override;
private:
DocGroup(TabGroup* aTabGroup, const nsACString& aKey);
~DocGroup();

View File

@ -21,6 +21,7 @@
#include "mozilla/dom/ImageData.h"
#include "mozilla/dom/ImageDataBinding.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/nsIRemoteBlob.h"
#include "mozilla/dom/StructuredClone.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/MessagePortBinding.h"
@ -38,7 +39,6 @@
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "MultipartBlobImpl.h"
#include "nsIRemoteBlob.h"
#include "nsQueryObject.h"
#ifdef MOZ_WEBRTC

View File

@ -21,7 +21,13 @@ namespace dom {
static StaticRefPtr<TabGroup> sChromeTabGroup;
TabGroup::TabGroup(bool aIsChrome)
: mLastWindowLeft(false)
{
for (size_t i = 0; i < size_t(TaskCategory::Count); i++) {
TaskCategory category = static_cast<TaskCategory>(i);
mEventTargets[i] = CreateEventTargetFor(category);
}
// Do not throttle runnables from chrome windows. In theory we should
// not have abuse issues from these windows and many browser chrome
// tests have races that fail if we do throttle chrome runnables.
@ -99,6 +105,18 @@ TabGroup::Leave(nsPIDOMWindowOuter* aWindow)
{
MOZ_ASSERT(mWindows.Contains(aWindow));
mWindows.RemoveElement(aWindow);
if (mWindows.IsEmpty()) {
mLastWindowLeft = true;
// There is a RefPtr cycle TabGroup -> DispatcherEventTarget -> TabGroup. To
// avoid leaks, we need to break the chain somewhere. We shouldn't be using
// the ThrottledEventQueue for this TabGroup when no windows belong to it,
// so it's safe to null out the queue here.
for (size_t i = 0; i < size_t(TaskCategory::Count); i++) {
mEventTargets[i] = nullptr;
}
}
}
nsresult
@ -172,7 +190,25 @@ TabGroup::Dispatch(const char* aName,
TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable)
{
return NS_DispatchToMainThread(Move(aRunnable));
nsCOMPtr<nsIRunnable> runnable(aRunnable);
if (aName) {
if (nsCOMPtr<nsINamed> named = do_QueryInterface(runnable)) {
named->SetName(aName);
}
}
if (NS_IsMainThread()) {
return NS_DispatchToCurrentThread(runnable.forget());
} else {
return NS_DispatchToMainThread(runnable.forget());
}
}
already_AddRefed<nsIEventTarget>
TabGroup::EventTargetFor(TaskCategory aCategory) const
{
MOZ_RELEASE_ASSERT(!mLastWindowLeft);
nsCOMPtr<nsIEventTarget> target = mEventTargets[size_t(aCategory)];
return target.forget();
}
}

View File

@ -110,11 +110,16 @@ public:
TaskCategory aCategory,
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual already_AddRefed<nsIEventTarget>
EventTargetFor(TaskCategory aCategory) const override;
private:
~TabGroup();
DocGroupMap mDocGroups;
bool mLastWindowLeft;
nsTArray<nsPIDOMWindowOuter*> mWindows;
RefPtr<ThrottledEventQueue> mThrottledEventQueue;
nsCOMPtr<nsIEventTarget> mEventTargets[size_t(TaskCategory::Count)];
};
} // namespace dom

View File

@ -11,11 +11,9 @@ XPIDL_SOURCES += [
'nsIContentPolicy.idl',
'nsIContentPolicyBase.idl',
'nsIDocumentEncoder.idl',
'nsIDOMBlob.idl',
'nsIDOMDataChannel.idl',
'nsIDOMDOMCursor.idl',
'nsIDOMDOMRequest.idl',
'nsIDOMFileList.idl',
'nsIDOMFormData.idl',
'nsIDOMParser.idl',
'nsIDOMSerializer.idl',
@ -78,8 +76,6 @@ EXPORTS += [
'nsGenericDOMDataNode.h',
'nsGkAtomList.h',
'nsGkAtoms.h',
'nsHostObjectProtocolHandler.h',
'nsHostObjectURI.h',
'nsIAnimationObserver.h',
'nsIAttribute.h',
'nsIContent.h',
@ -151,7 +147,6 @@ EXPORTS.mozilla.dom += [
'AnonymousContent.h',
'Attr.h',
'BarProps.h',
'BlobSet.h',
'BodyUtil.h',
'BorrowedAttrInfo.h',
'ChildIterator.h',
@ -180,9 +175,6 @@ EXPORTS.mozilla.dom += [
'Element.h',
'ElementInlines.h',
'EventSource.h',
'File.h',
'FileList.h',
'FileReader.h',
'FormData.h',
'FragmentOrElement.h',
'FromParser.h',
@ -194,8 +186,6 @@ EXPORTS.mozilla.dom += [
'ImportManager.h',
'Link.h',
'Location.h',
'MutableBlobStorage.h',
'MutableBlobStreamListener.h',
'NameSpaceConstants.h',
'Navigator.h',
'NodeInfo.h',
@ -226,7 +216,6 @@ UNIFIED_SOURCES += [
'AnonymousContent.cpp',
'Attr.cpp',
'BarProps.cpp',
'BlobSet.cpp',
'BodyUtil.cpp',
'BorrowedAttrInfo.cpp',
'ChildIterator.cpp',
@ -253,9 +242,6 @@ UNIFIED_SOURCES += [
'DOMStringList.cpp',
'Element.cpp',
'EventSource.cpp',
'File.cpp',
'FileList.cpp',
'FileReader.cpp',
'FormData.cpp',
'FragmentOrElement.cpp',
'GroupedSHistory.cpp',
@ -266,9 +252,6 @@ UNIFIED_SOURCES += [
'ImportManager.cpp',
'Link.cpp',
'Location.cpp',
'MultipartBlobImpl.cpp',
'MutableBlobStorage.cpp',
'MutableBlobStreamListener.cpp',
'Navigator.cpp',
'NodeInfo.cpp',
'NodeIterator.cpp',
@ -302,8 +285,6 @@ UNIFIED_SOURCES += [
'nsGkAtoms.cpp',
'nsGlobalWindowCommands.cpp',
'nsHistory.cpp',
'nsHostObjectProtocolHandler.cpp',
'nsHostObjectURI.cpp',
'nsHTMLContentSerializer.cpp',
'nsIGlobalObject.cpp',
'nsINode.cpp',
@ -432,6 +413,7 @@ LOCAL_INCLUDES += [
'/caps',
'/docshell/base',
'/dom/base',
'/dom/file',
'/dom/geolocation',
'/dom/html',
'/dom/ipc',

View File

@ -15,6 +15,9 @@
#include "nsPrintfCString.h"
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
using namespace mozilla;
nsDOMNavigationTiming::nsDOMNavigationTiming()
{
@ -52,25 +55,26 @@ nsDOMNavigationTiming::Clear()
}
DOMTimeMilliSec
nsDOMNavigationTiming::TimeStampToDOM(mozilla::TimeStamp aStamp) const
nsDOMNavigationTiming::TimeStampToDOM(TimeStamp aStamp) const
{
if (aStamp.IsNull()) {
return 0;
}
mozilla::TimeDuration duration = aStamp - mNavigationStartTimeStamp;
TimeDuration duration = aStamp - mNavigationStartTimeStamp;
return GetNavigationStart() + static_cast<int64_t>(duration.ToMilliseconds());
}
DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart()
{
return TimeStampToDOM(mozilla::TimeStamp::Now());
return TimeStampToDOM(TimeStamp::Now());
}
void
nsDOMNavigationTiming::NotifyNavigationStart(DocShellState aDocShellState)
{
mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC;
mNavigationStartTimeStamp = mozilla::TimeStamp::Now();
mNavigationStartTimeStamp = TimeStamp::Now();
mDocShellHasBeenActiveSinceNavigationStart = (aDocShellState == DocShellState::eActive);
}
@ -127,7 +131,7 @@ nsDOMNavigationTiming::NotifyLoadEventEnd()
}
void
nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue)
nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, TimeStamp aValue)
{
if (!mDOMLoadingSet) {
mLoadedURI = aURI;

View File

@ -2868,7 +2868,7 @@ nsDocument::SetPrincipal(nsIPrincipal *aNewPrincipal)
}
mozilla::dom::DocGroup*
nsIDocument::GetDocGroup()
nsIDocument::GetDocGroup() const
{
#ifdef DEBUG
// Sanity check that we have an up-to-date and accurate docgroup
@ -2896,12 +2896,12 @@ nsIDocument::Dispatch(const char* aName,
}
already_AddRefed<nsIEventTarget>
nsIDocument::CreateEventTarget(const char* aName, TaskCategory aCategory)
nsIDocument::EventTargetFor(TaskCategory aCategory) const
{
if (mDocGroup) {
return mDocGroup->CreateEventTarget(aName, aCategory);
return mDocGroup->EventTargetFor(aCategory);
}
return DispatcherTrait::CreateEventTarget(aName, aCategory);
return DispatcherTrait::EventTargetFor(aCategory);
}
NS_IMETHODIMP

View File

@ -3032,7 +3032,11 @@ nsGlobalWindow::PreloadLocalStorage()
return;
}
storageManager->PrecacheStorage(principal);
// private browsing windows do not persist local storage to disk so we should
// only try to precache storage when we're not a private browsing window.
if (principal->GetPrivateBrowsingId() == 0) {
storageManager->PrecacheStorage(principal);
}
}
void
@ -10790,6 +10794,8 @@ nsGlobalWindow::GetSessionStorage(ErrorResult& aError)
return nullptr;
}
MOZ_DIAGNOSTIC_ASSERT((principal->GetPrivateBrowsingId() > 0) == IsPrivateBrowsing());
nsCOMPtr<nsIDOMStorage> storage;
aError = storageManager->CreateStorage(AsInner(), principal, documentURI,
getter_AddRefs(storage));
@ -10854,6 +10860,8 @@ nsGlobalWindow::GetLocalStorage(ErrorResult& aError)
}
}
MOZ_DIAGNOSTIC_ASSERT((principal->GetPrivateBrowsingId() > 0) == IsPrivateBrowsing());
nsCOMPtr<nsIDOMStorage> storage;
aError = storageManager->CreateStorage(AsInner(), principal, documentURI,
getter_AddRefs(storage));
@ -14998,7 +15006,7 @@ nsPIDOMWindow<T>::TabGroup()
template<typename T>
mozilla::dom::DocGroup*
nsPIDOMWindow<T>::GetDocGroup()
nsPIDOMWindow<T>::GetDocGroup() const
{
nsIDocument* doc = GetExtantDoc();
if (doc) {
@ -15020,14 +15028,13 @@ nsGlobalWindow::Dispatch(const char* aName,
}
already_AddRefed<nsIEventTarget>
nsGlobalWindow::CreateEventTarget(const char* aName,
TaskCategory aCategory)
nsGlobalWindow::EventTargetFor(TaskCategory aCategory) const
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (GetDocGroup()) {
return GetDocGroup()->CreateEventTarget(aName, aCategory);
return GetDocGroup()->EventTargetFor(aCategory);
}
return DispatcherTrait::CreateEventTarget(aName, aCategory);
return DispatcherTrait::EventTargetFor(aCategory);
}
nsGlobalWindow::TemporarilyDisableDialogs::TemporarilyDisableDialogs(

View File

@ -1731,7 +1731,7 @@ public:
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual already_AddRefed<nsIEventTarget>
CreateEventTarget(const char* aName, mozilla::dom::TaskCategory aCategory) override;
EventTargetFor(mozilla::dom::TaskCategory aCategory) const override;
protected:
// These members are only used on outer window objects. Make sure

View File

@ -2856,7 +2856,7 @@ public:
return mHasScrollLinkedEffect;
}
mozilla::dom::DocGroup* GetDocGroup();
mozilla::dom::DocGroup* GetDocGroup() const;
virtual void AddIntersectionObserver(
mozilla::dom::DOMIntersectionObserver* aObserver) = 0;
@ -2873,8 +2873,7 @@ public:
already_AddRefed<nsIRunnable>&& aRunnable) override;
virtual already_AddRefed<nsIEventTarget>
CreateEventTarget(const char* aName,
mozilla::dom::TaskCategory aCategory) override;
EventTargetFor(mozilla::dom::TaskCategory aCategory) const override;
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)

View File

@ -195,8 +195,6 @@ protected:
void MaybeCreateDoc();
public:
inline bool IsLoadingOrRunningTimeout() const;
// Check whether a document is currently loading
inline bool IsLoading() const;
inline bool IsHandlingResizeEvent() const;
@ -580,7 +578,7 @@ public:
mozilla::dom::TabGroup* TabGroup();
mozilla::dom::DocGroup* GetDocGroup();
mozilla::dom::DocGroup* GetDocGroup() const;
virtual mozilla::ThrottledEventQueue* GetThrottledEventQueue() = 0;

View File

@ -34,16 +34,6 @@ nsPIDOMWindow<T>::AsOuter() const
return reinterpret_cast<const nsPIDOMWindowOuter*>(this);
}
template <class T>
bool
nsPIDOMWindow<T>::IsLoadingOrRunningTimeout() const
{
if (IsOuterWindow()) {
return AsOuter()->GetCurrentInnerWindow()->IsLoadingOrRunningTimeout();
}
return !mIsDocumentLoaded || mRunningTimeout;
}
template <class T>
bool
nsPIDOMWindow<T>::IsLoading() const

View File

@ -83,7 +83,7 @@ add_task(function* () {
let Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
Telemetry.canRecordExtended = gOldParentCanRecord;
yield ContentTask.spawn(gBrowser.selectedBrowser, { oldCanRecord: gOldContentCanRecord }, function (arg) {
yield ContentTask.spawn(gBrowser.selectedBrowser, { oldCanRecord: gOldContentCanRecord }, function* (arg) {
Cu.import("resource://gre/modules/PromiseUtils.jsm");
yield new Promise(resolve => {
let telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
@ -127,7 +127,7 @@ function grabHistogramsFromContent(use_counter_middlefix, page_before = null) {
}).then(gather, gather);
}
var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix, check_documents=true) {
var check_use_counter_iframe = async function(file, use_counter_middlefix, check_documents=true) {
info("checking " + file + " with histogram " + use_counter_middlefix);
let newTab = gBrowser.addTab( "about:blank");
@ -138,13 +138,13 @@ var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix
// interested in.
let [histogram_page_before, histogram_document_before,
histogram_docs_before, histogram_toplevel_docs_before] =
yield grabHistogramsFromContent(use_counter_middlefix);
await grabHistogramsFromContent(use_counter_middlefix);
gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html");
yield waitForPageLoad(gBrowser.selectedBrowser);
await waitForPageLoad(gBrowser.selectedBrowser);
// Inject our desired file into the iframe of the newly-loaded page.
yield ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) {
await ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) {
Cu.import("resource://gre/modules/PromiseUtils.jsm");
let deferred = PromiseUtils.defer();
@ -174,12 +174,12 @@ var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix
// The histograms only get recorded when the document actually gets
// destroyed, which might not have happened yet due to GC/CC effects, etc.
// Try to force document destruction.
yield waitForDestroyedDocuments();
await waitForDestroyedDocuments();
// Grab histograms again and compare.
let [histogram_page_after, histogram_document_after,
histogram_docs_after, histogram_toplevel_docs_after] =
yield grabHistogramsFromContent(use_counter_middlefix, histogram_page_before);
await grabHistogramsFromContent(use_counter_middlefix, histogram_page_before);
is(histogram_page_after, histogram_page_before + 1,
"page counts for " + use_counter_middlefix + " after are correct");
@ -189,9 +189,9 @@ var check_use_counter_iframe = Task.async(function* (file, use_counter_middlefix
is(histogram_document_after, histogram_document_before + 1,
"document counts for " + use_counter_middlefix + " after are correct");
}
});
};
var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
var check_use_counter_img = async function(file, use_counter_middlefix) {
info("checking " + file + " as image with histogram " + use_counter_middlefix);
let newTab = gBrowser.addTab("about:blank");
@ -202,13 +202,13 @@ var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
// interested in.
let [histogram_page_before, histogram_document_before,
histogram_docs_before, histogram_toplevel_docs_before] =
yield grabHistogramsFromContent(use_counter_middlefix);
await grabHistogramsFromContent(use_counter_middlefix);
gBrowser.selectedBrowser.loadURI(gHttpTestRoot + "file_use_counter_outer.html");
yield waitForPageLoad(gBrowser.selectedBrowser);
await waitForPageLoad(gBrowser.selectedBrowser);
// Inject our desired file into the img of the newly-loaded page.
yield ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function(opts) {
await ContentTask.spawn(gBrowser.selectedBrowser, { file: file }, function*(opts) {
Cu.import("resource://gre/modules/PromiseUtils.jsm");
let deferred = PromiseUtils.defer();
@ -239,12 +239,12 @@ var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
// The histograms only get recorded when the document actually gets
// destroyed, which might not have happened yet due to GC/CC effects, etc.
// Try to force document destruction.
yield waitForDestroyedDocuments();
await waitForDestroyedDocuments();
// Grab histograms again and compare.
let [histogram_page_after, histogram_document_after,
histogram_docs_after, histogram_toplevel_docs_after] =
yield grabHistogramsFromContent(use_counter_middlefix, histogram_page_before);
await grabHistogramsFromContent(use_counter_middlefix, histogram_page_before);
is(histogram_page_after, histogram_page_before + 1,
"page counts for " + use_counter_middlefix + " after are correct");
is(histogram_document_after, histogram_document_before + 1,
@ -255,9 +255,9 @@ var check_use_counter_img = Task.async(function* (file, use_counter_middlefix) {
// one for the SVG image itself.
ok(histogram_docs_after >= histogram_docs_before + 2,
"document counts are correct");
});
};
var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix, xfail=false) {
var check_use_counter_direct = async function(file, use_counter_middlefix, xfail=false) {
info("checking " + file + " with histogram " + use_counter_middlefix);
let newTab = gBrowser.addTab( "about:blank");
@ -268,10 +268,10 @@ var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix
// interested in.
let [histogram_page_before, histogram_document_before,
histogram_docs_before, histogram_toplevel_docs_before] =
yield grabHistogramsFromContent(use_counter_middlefix);
await grabHistogramsFromContent(use_counter_middlefix);
gBrowser.selectedBrowser.loadURI(gHttpTestRoot + file);
yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
await ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
Cu.import("resource://gre/modules/PromiseUtils.jsm");
yield new Promise(resolve => {
let listener = () => {
@ -292,12 +292,12 @@ var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix
// The histograms only get recorded when the document actually gets
// destroyed, which might not have happened yet due to GC/CC effects, etc.
// Try to force document destruction.
yield waitForDestroyedDocuments();
await waitForDestroyedDocuments();
// Grab histograms again and compare.
let [histogram_page_after, histogram_document_after,
histogram_docs_after, histogram_toplevel_docs_after] =
yield grabHistogramsFromContent(use_counter_middlefix, histogram_page_before);
await grabHistogramsFromContent(use_counter_middlefix, histogram_page_before);
(xfail ? todo_is : is)(histogram_page_after, histogram_page_before + 1,
"page counts for " + use_counter_middlefix + " after are correct");
(xfail ? todo_is : is)(histogram_document_after, histogram_document_before + 1,
@ -306,4 +306,4 @@ var check_use_counter_direct = Task.async(function* (file, use_counter_middlefix
"top level document counts are correct");
ok(histogram_docs_after >= histogram_docs_before + 1,
"document counts are correct");
});
};

View File

@ -54,7 +54,6 @@ support-files =
bug819051.sjs
chrome/bug418986-1.js
copypaste.js
create_file_objects.js
delayedServerEvents.sjs
eventsource.resource
eventsource.resource^headers^
@ -151,11 +150,7 @@ support-files =
file_htmlserializer_ipv6.html
file_htmlserializer_ipv6_out.html
file_lock_orientation.html
file_mozfiledataurl_audio.ogg
file_mozfiledataurl_doc.html
file_mozfiledataurl_img.jpg
file_mozfiledataurl_inner.html
file_mozfiledataurl_text.txt
file_record_orientation.html
file_restrictedEventSource.sjs
file_simplecontentpolicy.js
@ -189,8 +184,6 @@ support-files =
file_xhtmlserializer_2_entw3c.xhtml
file_xhtmlserializer_2_latin1.xhtml
file_youtube_flash_embed.html
fileapi_chromeScript.js
fileutils.js
forRemoval.resource
forRemoval.resource^headers^
formReset.html
@ -208,7 +201,6 @@ support-files =
viewport_helpers.js
w3element_traversal.svg
wholeTexty-helper.xml
file_nonascii_blob_url.html
referrerHelper.js
img_referrer_testserver.sjs
file_audioLoop.html
@ -231,12 +223,9 @@ support-files =
mozbrowser_api_utils.js
websocket_helpers.js
websocket_tests.js
!/dom/html/test/form_submit_server.sjs
!/dom/security/test/cors/file_CrossSiteXHR_server.sjs
!/image/test/mochitest/blue.png
!/dom/xhr/tests/file_XHRSendData.sjs
script_bug1238440.js
file_blobURL_expiring.html
intersectionobserver_iframe.html
intersectionobserver_window.html
@ -268,9 +257,6 @@ tags = audiochannel
[test_audioNotificationWithEarlyPlay.html]
tags = audiochannel
[test_base.xhtml]
[test_blob_fragment_and_query.html]
[test_blobconstructor.html]
[test_blobURL_expiring.html]
[test_bug5141.html]
[test_bug28293.html]
[test_bug28293.xhtml]
@ -647,10 +633,6 @@ skip-if = toolkit == 'android' || e10s # showmodaldialog
[test_error.html]
[test_EventSource_redirects.html]
[test_explicit_user_agent.html]
[test_file_from_blob.html]
[test_file_negative_date.html]
[test_fileapi.html]
[test_fileapi_slice.html]
skip-if = (toolkit == 'android') # Android: Bug 775227
[test_getAttribute_after_createAttribute.html]
[test_getElementById.html]
@ -674,7 +656,6 @@ skip-if = (toolkit == 'android') # Android: Bug 775227
[test_integer_attr_with_leading_zero.html]
[test_intersectionobservers.html]
skip-if = true # Track Bug 1320704
[test_ipc_messagemanager_blob.html]
[test_link_prefetch.html]
skip-if = !e10s # Track Bug 1281415
[test_link_stylesheet.html]
@ -696,8 +677,6 @@ skip-if = (os != 'android') # meta-viewport tag support is mobile-only
[test_meta_viewport7.html]
skip-if = (os != 'android') # meta-viewport tag support is mobile-only
[test_mozbrowser_apis_blocked.html]
[test_mozfiledataurl.html]
skip-if = toolkit == 'android' #TIMED_OUT
[test_mozMatchesSelector.html]
[test_mutationobserver_anonymous.html]
[test_mutationobservers.html]
@ -718,7 +697,6 @@ tags = audiochannel
[test_NodeIterator_mutations_2.html]
[test_NodeIterator_mutations_3.html]
[test_nodelist_holes.html]
[test_nonascii_blob_url.html]
[test_noWebAudioNotification.html]
tags = audiochannel
[test_open_null_features.html]

View File

@ -66,7 +66,7 @@ function resetState() {
/**
* testing if anchor and area referrer attributes are honoured (1174913)
*/
var tests = (function() {
var tests = (function*() {
// enable referrer attribute
yield SpecialPowers.pushPrefEnv({"set": [['network.http.enablePerElementReferrer', true]]}, advance);
@ -97,6 +97,6 @@ var tests = (function() {
};
};
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
})();
// complete.
SimpleTest.finish();
})();

View File

@ -28,11 +28,7 @@ var observer = {
};
function continueTest() {
try {
generator.next();
} catch (e if e instanceof StopIteration) {
error("Stop test because of exception!");
}
generator.next();
}
function audioPlayingStart() {
@ -58,16 +54,16 @@ function finish() {
SimpleTest.finish();
}
function runTest() {
function* runTest() {
yield audioPlayingStart();
yield audioBecomeSilentDuringPlaying();
yield finish();
finish();
}
continueTest();
</script>
</body>
</html>
</html>

View File

@ -30,11 +30,7 @@ var observer = {
};
function continueTest() {
try {
generator.next();
} catch (e if e instanceof StopIteration) {
error("Stop test because of exception!");
}
generator.next();
}
function playOscillatorNode() {
@ -86,18 +82,18 @@ function startAudioContext() {
}
}
function runTest() {
function* runTest() {
yield startAudioContext();
yield audioPlayingStart();
yield audioBecomeSilentDuringPlaying();
yield finish();
finish();
}
continueTest();
</script>
</body>
</html>
</html>

View File

@ -20,7 +20,7 @@ var advance = function() { tests.next(); };
/**
* testing legacy support for origin-when-crossorigin (1163743)
*/
var tests = (function() {
var tests = (function*() {
var iframe = document.getElementById("testframe");
const sjs = "/tests/dom/base/test/bug704320.sjs?action=generate-policy-test";
@ -29,8 +29,8 @@ var tests = (function() {
yield iframe.src = sjs + "&policy=" + escape(' origin-when-crossorigin');
yield checkIndividualResults("origin-when-cross-origin", ["origin", "full"]);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

View File

@ -21,7 +21,7 @@ var advance = function() { tests.next(); };
* testing if policy is overwritten if there are two meta statements (1165501)
* XXX: would be nice to test this with CSP and meta as well
*/
var tests = (function() {
var tests = (function*() {
var iframe = document.getElementById("testframe");
const sjs = "/tests/dom/base/test/bug704320.sjs?action=generate-policy-test";
@ -36,8 +36,8 @@ var tests = (function() {
yield checkIndividualResults("no-referrer then default", ["full"]);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

View File

@ -17,10 +17,10 @@ var gen = runTest();
addLoadEvent(function() { gen.next(); });
function runTest() {
function* runTest() {
var iframe = $('iframe');
iframe.onerror = function() { gen.send("error"); };
iframe.onload = function() { gen.send("load"); };
iframe.onerror = function() { gen.next("error"); };
iframe.onload = function() { gen.next("load"); };
iframe.src = "data:text/plain,hello";
is((yield), "load", "plaintext data");
@ -34,8 +34,6 @@ function runTest() {
//is((yield), "error", "invalid http");
SimpleTest.finish();
yield undefined;
}
</script>

View File

@ -15,11 +15,11 @@
<script class="testbody" type="application/javascript;version=1.8">
SimpleTest.waitForExplicitFinish();
window.addEventListener("message", function(e) { gen.send(e.data) }, false);
window.addEventListener("message", function(e) { gen.next(e.data) }, false);
var gen = runTest();
function runTest() {
function* runTest() {
var iframe = $('iframe');
iframe.src = "http://noxul.example.com/tests/dom/base/test/file_bug590870.html";
is((yield), true, "shouldn't be able to create XUL elements");
@ -28,7 +28,6 @@ function runTest() {
is((yield), false, "should be able to create XUL elements");
SimpleTest.finish();
yield undefined;
}
</script>

View File

@ -51,14 +51,14 @@ var testFrame = document.getElementById("iframe-test");
refFrame.addEventListener("load", function() {
testFrame.addEventListener("load", function() {
try {
tests.next();
let {done} = tests.next();
if (!done) {
ok(compareSnapshots(snapshotWindow(testFrame.contentWindow),
snapshotWindow(refFrame.contentWindow), true)[0],
"bidi is not detected correctly");
testFrame.contentWindow.location.reload();
} catch (err if err instanceof StopIteration) {
} else {
SimpleTest.finish();
}
}, false);
@ -78,7 +78,7 @@ function strMult(aStr, aNumber) {
return strMult(aStr, aNumber - 1) + aStr;
}
function runTests () {
function* runTests () {
var ltr = "", prefix = null;
var refContainer = refFrame.contentDocument.getElementById('content');
var testContainer, textNode;

View File

@ -41,7 +41,7 @@ var advance = function() { tests.next(); };
* This is the main test routine -- serialized by use of a generator.
* It performs all tests in sequence using in the same iframe.
*/
var tests = (function() {
var tests = (function*() {
SimpleTest.requestLongerTimeout(4);
var iframe = document.getElementById("testframe");
iframe.onload = function() {
@ -57,8 +57,8 @@ var tests = (function() {
yield checkExpectedGlobalResults();
}
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

View File

@ -22,7 +22,7 @@ var advance = function() { tests.next(); };
* It resets the counter, then performs two tests in sequence using
* the same iframe.
*/
var tests = (function() {
var tests = (function*() {
var iframe = document.getElementById("testframe");
const sjs = "/tests/dom/base/test/bug704320.sjs?action=generate-policy-test";
@ -89,8 +89,8 @@ var tests = (function() {
yield iframe.src = sjs + "&policy=" + escape('\f OrigIn');
yield checkIndividualResults("origin case insensitive", ["origin"]);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

View File

@ -22,7 +22,7 @@ var advance = function() { tests.next(); };
* It resets the counter, then performs two tests in sequence using
* the same iframe.
*/
var tests = (function() {
var tests = (function*() {
var iframe = document.getElementById("testframe");
const sjs = "/tests/dom/base/test/bug704320.sjs?action=generate-policy-test";
@ -30,8 +30,8 @@ var tests = (function() {
yield iframe.src = sjs + "&policy=" + escape(' \f\r\n\t ');
yield checkIndividualResults("whitespace only policy", ["full"]);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

View File

@ -22,7 +22,7 @@ var advance = function() { tests.next(); };
* It resets the counter, then performs two tests in sequence using
* the same iframe.
*/
var tests = (function() {
var tests = (function*() {
var iframe = document.getElementById("testframe");
// reset the counter
@ -47,8 +47,8 @@ var tests = (function() {
// check the second test
yield checkResults(finalizePreloadReuse);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
// Helper functions below.

View File

@ -78,7 +78,7 @@ function resetState() {
* It resets the counter, then performs two tests in sequence using
* the same iframe.
*/
var tests = (function() {
var tests = (function*() {
var iframe = document.getElementById("testframe");
var sjs = "/tests/dom/base/test/referrer_change_server.sjs?action=generate-policy-test";
@ -114,8 +114,8 @@ var tests = (function() {
yield iframe.src = sjs + "&policy=" + escape('unsafe-url') + "&name=" + name + "&newPolicy=" + escape('no-referrer');
yield checkIndividualResults("no-referrer (changed) with unsafe-url first", ["none"], [name+'no-referrer']);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

View File

@ -82,7 +82,7 @@ function resetState() {
/**
* testing if img referrer attribute is honoured (1165501)
*/
var tests = (function() {
var tests = (function*() {
// enable referrer attribute
yield SpecialPowers.pushPrefEnv({"set": [['network.http.enablePerElementReferrer', true]]}, advance);
@ -174,8 +174,8 @@ var tests = (function() {
yield iframe.src = sjs + "&imgPolicy=" + escape('default') + "&policy=" + escape('unsafe-url') + "&name=" + name;
yield checkIndividualResults("unsafe-url in meta, default in img", ["full"], [name]);
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
// complete.
SimpleTest.finish();
})();
</script>

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