Merge mozilla-central to autoland

This commit is contained in:
arthur.iakab 2018-03-14 12:16:00 +02:00
commit 6153368440
299 changed files with 55867 additions and 46367 deletions

15
Cargo.lock generated
View File

@ -738,6 +738,7 @@ dependencies = [
"nserror 0.1.0",
"nsstring 0.1.0",
"prefs_parser 0.0.1",
"rsdparsa_capi 0.1.0",
"rust_url_capi 0.0.1",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
"u2fhid 0.1.0",
@ -1449,6 +1450,20 @@ dependencies = [
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rsdparsa"
version = "0.1.0"
[[package]]
name = "rsdparsa_capi"
version = "0.1.0"
dependencies = [
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"nserror 0.1.0",
"rsdparsa 0.1.0",
]
[[package]]
name = "runloop"
version = "0.1.0"

View File

@ -725,7 +725,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] =
states::LINKED
},
{ // list
&nsGkAtoms::list,
&nsGkAtoms::list_,
roles::LIST,
kUseMapRole,
eNoValue,
@ -1064,7 +1064,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] =
kNoReqStates
},
{ // switch
&nsGkAtoms::_switch,
&nsGkAtoms::svgSwitch,
roles::SWITCH,
kUseMapRole,
eNoValue,

View File

@ -90,7 +90,7 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState)
static const EnumTypeData data = {
nsGkAtoms::aria_autocomplete,
{ &nsGkAtoms::inlinevalue,
&nsGkAtoms::list,
&nsGkAtoms::list_,
&nsGkAtoms::both, nullptr },
{ states::SUPPORTS_AUTOCOMPLETION,
states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION,

View File

@ -33,11 +33,11 @@ filters::GetSelectable(Accessible* aAccessible)
uint32_t
filters::GetRow(Accessible* aAccessible)
{
a11y::role role = aAccessible->Role();
if (role == roles::ROW)
if (aAccessible->IsTableRow())
return eMatch | eSkipSubtree;
// Look for rows inside rowgroup.
a11y::role role = aAccessible->Role();
if (role == roles::GROUPING)
return eSkip;

View File

@ -406,7 +406,7 @@ HTMLTextFieldAccessible::NativeState()
}
// Expose autocomplete state if it has associated autocomplete list.
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list))
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list_))
return state | states::SUPPORTS_AUTOCOMPLETION | states::HASPOPUP;
// Ordinal XUL textboxes don't support autocomplete.

View File

@ -67,6 +67,7 @@ skip-if = (os == 'win' && ccov) # Bug 1423667
subsuite = clipboard
[browser_drag_bookmarks_on_toolbar.js]
[browser_enable_toolbar_sidebar.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_forgetthissite_single.js]
[browser_history_sidebar_search.js]
[browser_library_batch_delete.js]
@ -88,6 +89,8 @@ skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_open_leak.js]
[browser_library_openFlatContainer.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_open_bookmark.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_panel_leak.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_search.js]

View File

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* Test that the a bookmark can be opened from the Library by mouse double click.
*/
"use strict";
const TEST_URL = "about:buildconfig";
add_task(async function test_open_bookmark_from_library() {
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: TEST_URL,
title: TEST_URL,
});
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
let gLibrary = await promiseLibrary("UnfiledBookmarks");
registerCleanupFunction(async function() {
await promiseLibraryClosed(gLibrary);
await PlacesUtils.bookmarks.eraseEverything();
await BrowserTestUtils.removeTab(tab);
});
let bmLibrary = gLibrary.ContentTree.view.view.nodeForTreeIndex(0);
Assert.equal(bmLibrary.title, bm.title, "Found bookmark in the right pane");
gLibrary.ContentTree.view.selectNode(bmLibrary);
synthesizeClickOnSelectedTreeCell(gLibrary.ContentTree.view,
{ clickCount: 2 });
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, TEST_URL);
Assert.ok(true, "Expected tab was loaded");
});

View File

@ -216,10 +216,8 @@ var gPermissionManager = {
this._type = aParams.permissionType;
this._manageCapability = aParams.manageCapability;
var permissionsText = document.getElementById("permissionsText");
while (permissionsText.hasChildNodes())
permissionsText.firstChild.remove();
permissionsText.appendChild(document.createTextNode(aParams.introText));
let permissionsText = document.getElementById("permissionsText");
permissionsText.textContent = aParams.introText;
document.title = aParams.windowTitle;

View File

@ -1,13 +1,12 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 19.2
Comparison: https://github.com/devtools-html/debugger.html/compare/release-19-1...release-19-2
Version 20.0
Comparison: https://github.com/devtools-html/debugger.html/compare/release-19-2...release-20
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.0
- babel-preset-react @6.24.1
- react @16.2.0
- react-dom @16.2.0
- webpack @3.11.0
- react @15.6.2
- react-dom @15.6.2
- webpack @3.10.0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -162,15 +162,15 @@ add_task(async function() {
// The call-based ones work, but the single-identifier ones do not.
await breakpointScopes(dbg, "imported-bindings", { line: 17, column: 2 }, [
"Module",
["aDefault", "(unmapped)"],
["aDefault", '"a-default"'],
["aDefault2", '"a-default2"'],
["aDefault3", "(unmapped)"],
["anAliased", "(unmapped)"],
["aDefault3", '"a-default3"'],
["anAliased", '"an-original"'],
["anAliased2", '"an-original2"'],
["anAliased3", "(unmapped)"],
["aNamed", "(unmapped)"],
["anAliased3", '"an-original3"'],
["aNamed", '"a-named"'],
["aNamed2", '"a-named2"'],
["aNamed3", "(unmapped)"],
["aNamed3", '"a-named3"'],
["aNamespace", "{\u2026}"],
["aNamespace2", "{\u2026}"],
["aNamespace3", "{\u2026}"],

View File

@ -1,56 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const Services = require("Services");
const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { connect } = require("devtools/client/shared/vendor/react-redux");
const { LocalizationHelper } = require("devtools/shared/l10n");
const Accordion =
createFactory(require("devtools/client/inspector/layout/components/Accordion"));
const BoxModel = createFactory(require("./BoxModel"));
const Types = require("../types");
const BOXMODEL_STRINGS_URI = "devtools/client/locales/boxmodel.properties";
const BOXMODEL_L10N = new LocalizationHelper(BOXMODEL_STRINGS_URI);
const BOXMODEL_OPENED_PREF = "devtools.computed.boxmodel.opened";
class BoxModelApp extends PureComponent {
static get propTypes() {
return {
boxModel: PropTypes.shape(Types.boxModel).isRequired,
setSelectedNode: PropTypes.func.isRequired,
showBoxModelProperties: PropTypes.bool.isRequired,
onHideBoxModelHighlighter: PropTypes.func.isRequired,
onShowBoxModelEditor: PropTypes.func.isRequired,
onShowBoxModelHighlighter: PropTypes.func.isRequired,
onShowBoxModelHighlighterForNode: PropTypes.func.isRequired,
onToggleGeometryEditor: PropTypes.func.isRequired,
};
}
render() {
return Accordion({
items: [
{
header: BOXMODEL_L10N.getStr("boxmodel.title"),
component: BoxModel,
componentProps: this.props,
opened: Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
onToggled: () => {
let opened = Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF);
Services.prefs.setBoolPref(BOXMODEL_OPENED_PREF, !opened);
}
}
]
});
}
}
module.exports = connect(state => state)(BoxModelApp);

View File

@ -6,7 +6,6 @@
DevToolsModules(
'BoxModel.js',
'BoxModelApp.js',
'BoxModelEditable.js',
'BoxModelInfo.js',
'BoxModelMain.js',

View File

@ -13,7 +13,6 @@ support-files =
!/devtools/client/shared/test/test-actor-registry.js
[browser_boxmodel.js]
[browser_boxmodel_computed-accordion-state.js]
[browser_boxmodel_edit-position-visible-position-change.js]
[browser_boxmodel_editablemodel.js]
[browser_boxmodel_editablemodel_allproperties.js]

View File

@ -157,27 +157,27 @@ add_task(function* () {
let html = "<style>" + style + "</style><div></div>";
yield addTab("data:text/html," + encodeURIComponent(html));
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield selectNode("div", inspector);
yield testInitialValues(inspector, view);
yield testChangingValues(inspector, view, testActor);
yield testInitialValues(inspector, boxmodel);
yield testChangingValues(inspector, boxmodel, testActor);
});
function* testInitialValues(inspector, view) {
function* testInitialValues(inspector, boxmodel) {
info("Test that the initial values of the box model are correct");
let viewdoc = view.document;
let doc = boxmodel.document;
for (let i = 0; i < res1.length; i++) {
let elt = viewdoc.querySelector(res1[i].selector);
let elt = doc.querySelector(res1[i].selector);
is(elt.textContent, res1[i].value,
res1[i].selector + " has the right value.");
}
}
function* testChangingValues(inspector, view, testActor) {
function* testChangingValues(inspector, boxmodel, testActor) {
info("Test that changing the document updates the box model");
let viewdoc = view.document;
let doc = boxmodel.document;
let onUpdated = waitForUpdate(inspector);
yield testActor.setAttribute("div", "style",
@ -185,7 +185,7 @@ function* testChangingValues(inspector, view, testActor) {
yield onUpdated;
for (let i = 0; i < res2.length; i++) {
let elt = viewdoc.querySelector(res2[i].selector);
let elt = doc.querySelector(res2[i].selector);
is(elt.textContent, res2[i].value,
res2[i].selector + " has the right value after style update.");
}

View File

@ -1,89 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that the box model's accordion state is persistent through hide/show in the
// computed view.
// There are shutdown issues for which multiple rejections are left uncaught.
// See bug 1018184 for resolving these issues.
const { PromiseTestUtils } = scopedCuImport("resource://testing-common/PromiseTestUtils.jsm");
PromiseTestUtils.whitelistRejectionsGlobally(/Connection closed/);
const TEST_URI = `
<style>
#div1 {
margin: 10px;
padding: 3px;
}
</style>
<div id="div1"></div>
`;
const BOXMODEL_OPENED_PREF = "devtools.computed.boxmodel.opened";
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let { inspector, view, toolbox } = yield openBoxModelView();
let { document: doc } = view;
yield testAccordionStateAfterClickingHeader(doc);
yield testAccordionStateAfterSwitchingSidebars(inspector, doc);
yield testAccordionStateAfterReopeningComputedView(toolbox);
Services.prefs.clearUserPref(BOXMODEL_OPENED_PREF);
});
function* testAccordionStateAfterClickingHeader(doc) {
let header = doc.querySelector("#computed-container .box-model-pane ._header");
let bContent = doc.querySelector("#computed-container .box-model-pane ._content");
info("Checking initial state of the box model panel.");
is(bContent.style.display, "block", "The box model panel content is 'display: block'.");
ok(Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
`${BOXMODEL_OPENED_PREF} is pref on by default.`);
info("Clicking the box model header to hide the box model panel.");
header.click();
info("Checking the new state of the box model panel.");
is(bContent.style.display, "none", "The box model panel content is 'display: none'.");
ok(!Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
`${BOXMODEL_OPENED_PREF} is pref off.`);
}
function* testAccordionStateAfterSwitchingSidebars(inspector, doc) {
info("Checking the box model accordion state is persistent after switching sidebars.");
let bContent = doc.querySelector("#computed-container .box-model-pane ._content");
info("Selecting the layout view.");
inspector.sidebar.select("layoutview");
info("Selecting the computed view.");
inspector.sidebar.select("computedview");
info("Checking the state of the box model panel.");
is(bContent.style.display, "none", "The box model panel content is 'display: none'.");
ok(!Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
`${BOXMODEL_OPENED_PREF} is pref off.`);
}
function* testAccordionStateAfterReopeningComputedView(toolbox) {
info("Checking the box model accordion state is persistent after closing and "
+ "re-opening the layout view.");
info("Closing the toolbox.");
yield toolbox.destroy();
info("Re-opening the layout view.");
let { view } = yield openBoxModelView();
let { document: doc } = view;
let bContent = doc.querySelector("#computed-container .box-model-pane ._content");
info("Checking the state of the box model panel.");
ok(!bContent, "The box model panel content is not rendered.");
ok(!Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
`${BOXMODEL_OPENED_PREF} is pref off.`);
}

View File

@ -18,26 +18,27 @@ const TEST_URI = `
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
yield selectNode("#mydiv", inspector);
let editPositionButton = view.document.querySelector(".layout-geometry-editor");
let editPositionButton = boxmodel.document.querySelector(".layout-geometry-editor");
ok(isNodeVisible(editPositionButton), "Edit Position button is visible initially");
let positionLeftTextbox = view.document.querySelector(
let positionLeftTextbox = boxmodel.document.querySelector(
".boxmodel-editable[title=position-left]"
);
ok(isNodeVisible(positionLeftTextbox), "Position-left edit box exists");
info("Change the value of position-left and submit");
let onUpdate = waitForUpdate(inspector);
EventUtils.synthesizeMouseAtCenter(positionLeftTextbox, {}, view.document.defaultView);
EventUtils.synthesizeKey("8", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeMouseAtCenter(positionLeftTextbox, {},
boxmodel.document.defaultView);
EventUtils.synthesizeKey("8", {}, boxmodel.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
yield onUpdate;
editPositionButton = view.document.querySelector(".layout-geometry-editor");
editPositionButton = boxmodel.document.querySelector(".layout-geometry-editor");
ok(isNodeVisible(editPositionButton),
"Edit Position button is still visible after layout change");
});

View File

@ -18,17 +18,21 @@ const TEST_URI = "<style>" +
"<div id='div3'></div><div id='div4'></div>";
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openBoxModelView();
// Make sure the toolbox is tall enough to have empty space below the
// boxmodel-container.
yield pushPref("devtools.toolbox.footer.height", 500);
yield testEditingMargins(inspector, view, testActor);
yield testKeyBindings(inspector, view, testActor);
yield testEscapeToUndo(inspector, view, testActor);
yield testDeletingValue(inspector, view, testActor);
yield testRefocusingOnClick(inspector, view, testActor);
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield testEditingMargins(inspector, boxmodel, testActor);
yield testKeyBindings(inspector, boxmodel, testActor);
yield testEscapeToUndo(inspector, boxmodel, testActor);
yield testDeletingValue(inspector, boxmodel, testActor);
yield testRefocusingOnClick(inspector, boxmodel, testActor);
});
function* testEditingMargins(inspector, view, testActor) {
function* testEditingMargins(inspector, boxmodel, testActor) {
info("Test that editing margin dynamically updates the document, pressing " +
"escape cancels the changes");
@ -36,21 +40,21 @@ function* testEditingMargins(inspector, view, testActor) {
"Should be no margin-top on the element.");
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-margin.boxmodel-top > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "5px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("3", {}, view.document.defaultView);
EventUtils.synthesizeKey("3", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "margin-top")), "3px",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_ESCAPE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "margin-top")), "",
@ -58,7 +62,7 @@ function* testEditingMargins(inspector, view, testActor) {
is(span.textContent, 5, "Should have the right value in the box model.");
}
function* testKeyBindings(inspector, view, testActor) {
function* testKeyBindings(inspector, boxmodel, testActor) {
info("Test that arrow keys work correctly and pressing enter commits the " +
"changes");
@ -66,42 +70,42 @@ function* testKeyBindings(inspector, view, testActor) {
"Should be no margin-top on the element.");
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-margin.boxmodel-left > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-left > span");
is(span.textContent, 10, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "10px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_UP", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_UP", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "11px", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "margin-left")), "11px",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_DOWN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_DOWN", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "10px", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "margin-left")), "10px",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_UP", { shiftKey: true }, view.document.defaultView);
EventUtils.synthesizeKey("VK_UP", { shiftKey: true }, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "20px", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "margin-left")), "20px",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div1", "margin-left")), "20px",
"Should be the right margin-top on the element.");
is(span.textContent, 20, "Should have the right value in the box model.");
}
function* testEscapeToUndo(inspector, view, testActor) {
function* testEscapeToUndo(inspector, boxmodel, testActor) {
info("Test that deleting the value removes the property but escape undoes " +
"that");
@ -109,22 +113,22 @@ function* testEscapeToUndo(inspector, view, testActor) {
"Should be the right margin-top on the element.");
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-margin.boxmodel-left > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-left > span");
is(span.textContent, 20, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "20px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_DELETE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_DELETE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "margin-left")), "",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_ESCAPE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "margin-left")), "20px",
@ -132,7 +136,7 @@ function* testEscapeToUndo(inspector, view, testActor) {
is(span.textContent, 20, "Should have the right value in the box model.");
}
function* testDeletingValue(inspector, view, testActor) {
function* testDeletingValue(inspector, boxmodel, testActor) {
info("Test that deleting the value removes the property");
yield setStyle(testActor, "#div1", "marginRight", "15px");
@ -140,53 +144,53 @@ function* testDeletingValue(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-margin.boxmodel-right > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-right > span");
is(span.textContent, 15, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "15px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_DELETE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_DELETE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "margin-right")), "",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div1", "margin-right")), "",
"Should be the right margin-top on the element.");
is(span.textContent, 10, "Should have the right value in the box model.");
}
function* testRefocusingOnClick(inspector, view, testActor) {
function* testRefocusingOnClick(inspector, boxmodel, testActor) {
info("Test that clicking in the editor input does not remove focus");
yield selectNode("#div4", inspector);
let span = view.document.querySelector(".boxmodel-margin.boxmodel-top > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 1, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
info("Click in the already opened editor input");
EventUtils.synthesizeMouseAtCenter(editor, {}, view.document.defaultView);
is(editor, view.document.activeElement,
EventUtils.synthesizeMouseAtCenter(editor, {}, boxmodel.document.defaultView);
is(editor, boxmodel.document.activeElement,
"Inplace editor input should still have focus.");
info("Check the input can still be used as expected");
EventUtils.synthesizeKey("VK_UP", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_UP", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "2px", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div4", "margin-top")), "2px",
"Should have updated the margin.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div4", "margin-top")), "2px",
"Should be the right margin-top on the element.");

View File

@ -16,15 +16,15 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield testEditing(inspector, view, testActor);
yield testEditingAndCanceling(inspector, view, testActor);
yield testDeleting(inspector, view, testActor);
yield testDeletingAndCanceling(inspector, view, testActor);
yield testEditing(inspector, boxmodel, testActor);
yield testEditingAndCanceling(inspector, boxmodel, testActor);
yield testDeleting(inspector, boxmodel, testActor);
yield testDeletingAndCanceling(inspector, boxmodel, testActor);
});
function* testEditing(inspector, view, testActor) {
function* testEditing(inspector, boxmodel, testActor) {
info("When all properties are set on the node editing one should work");
yield setStyle(testActor, "#div1", "padding", "5px");
@ -32,29 +32,29 @@ function* testEditing(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-padding.boxmodel-bottom > span");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-bottom > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "5px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("7", {}, view.document.defaultView);
EventUtils.synthesizeKey("7", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "7", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "padding-bottom")), "7px",
"Should have updated the padding");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div1", "padding-bottom")), "7px",
"Should be the right padding.");
is(span.textContent, 7, "Should have the right value in the box model.");
}
function* testEditingAndCanceling(inspector, view, testActor) {
function* testEditingAndCanceling(inspector, boxmodel, testActor) {
info("When all properties are set on the node editing one and then " +
"cancelling with ESCAPE should work");
@ -63,22 +63,22 @@ function* testEditingAndCanceling(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-padding.boxmodel-left > span");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "5px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("8", {}, view.document.defaultView);
EventUtils.synthesizeKey("8", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "8", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "padding-left")), "8px",
"Should have updated the padding");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_ESCAPE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "padding-left")), "5px",
@ -86,34 +86,34 @@ function* testEditingAndCanceling(inspector, view, testActor) {
is(span.textContent, 5, "Should have the right value in the box model.");
}
function* testDeleting(inspector, view, testActor) {
function* testDeleting(inspector, boxmodel, testActor) {
info("When all properties are set on the node deleting one should work");
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-padding.boxmodel-left > span");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "5px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_DELETE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_DELETE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "padding-left")), "",
"Should have updated the padding");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div1", "padding-left")), "",
"Should be the right padding.");
is(span.textContent, 3, "Should have the right value in the box model.");
}
function* testDeletingAndCanceling(inspector, view, testActor) {
function* testDeletingAndCanceling(inspector, boxmodel, testActor) {
info("When all properties are set on the node deleting one then cancelling " +
"should work");
@ -122,22 +122,22 @@ function* testDeletingAndCanceling(inspector, view, testActor) {
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-padding.boxmodel-left > span");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-left > span");
is(span.textContent, 5, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "5px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_DELETE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_DELETE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "padding-left")), "",
"Should have updated the padding");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_ESCAPE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "padding-left")), "5px",

View File

@ -21,54 +21,54 @@ add_task(function* () {
yield pushPref("devtools.toolbox.footer.height", 500);
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
yield selectNode("#div1", inspector);
yield testClickingOutsideEditor(view);
yield testClickingBelowContainer(view);
yield testClickingOutsideEditor(boxmodel);
yield testClickingBelowContainer(boxmodel);
});
function* testClickingOutsideEditor(view) {
function* testClickingOutsideEditor(boxmodel) {
info("Test that clicking outside the editor blurs it");
let span = view.document.querySelector(".boxmodel-margin.boxmodel-top > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 10, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
info("Click next to the opened editor input.");
let onBlur = once(editor, "blur");
let rect = editor.getBoundingClientRect();
EventUtils.synthesizeMouse(editor, rect.width + 10, rect.height / 2, {},
view.document.defaultView);
boxmodel.document.defaultView);
yield onBlur;
is(view.document.querySelector(".styleinspector-propertyeditor"), null,
is(boxmodel.document.querySelector(".styleinspector-propertyeditor"), null,
"Inplace editor has been removed.");
}
function* testClickingBelowContainer(view) {
function* testClickingBelowContainer(boxmodel) {
info("Test that clicking below the box-model container blurs it");
let span = view.document.querySelector(".boxmodel-margin.boxmodel-top > span");
let span = boxmodel.document.querySelector(".boxmodel-margin.boxmodel-top > span");
is(span.textContent, 10, "Should have the right value in the box model.");
info("Test that clicking below the boxmodel-container blurs the opened editor");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
let onBlur = once(editor, "blur");
let container = view.document.querySelector(".boxmodel-container");
let container = boxmodel.document.querySelector(".boxmodel-container");
// Using getBoxQuads here because getBoundingClientRect (and therefore synthesizeMouse)
// use an erroneous height of ~50px for the boxmodel-container.
let bounds = container.getBoxQuads({relativeTo: view.doc})[0].bounds;
let bounds = container.getBoxQuads({relativeTo: boxmodel.document})[0].bounds;
EventUtils.synthesizeMouseAtPoint(
bounds.left + 10,
bounds.top + bounds.height + 10,
{}, view.document.defaultView);
{}, boxmodel.document.defaultView);
yield onBlur;
is(view.document.querySelector(".styleinspector-propertyeditor"), null,
is(boxmodel.document.querySelector(".styleinspector-propertyeditor"), null,
"Inplace editor has been removed.");
}

View File

@ -16,7 +16,7 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
is((yield getStyle(testActor, "#div1", "border-top-width")), "",
"Should have the right border");
@ -24,15 +24,15 @@ add_task(function* () {
"Should have the right border");
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-border.boxmodel-top > span");
let span = boxmodel.document.querySelector(".boxmodel-border.boxmodel-top > span");
is(span.textContent, 0, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "0", "Should have the right value in the editor.");
EventUtils.synthesizeKey("1", {}, view.document.defaultView);
EventUtils.synthesizeKey("1", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "1", "Should have the right value in the editor.");
@ -41,7 +41,7 @@ add_task(function* () {
is((yield getStyle(testActor, "#div1", "border-top-style")), "solid",
"Should have the right border");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_ESCAPE", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "border-top-width")), "",

View File

@ -22,24 +22,25 @@ const TEST_URI =
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield selectNode(".test", inspector);
// No margin-top defined.
info("Test that margins are not impacted by a pseudo element");
is((yield getStyle(testActor, ".test", "margin-top")), "", "margin-top is correct");
yield checkValueInBoxModel(".boxmodel-margin.boxmodel-top", "0", view.document);
yield checkValueInBoxModel(".boxmodel-margin.boxmodel-top", "0", boxmodel.document);
// No padding-top defined.
info("Test that paddings are not impacted by a pseudo element");
is((yield getStyle(testActor, ".test", "padding-top")), "", "padding-top is correct");
yield checkValueInBoxModel(".boxmodel-padding.boxmodel-top", "0", view.document);
yield checkValueInBoxModel(".boxmodel-padding.boxmodel-top", "0", boxmodel.document);
// Width should be driven by the parent div.
info("Test that dimensions are not impacted by a pseudo element");
is((yield getStyle(testActor, ".test", "width")), "", "width is correct");
yield checkValueInBoxModel(".boxmodel-content.boxmodel-width", "200", view.document);
yield checkValueInBoxModel(".boxmodel-content.boxmodel-width", "200",
boxmodel.document);
});
function* checkValueInBoxModel(selector, expectedValue, doc) {

View File

@ -17,95 +17,95 @@ const TEST_URI = "<style>" +
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield testUnits(inspector, view, testActor);
yield testValueComesFromStyleRule(inspector, view, testActor);
yield testShorthandsAreParsed(inspector, view, testActor);
yield testUnits(inspector, boxmodel, testActor);
yield testValueComesFromStyleRule(inspector, boxmodel, testActor);
yield testShorthandsAreParsed(inspector, boxmodel, testActor);
});
function* testUnits(inspector, view, testActor) {
function* testUnits(inspector, boxmodel, testActor) {
info("Test that entering units works");
is((yield getStyle(testActor, "#div1", "padding-top")), "",
"Should have the right padding");
yield selectNode("#div1", inspector);
let span = view.document.querySelector(".boxmodel-padding.boxmodel-top > span");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-top > span");
is(span.textContent, 3, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "3px", "Should have the right value in the editor.");
EventUtils.synthesizeKey("1", {}, view.document.defaultView);
EventUtils.synthesizeKey("1", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
EventUtils.synthesizeKey("e", {}, view.document.defaultView);
EventUtils.synthesizeKey("e", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is((yield getStyle(testActor, "#div1", "padding-top")), "",
"An invalid value is handled cleanly");
EventUtils.synthesizeKey("m", {}, view.document.defaultView);
EventUtils.synthesizeKey("m", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "1em", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div1", "padding-top")),
"1em", "Should have updated the padding.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div1", "padding-top")), "1em",
"Should be the right padding.");
is(span.textContent, 16, "Should have the right value in the box model.");
}
function* testValueComesFromStyleRule(inspector, view, testActor) {
function* testValueComesFromStyleRule(inspector, boxmodel, testActor) {
info("Test that we pick up the value from a higher style rule");
is((yield getStyle(testActor, "#div2", "border-bottom-width")), "",
"Should have the right border-bottom-width");
yield selectNode("#div2", inspector);
let span = view.document.querySelector(".boxmodel-border.boxmodel-bottom > span");
let span = boxmodel.document.querySelector(".boxmodel-border.boxmodel-bottom > span");
is(span.textContent, 16, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "1em", "Should have the right value in the editor.");
EventUtils.synthesizeKey("0", {}, view.document.defaultView);
EventUtils.synthesizeKey("0", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "0", "Should have the right value in the editor.");
is((yield getStyle(testActor, "#div2", "border-bottom-width")), "0px",
"Should have updated the border.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div2", "border-bottom-width")), "0px",
"Should be the right border-bottom-width.");
is(span.textContent, 0, "Should have the right value in the box model.");
}
function* testShorthandsAreParsed(inspector, view, testActor) {
function* testShorthandsAreParsed(inspector, boxmodel, testActor) {
info("Test that shorthand properties are parsed correctly");
is((yield getStyle(testActor, "#div3", "padding-right")), "",
"Should have the right padding");
yield selectNode("#div3", inspector);
let span = view.document.querySelector(".boxmodel-padding.boxmodel-right > span");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-right > span");
is(span.textContent, 32, "Should have the right value in the box model.");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
ok(editor, "Should have opened the editor.");
is(editor.value, "2em", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
is((yield getStyle(testActor, "#div3", "padding-right")), "",
"Should be the right padding.");

View File

@ -19,7 +19,7 @@ var highlightedNodeFront, highlighterOptions;
add_task(async function() {
await addTab(TEST_URL);
let {toolbox, inspector, view} = await openBoxModelView();
let {toolbox, inspector, boxmodel} = await openLayoutView();
await selectNode("div", inspector);
// Mock the highlighter by replacing the showBoxModel method.
@ -28,17 +28,17 @@ add_task(async function() {
highlighterOptions = options;
};
let elt = view.document.querySelector(".boxmodel-margins");
await testGuideOnLayoutHover(elt, "margin", inspector, view);
let elt = boxmodel.document.querySelector(".boxmodel-margins");
await testGuideOnLayoutHover(elt, "margin", inspector);
elt = view.document.querySelector(".boxmodel-borders");
await testGuideOnLayoutHover(elt, "border", inspector, view);
elt = boxmodel.document.querySelector(".boxmodel-borders");
await testGuideOnLayoutHover(elt, "border", inspector);
elt = view.document.querySelector(".boxmodel-paddings");
await testGuideOnLayoutHover(elt, "padding", inspector, view);
elt = boxmodel.document.querySelector(".boxmodel-paddings");
await testGuideOnLayoutHover(elt, "padding", inspector);
elt = view.document.querySelector(".boxmodel-content");
await testGuideOnLayoutHover(elt, "content", inspector, view);
elt = boxmodel.document.querySelector(".boxmodel-content");
await testGuideOnLayoutHover(elt, "content", inspector);
});
async function testGuideOnLayoutHover(elt, expectedRegion, inspector) {

View File

@ -17,104 +17,104 @@ const TEST_URI = `
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
yield selectNode("div", inspector);
yield testInitialFocus(inspector, view);
yield testChangingLevels(inspector, view);
yield testTabbingWrapAround(inspector, view);
yield testChangingLevelsByClicking(inspector, view);
yield testInitialFocus(inspector, boxmodel);
yield testChangingLevels(inspector, boxmodel);
yield testTabbingWrapAround(inspector, boxmodel);
yield testChangingLevelsByClicking(inspector, boxmodel);
});
function* testInitialFocus(inspector, view) {
info("Test that the focus is on margin layout.");
let viewdoc = view.document;
let boxmodel = viewdoc.querySelector(".boxmodel-container");
boxmodel.focus();
function* testInitialFocus(inspector, boxmodel) {
info("Test that the focus is(on margin layout.");
let doc = boxmodel.document;
let container = doc.querySelector(".boxmodel-container");
container.focus();
EventUtils.synthesizeKey("KEY_Enter");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-main devtools-monospace",
is(container.getAttribute("activedescendant"), "boxmodel-main devtools-monospace",
"Should be set to the position layout.");
}
function* testChangingLevels(inspector, view) {
function* testChangingLevels(inspector, boxmodel) {
info("Test that using arrow keys updates level.");
let viewdoc = view.document;
let boxmodel = viewdoc.querySelector(".boxmodel-container");
boxmodel.focus();
let doc = boxmodel.document;
let container = doc.querySelector(".boxmodel-container");
container.focus();
EventUtils.synthesizeKey("KEY_Enter");
EventUtils.synthesizeKey("KEY_Escape");
EventUtils.synthesizeKey("KEY_ArrowDown");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-margins",
is(container.getAttribute("activedescendant"), "boxmodel-margins",
"Should be set to the margin layout.");
EventUtils.synthesizeKey("KEY_ArrowDown");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-borders",
is(container.getAttribute("activedescendant"), "boxmodel-borders",
"Should be set to the border layout.");
EventUtils.synthesizeKey("KEY_ArrowDown");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-paddings",
is(container.getAttribute("activedescendant"), "boxmodel-paddings",
"Should be set to the padding layout.");
EventUtils.synthesizeKey("KEY_ArrowDown");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-contents",
is(container.getAttribute("activedescendant"), "boxmodel-contents",
"Should be set to the content layout.");
EventUtils.synthesizeKey("KEY_ArrowUp");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-paddings",
is(container.getAttribute("activedescendant"), "boxmodel-paddings",
"Should be set to the padding layout.");
EventUtils.synthesizeKey("KEY_ArrowUp");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-borders",
is(container.getAttribute("activedescendant"), "boxmodel-borders",
"Should be set to the border layout.");
EventUtils.synthesizeKey("KEY_ArrowUp");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-margins",
is(container.getAttribute("activedescendant"), "boxmodel-margins",
"Should be set to the margin layout.");
EventUtils.synthesizeKey("KEY_ArrowUp");
is(boxmodel.getAttribute("activedescendant"), "boxmodel-main devtools-monospace",
is(container.getAttribute("activedescendant"), "boxmodel-main devtools-monospace",
"Should be set to the position layout.");
}
function* testTabbingWrapAround(inspector, view) {
function* testTabbingWrapAround(inspector, boxmodel) {
info("Test that using arrow keys updates level.");
let viewdoc = view.document;
let boxmodel = viewdoc.querySelector(".boxmodel-container");
boxmodel.focus();
let doc = boxmodel.document;
let container = doc.querySelector(".boxmodel-container");
container.focus();
EventUtils.synthesizeKey("KEY_Enter");
let editLevel = boxmodel.getAttribute("activedescendant").split(" ")[0];
let dataLevel = viewdoc.querySelector(`.${editLevel}`).getAttribute("data-box");
let editBoxes = [...viewdoc.querySelectorAll(
let editLevel = container.getAttribute("activedescendant").split(" ")[0];
let dataLevel = doc.querySelector(`.${editLevel}`).getAttribute("data-box");
let editBoxes = [...doc.querySelectorAll(
`[data-box="${dataLevel}"].boxmodel-editable`)];
EventUtils.synthesizeKey("KEY_Escape");
editBoxes[3].focus();
EventUtils.synthesizeKey("KEY_Tab");
is(editBoxes[0], viewdoc.activeElement, "Top edit box should have focus.");
is(editBoxes[0], doc.activeElement, "Top edit box should have focus.");
editBoxes[0].focus();
EventUtils.synthesizeKey("KEY_Tab", {shiftKey: true});
is(editBoxes[3], viewdoc.activeElement, "Left edit box should have focus.");
is(editBoxes[3], doc.activeElement, "Left edit box should have focus.");
}
function* testChangingLevelsByClicking(inspector, view) {
function* testChangingLevelsByClicking(inspector, boxmodel) {
info("Test that clicking on levels updates level.");
let viewdoc = view.document;
let boxmodel = viewdoc.querySelector(".boxmodel-container");
boxmodel.focus();
let doc = boxmodel.document;
let container = doc.querySelector(".boxmodel-container");
container.focus();
let marginLayout = viewdoc.querySelector(".boxmodel-margins");
let borderLayout = viewdoc.querySelector(".boxmodel-borders");
let paddingLayout = viewdoc.querySelector(".boxmodel-paddings");
let contentLayout = viewdoc.querySelector(".boxmodel-contents");
let marginLayout = doc.querySelector(".boxmodel-margins");
let borderLayout = doc.querySelector(".boxmodel-borders");
let paddingLayout = doc.querySelector(".boxmodel-paddings");
let contentLayout = doc.querySelector(".boxmodel-contents");
let layouts = [contentLayout, paddingLayout, borderLayout, marginLayout];
layouts.forEach(layout => {
layout.click();
is(boxmodel.getAttribute("activedescendant"), layout.className,
is(container.getAttribute("activedescendant"), layout.className,
"Should be set to" + layout.getAttribute("data-box") + "layout.");
});
}

View File

@ -44,21 +44,21 @@ const res1 = [
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
let node = yield getNodeFront("div", inspector);
let children = yield inspector.markup.walker.children(node);
let beforeElement = children.nodes[0];
yield selectNode(beforeElement, inspector);
yield testPositionValues(inspector, view);
yield testPositionValues(inspector, boxmodel);
});
function* testPositionValues(inspector, view) {
function* testPositionValues(inspector, boxmodel) {
info("Test that the position values of the box model are correct");
let viewdoc = view.document;
let doc = boxmodel.document;
for (let i = 0; i < res1.length; i++) {
let elt = viewdoc.querySelector(res1[i].selector);
let elt = doc.querySelector(res1[i].selector);
is(elt.textContent, res1[i].value,
res1[i].selector + " has the right value.");
}

View File

@ -99,21 +99,21 @@ const res1 = [
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
let node = yield getNodeFront("div", inspector);
let children = yield inspector.markup.walker.children(node);
let beforeElement = children.nodes[0];
yield selectNode(beforeElement, inspector);
yield testInitialValues(inspector, view);
yield testInitialValues(inspector, boxmodel);
});
function* testInitialValues(inspector, view) {
function* testInitialValues(inspector, boxmodel) {
info("Test that the initial values of the box model are correct");
let viewdoc = view.document;
let doc = boxmodel.document;
for (let i = 0; i < res1.length; i++) {
let elt = viewdoc.querySelector(res1[i].selector);
let elt = doc.querySelector(res1[i].selector);
is(elt.textContent, res1[i].value,
res1[i].selector + " has the right value.");
}

View File

@ -32,11 +32,11 @@ const LONG_TEXT_ROTATE_LIMIT = 3;
add_task(function* () {
yield addTab("data:text/html," + TEST_URI);
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
yield selectNode("div", inspector);
for (let i = 0; i < res1.length; i++) {
let elt = view.document.querySelector(res1[i].selector);
let elt = boxmodel.document.querySelector(res1[i].selector);
let isLong = elt.textContent.length > LONG_TEXT_ROTATE_LIMIT;
let classList = elt.parentNode.classList;
let canBeRotated = classList.contains("boxmodel-left") ||

View File

@ -10,21 +10,21 @@ const TEST_URI = "<p>hello</p>";
add_task(function* () {
yield addTab("data:text/html," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
info("When a property is edited, it should sync in the rule view");
yield selectNode("p", inspector);
info("Modify padding-bottom in box model view");
let span = view.document.querySelector(".boxmodel-padding.boxmodel-bottom > span");
EventUtils.synthesizeMouseAtCenter(span, {}, view.document.defaultView);
let editor = view.document.querySelector(".styleinspector-propertyeditor");
let span = boxmodel.document.querySelector(".boxmodel-padding.boxmodel-bottom > span");
EventUtils.synthesizeMouseAtCenter(span, {}, boxmodel.document.defaultView);
let editor = boxmodel.document.querySelector(".styleinspector-propertyeditor");
EventUtils.synthesizeKey("7", {}, view.document.defaultView);
EventUtils.synthesizeKey("7", {}, boxmodel.document.defaultView);
yield waitForUpdate(inspector);
is(editor.value, "7", "Should have the right value in the editor.");
EventUtils.synthesizeKey("VK_RETURN", {}, view.document.defaultView);
EventUtils.synthesizeKey("VK_RETURN", {}, boxmodel.document.defaultView);
let onRuleViewRefreshed = once(inspector, "rule-view-refreshed");
let onRuleViewSelected = once(inspector.sidebar, "ruleview-selected");

View File

@ -72,43 +72,43 @@ const VALUES_TEST_DATA = [{
add_task(function* () {
yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openBoxModelView();
let {inspector, boxmodel} = yield openLayoutView();
info("Checking the regions tooltips");
ok(view.document.querySelector(".boxmodel-margins").hasAttribute("title"),
ok(boxmodel.document.querySelector(".boxmodel-margins").hasAttribute("title"),
"The margin region has a tooltip");
is(view.document.querySelector(".boxmodel-margins").getAttribute("title"), "margin",
is(boxmodel.document.querySelector(".boxmodel-margins").getAttribute("title"), "margin",
"The margin region has the correct tooltip content");
ok(view.document.querySelector(".boxmodel-borders").hasAttribute("title"),
ok(boxmodel.document.querySelector(".boxmodel-borders").hasAttribute("title"),
"The border region has a tooltip");
is(view.document.querySelector(".boxmodel-borders").getAttribute("title"), "border",
is(boxmodel.document.querySelector(".boxmodel-borders").getAttribute("title"), "border",
"The border region has the correct tooltip content");
ok(view.document.querySelector(".boxmodel-paddings").hasAttribute("title"),
ok(boxmodel.document.querySelector(".boxmodel-paddings").hasAttribute("title"),
"The padding region has a tooltip");
is(view.document.querySelector(".boxmodel-paddings").getAttribute("title"), "padding",
"The padding region has the correct tooltip content");
is(boxmodel.document.querySelector(".boxmodel-paddings").getAttribute("title"),
"padding", "The padding region has the correct tooltip content");
ok(view.document.querySelector(".boxmodel-content").hasAttribute("title"),
ok(boxmodel.document.querySelector(".boxmodel-content").hasAttribute("title"),
"The content region has a tooltip");
is(view.document.querySelector(".boxmodel-content").getAttribute("title"), "content",
"The content region has the correct tooltip content");
is(boxmodel.document.querySelector(".boxmodel-content").getAttribute("title"),
"content", "The content region has the correct tooltip content");
for (let {selector, values} of VALUES_TEST_DATA) {
info("Selecting " + selector + " and checking the values tooltips");
yield selectNode(selector, inspector);
info("Iterate over all values");
for (let key in view.map) {
for (let key in boxmodel.map) {
if (key === "position") {
continue;
}
let name = view.map[key].property;
let name = boxmodel.map[key].property;
let expectedTooltipData = values.find(o => o.name === name);
let el = view.document.querySelector(view.map[key].selector);
let el = boxmodel.document.querySelector(boxmodel.map[key].selector);
ok(el.hasAttribute("title"), "The " + name + " value has a tooltip");

View File

@ -12,32 +12,32 @@ const IFRAME2 = URL_ROOT + "doc_boxmodel_iframe2.html";
add_task(function* () {
yield addTab(IFRAME1);
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield testFirstPage(inspector, view, testActor);
yield testFirstPage(inspector, boxmodel, testActor);
info("Navigate to the second page");
let onMarkupLoaded = waitForMarkupLoaded(inspector);
yield testActor.eval(`location.href="${IFRAME2}"`);
yield onMarkupLoaded;
yield testSecondPage(inspector, view, testActor);
yield testSecondPage(inspector, boxmodel, testActor);
info("Go back to the first page");
onMarkupLoaded = waitForMarkupLoaded(inspector);
yield testActor.eval("history.back();");
yield onMarkupLoaded;
yield testBackToFirstPage(inspector, view, testActor);
yield testBackToFirstPage(inspector, boxmodel, testActor);
});
function* testFirstPage(inspector, view, testActor) {
function* testFirstPage(inspector, boxmodel, testActor) {
info("Test that the box model view works on the first page");
yield selectNode("p", inspector);
info("Checking that the box model view shows the right value");
let paddingElt = view.document.querySelector(
let paddingElt = boxmodel.document.querySelector(
".boxmodel-padding.boxmodel-top > span");
is(paddingElt.textContent, "50");
@ -51,13 +51,13 @@ function* testFirstPage(inspector, view, testActor) {
is(paddingElt.textContent, "20");
}
function* testSecondPage(inspector, view, testActor) {
function* testSecondPage(inspector, boxmodel, testActor) {
info("Test that the box model view works on the second page");
yield selectNode("p", inspector);
info("Checking that the box model view shows the right value");
let sizeElt = view.document.querySelector(".boxmodel-size > span");
let sizeElt = boxmodel.document.querySelector(".boxmodel-size > span");
is(sizeElt.textContent, "100" + "\u00D7" + "100");
info("Listening for box model view changes and modifying the size");
@ -70,14 +70,14 @@ function* testSecondPage(inspector, view, testActor) {
is(sizeElt.textContent, "200" + "\u00D7" + "100");
}
function* testBackToFirstPage(inspector, view, testActor) {
function* testBackToFirstPage(inspector, boxmodel, testActor) {
info("Test that the box model view works on the first page after going back");
yield selectNode("p", inspector);
info("Checking that the box model view shows the right value, which is the" +
"modified value from step one because of the bfcache");
let paddingElt = view.document.querySelector(
let paddingElt = boxmodel.document.querySelector(
".boxmodel-padding.boxmodel-top > span");
is(paddingElt.textContent, "20");

View File

@ -8,10 +8,10 @@
add_task(function* () {
yield addTab(URL_ROOT + "doc_boxmodel_iframe1.html");
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
info("Test that the box model view works on the first page");
yield assertBoxModelView(inspector, view, testActor);
yield assertBoxModelView(inspector, boxmodel, testActor);
info("Reload the page");
let onMarkupLoaded = waitForMarkupLoaded(inspector);
@ -19,14 +19,14 @@ add_task(function* () {
yield onMarkupLoaded;
info("Test that the box model view works on the reloaded page");
yield assertBoxModelView(inspector, view, testActor);
yield assertBoxModelView(inspector, boxmodel, testActor);
});
function* assertBoxModelView(inspector, view, testActor) {
function* assertBoxModelView(inspector, boxmodel, testActor) {
yield selectNode("p", inspector);
info("Checking that the box model view shows the right value");
let paddingElt = view.document.querySelector(
let paddingElt = boxmodel.document.querySelector(
".boxmodel-padding.boxmodel-top > span");
is(paddingElt.textContent, "50");

View File

@ -9,20 +9,20 @@
add_task(function* () {
yield addTab(URL_ROOT + "doc_boxmodel_iframe1.html");
let {inspector, view, testActor} = yield openBoxModelView();
let {inspector, boxmodel, testActor} = yield openLayoutView();
yield testResizingInIframe(inspector, view, testActor);
yield testReflowsAfterIframeDeletion(inspector, view, testActor);
yield testResizingInIframe(inspector, boxmodel, testActor);
yield testReflowsAfterIframeDeletion(inspector, boxmodel, testActor);
});
function* testResizingInIframe(inspector, view, testActor) {
function* testResizingInIframe(inspector, boxmodel, testActor) {
info("Test that resizing an element in an iframe updates its box model");
info("Selecting the nested test node");
yield selectNodeInIframe2("div", inspector);
info("Checking that the box model view shows the right value");
let sizeElt = view.document.querySelector(".boxmodel-size > span");
let sizeElt = boxmodel.document.querySelector(".boxmodel-size > span");
is(sizeElt.textContent, "400\u00D7200");
info("Listening for box model view changes and modifying its size");
@ -35,7 +35,7 @@ function* testResizingInIframe(inspector, view, testActor) {
is(sizeElt.textContent, "200\u00D7200");
}
function* testReflowsAfterIframeDeletion(inspector, view, testActor) {
function* testReflowsAfterIframeDeletion(inspector, boxmodel, testActor) {
info("Test reflows are still sent to the box model view after deleting an " +
"iframe");
@ -48,7 +48,7 @@ function* testReflowsAfterIframeDeletion(inspector, view, testActor) {
yield selectNodeInIframe1("p", inspector);
info("Checking that the box model view shows the right value");
let sizeElt = view.document.querySelector(".boxmodel-size > span");
let sizeElt = boxmodel.document.querySelector(".boxmodel-size > span");
is(sizeElt.textContent, "100\u00D7100");
info("Listening for box model view changes and modifying its size");

View File

@ -45,36 +45,6 @@ function isNodeVisible(node) {
return !!node.getClientRects().length;
}
/**
* Open the toolbox, with the inspector tool visible, and the computed view
* sidebar tab selected to display the box model view.
*
* @return {Promise} a promise that resolves when the inspector is ready and the box model
* view is visible and ready.
*/
function openBoxModelView() {
return openInspectorSidebarTab("computedview").then(data => {
// The actual highligher show/hide methods are mocked in box model tests.
// The highlighter is tested in devtools/inspector/test.
function mockHighlighter({highlighter}) {
highlighter.showBoxModel = function() {
return promise.resolve();
};
highlighter.hideBoxModel = function() {
return promise.resolve();
};
}
mockHighlighter(data.toolbox);
return {
toolbox: data.toolbox,
inspector: data.inspector,
view: data.inspector.getPanel("computedview"),
testActor: data.testActor
};
});
}
/**
* Wait for the boxmodel-view-updated event.
*

View File

@ -27,12 +27,6 @@ const TooltipsOverlay = require("devtools/client/inspector/shared/tooltips-overl
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
const clipboardHelper = require("devtools/shared/platform/clipboard");
const { createElement, createFactory } = require("devtools/client/shared/vendor/react");
const ReactDOM = require("devtools/client/shared/vendor/react-dom");
const { Provider } = require("devtools/client/shared/vendor/react-redux");
const BoxModelApp = createFactory(require("devtools/client/inspector/boxmodel/components/BoxModelApp"));
const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties";
const {LocalizationHelper} = require("devtools/shared/l10n");
const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES);
@ -156,7 +150,6 @@ UpdateProcess.prototype = {
function CssComputedView(inspector, document, pageStyle) {
this.inspector = inspector;
this.highlighters = inspector.highlighters;
this.store = inspector.store;
this.styleDocument = document;
this.styleWindow = this.styleDocument.defaultView;
this.pageStyle = pageStyle;
@ -177,7 +170,6 @@ function CssComputedView(inspector, document, pageStyle) {
let doc = this.styleDocument;
this.element = doc.getElementById("computed-property-container");
this.boxModelWrapper = doc.getElementById("boxmodel-wrapper");
this.searchField = doc.getElementById("computed-searchbox");
this.searchClearButton = doc.getElementById("computed-searchinput-clear");
this.includeBrowserStylesCheckbox = doc.getElementById("browser-style-checkbox");
@ -209,7 +201,6 @@ function CssComputedView(inspector, document, pageStyle) {
// The element that we're inspecting, and the document that it comes from.
this._viewedElement = null;
this.createBoxModelView();
this.createStyleViews();
this._contextmenu = new StyleInspectorMenu(this, { isRuleView: false });
@ -577,10 +568,8 @@ CssComputedView.prototype = {
this._filterChangedTimeout = setTimeout(() => {
if (this.searchField.value.length > 0) {
this.searchField.setAttribute("filled", true);
this.boxModelWrapper.hidden = true;
} else {
this.searchField.removeAttribute("filled");
this.boxModelWrapper.hidden = false;
}
this.refreshPanel();
@ -622,38 +611,6 @@ CssComputedView.prototype = {
CssLogic.FILTER.USER;
},
/**
* Render the box model view.
*/
createBoxModelView: function() {
let {
setSelectedNode,
onShowBoxModelHighlighterForNode,
} = this.inspector.getCommonComponentProps();
let {
onHideBoxModelHighlighter,
onShowBoxModelEditor,
onShowBoxModelHighlighter,
onToggleGeometryEditor,
} = this.inspector.getPanel("boxmodel").getComponentProps();
let provider = createElement(
Provider,
{ store: this.store },
BoxModelApp({
setSelectedNode,
showBoxModelProperties: false,
onHideBoxModelHighlighter,
onShowBoxModelEditor,
onShowBoxModelHighlighter,
onShowBoxModelHighlighterForNode,
onToggleGeometryEditor,
})
);
ReactDOM.render(provider, this.boxModelWrapper);
},
/**
* The CSS as displayed by the UI.
*/
@ -797,7 +754,6 @@ CssComputedView.prototype = {
// Nodes used in templating
this.element = null;
this.boxModelWrapper = null;
this.searchField = null;
this.searchClearButton = null;
this.includeBrowserStylesCheckbox = null;
@ -810,7 +766,6 @@ CssComputedView.prototype = {
this.inspector = null;
this.highlighters = null;
this.store = null;
this.styleDocument = null;
this.styleWindow = null;

View File

@ -33,8 +33,6 @@ function* testToggleDefaultStyles(inspector, computedView) {
function* testAddTextInFilter(inspector, computedView) {
info("setting filter text to \"color\"");
let doc = computedView.styleDocument;
let boxModelWrapper = doc.getElementById("boxmodel-wrapper");
let searchField = computedView.searchField;
let onRefreshed = inspector.once("computed-view-refreshed");
let win = computedView.styleWindow;
@ -53,8 +51,6 @@ function* testAddTextInFilter(inspector, computedView) {
synthesizeKeys("color", win);
yield onRefreshed;
ok(boxModelWrapper.hidden, "Box model is hidden");
info("check that the correct properties are visible");
let propertyViews = computedView.propertyViews;

View File

@ -49,8 +49,6 @@ function* testClearSearchFilter(inspector, computedView) {
info("Clearing the search filter");
let win = computedView.styleWindow;
let doc = computedView.styleDocument;
let boxModelWrapper = doc.getElementById("boxmodel-wrapper");
let propertyViews = computedView.propertyViews;
let searchField = computedView.searchField;
let searchClearButton = computedView.searchClearButton;
@ -59,8 +57,6 @@ function* testClearSearchFilter(inspector, computedView) {
EventUtils.synthesizeMouseAtCenter(searchClearButton, {}, win);
yield onRefreshed;
ok(!boxModelWrapper.hidden, "Box model is displayed");
info("Check that the correct properties are visible");
ok(!searchField.value, "Search filter is cleared");

View File

@ -133,7 +133,6 @@
<div id="computed-container">
<div id="computed-container-focusable" tabindex="-1">
<div id="boxmodel-wrapper"></div>
<div id="computed-property-container" class="devtools-monospace" tabindex="0" dir="ltr"></div>
<div id="computed-no-results" class="devtools-sidepanel-no-result" hidden="" data-localization="content=inspector.noProperties"></div>
</div>

View File

@ -64,10 +64,10 @@ add_task(function* () {
yield onRuleViewChanged;
yield checkTextBox(inspector.panelDoc.activeElement, toolbox);
info("Switching to the computed-view");
let onComputedViewReady = inspector.once("boxmodel-view-updated");
selectComputedView(inspector);
yield onComputedViewReady;
info("Switching to the layout-view");
let onBoxModelUpdated = inspector.once("boxmodel-view-updated");
selectLayoutView(inspector);
yield onBoxModelUpdated;
info("Testing the box-model region");
let margin = inspector.panelDoc.querySelector(

View File

@ -53,7 +53,7 @@ var openInspectorSidebarTab = Task.async(function* (id) {
info("Selecting the " + id + " sidebar");
let onSidebarSelect = inspector.sidebar.once("select");
if (id === "computedview" || id === "layoutview") {
if (id === "layoutview") {
// The layout and computed views should wait until the box-model widget is ready.
let onBoxModelViewReady = inspector.once("boxmodel-view-updated");
// The layout view also needs to wait for the grid panel to be fully updated.
@ -169,6 +169,17 @@ function selectComputedView(inspector) {
return inspector.getPanel("computedview").computedView;
}
/**
* Select the layout view sidebar tab on an already opened inspector panel.
*
* @param {InspectorPanel} inspector
* @return {BoxModel} the box model
*/
function selectLayoutView(inspector) {
inspector.sidebar.select("layoutview");
return inspector.getPanel("boxmodel");
}
/**
* Get the NodeFront for a node that matches a given css selector, via the
* protocol.

View File

@ -556,6 +556,9 @@ outline.header=Outline
# LOCALIZATION NOTE (outline.noFunctions): Outline text when there are no functions to display
outline.noFunctions=No functions
# LOCALIZATION NOTE (outline.noFileSelected): Outline text when there are no files selected
outline.noFileSelected=No file selected
# LOCALIZATION NOTE (sources.search): Sources left sidebar prompt
# e.g. Cmd+P to search. On a mac, we use the command unicode character.
# On windows, it's ctrl.

View File

@ -82,8 +82,6 @@ pref("devtools.gridinspector.showGridAreas", false);
pref("devtools.gridinspector.showGridLineNumbers", false);
pref("devtools.gridinspector.showInfiniteLines", false);
// Whether or not the box model panel is opened in the computed view
pref("devtools.computed.boxmodel.opened", true);
// Whether or not the box model panel is opened in the layout view
pref("devtools.layout.boxmodel.opened", true);
// Whether or not the flexbox panel is opened in the layout view

View File

@ -168,7 +168,7 @@ var FunctionCallActor = protocol.ActorClassWithSpec(functionCallSpec, {
if (knownMethod) {
let isOverloaded = typeof knownMethod.enums === "function";
if (isOverloaded) {
methodSignatureEnums = methodSignatureEnums(args);
methodSignatureEnums = knownMethod.enums(args);
} else {
methodSignatureEnums = knownMethod.enums;
}

View File

@ -16,14 +16,13 @@ Bug 1067491 - Test recording allocations.
"use strict";
window.onload = function() {
let { Task } = require("devtools/shared/task");
SimpleTest.waitForExplicitFinish();
Task.spawn(function* () {
let { memory, client } = yield startServerAndGetSelectedTabMemory();
yield memory.attach();
(async function() {
let { memory, client } = await startServerAndGetSelectedTabMemory();
await memory.attach();
yield memory.startRecordingAllocations();
await memory.startRecordingAllocations();
ok(true, "Can start recording allocations");
// Allocate some objects.
@ -43,9 +42,9 @@ window.onload = function() {
}());
/* eslint-enable max-nested-callbacks */
let response = yield memory.getAllocations();
let response = await memory.getAllocations();
yield memory.stopRecordingAllocations();
await memory.stopRecordingAllocations();
ok(true, "Can stop recording allocations");
// Filter out allocations by library and test code, and get only the
@ -95,9 +94,9 @@ window.onload = function() {
is(expectedLines.size, 0,
"Should have found all the expected lines");
yield memory.detach();
await memory.detach();
destroyServerAndFinish(client);
});
})();
};
</script>
</pre>

View File

@ -12,7 +12,7 @@
#include "nsContentUtils.h"
#include "nsDOMClassInfoID.h"
#include "nsIDOMDocument.h"
#include "DocumentType.h"
#include "mozilla/dom/DocumentType.h"
#include "nsTextNode.h"
namespace mozilla {
@ -60,14 +60,14 @@ DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
// Indicate that there is no internal subset (not just an empty one)
RefPtr<DocumentType> docType =
NS_NewDOMDocumentType(mOwner->NodeInfoManager(), name, aPublicId,
aSystemId, VoidString(), aRv);
aSystemId, VoidString());
return docType.forget();
}
nsresult
DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
DocumentType* aDoctype,
nsIDocument** aDocument)
{
*aDocument = nullptr;
@ -124,7 +124,7 @@ DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
already_AddRefed<nsIDocument>
DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
DocumentType* aDoctype,
ErrorResult& aRv)
{
nsCOMPtr<nsIDocument> document;
@ -141,16 +141,13 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
NS_ENSURE_STATE(mOwner);
nsCOMPtr<nsIDOMDocumentType> doctype;
// Indicate that there is no internal subset (not just an empty one)
nsresult rv = NS_NewDOMDocumentType(getter_AddRefs(doctype),
mOwner->NodeInfoManager(),
nsGkAtoms::html, // aName
EmptyString(), // aPublicId
EmptyString(), // aSystemId
VoidString()); // aInternalSubset
NS_ENSURE_SUCCESS(rv, rv);
RefPtr<DocumentType> doctype =
NS_NewDOMDocumentType(mOwner->NodeInfoManager(),
nsGkAtoms::html, // aName
EmptyString(), // aPublicId
EmptyString(), // aSystemId
VoidString()); // aInternalSubset
nsCOMPtr<nsIGlobalObject> scriptHandlingObject =
do_QueryReferent(mScriptObject);
@ -158,12 +155,12 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
nsCOMPtr<nsIDOMDocument> document;
rv = NS_NewDOMDocument(getter_AddRefs(document),
EmptyString(), EmptyString(),
doctype, mDocumentURI, mBaseURI,
mOwner->NodePrincipal(),
true, scriptHandlingObject,
DocumentFlavorLegacyGuess);
nsresult rv = NS_NewDOMDocument(getter_AddRefs(document),
EmptyString(), EmptyString(),
doctype, mDocumentURI, mBaseURI,
mOwner->NodePrincipal(),
true, scriptHandlingObject,
DocumentFlavorLegacyGuess);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);

View File

@ -67,7 +67,7 @@ public:
already_AddRefed<nsIDocument>
CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
DocumentType* aDoctype,
ErrorResult& aRv);
already_AddRefed<nsIDocument>
@ -76,7 +76,7 @@ public:
private:
nsresult CreateDocument(const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
DocumentType* aDoctype,
nsIDocument** aDocument);
nsresult CreateHTMLDocument(const nsAString& aTitle,
nsIDocument** aDocument);

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Implementation of DOM Core's nsIDOMDocumentType node.
* Implementation of DOM Core's DocumentType node.
*/
#include "mozilla/dom/DocumentType.h"
@ -18,33 +18,14 @@
#include "nsWrapperCacheInlines.h"
#include "mozilla/dom/DocumentTypeBinding.h"
nsresult
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
nsNodeInfoManager *aNodeInfoManager,
nsAtom *aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aInternalSubset)
{
NS_ENSURE_ARG_POINTER(aDocType);
mozilla::ErrorResult rv;
*aDocType = NS_NewDOMDocumentType(aNodeInfoManager, aName, aPublicId,
aSystemId, aInternalSubset, rv).take();
return rv.StealNSResult();
}
already_AddRefed<mozilla::dom::DocumentType>
NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
nsAtom *aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aInternalSubset,
mozilla::ErrorResult& rv)
const nsAString& aInternalSubset)
{
if (!aName) {
rv.Throw(NS_ERROR_INVALID_POINTER);
return nullptr;
}
MOZ_ASSERT(aName, "Must have a name");
already_AddRefed<mozilla::dom::NodeInfo> ni =
aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nullptr,
@ -69,7 +50,7 @@ DocumentType::DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aInternalSubset) :
DocumentTypeForward(aNodeInfo),
nsGenericDOMDataNode(aNodeInfo),
mPublicId(aPublicId),
mSystemId(aSystemId),
mInternalSubset(aInternalSubset)
@ -82,8 +63,7 @@ DocumentType::~DocumentType()
{
}
NS_IMPL_ISUPPORTS_INHERITED(DocumentType, nsGenericDOMDataNode, nsIDOMNode,
nsIDOMDocumentType)
NS_IMPL_ISUPPORTS_INHERITED(DocumentType, nsGenericDOMDataNode, nsIDOMNode)
bool
DocumentType::IsNodeOfType(uint32_t aFlags) const
@ -101,34 +81,28 @@ DocumentType::GetText()
return nullptr;
}
NS_IMETHODIMP
DocumentType::GetName(nsAString& aName)
void
DocumentType::GetName(nsAString& aName) const
{
aName = NodeName();
return NS_OK;
}
NS_IMETHODIMP
DocumentType::GetPublicId(nsAString& aPublicId)
void
DocumentType::GetPublicId(nsAString& aPublicId) const
{
aPublicId = mPublicId;
return NS_OK;
}
NS_IMETHODIMP
DocumentType::GetSystemId(nsAString& aSystemId)
void
DocumentType::GetSystemId(nsAString& aSystemId) const
{
aSystemId = mSystemId;
return NS_OK;
}
NS_IMETHODIMP
DocumentType::GetInternalSubset(nsAString& aInternalSubset)
void
DocumentType::GetInternalSubset(nsAString& aInternalSubset) const
{
aInternalSubset = mInternalSubset;
return NS_OK;
}
nsGenericDOMDataNode*

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Implementation of DOM Core's nsIDOMDocumentType node.
* Implementation of DOM Core's DocumentType node.
*/
#ifndef DocumentType_h
@ -13,7 +13,7 @@
#include "mozilla/Attributes.h"
#include "nsCOMPtr.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMNode.h"
#include "nsIContent.h"
#include "nsGenericDOMDataNode.h"
#include "nsString.h"
@ -26,17 +26,8 @@ namespace dom {
// data. This is done simply for convenience and should be changed if
// this restricts what should be done for character data.
class DocumentTypeForward : public nsGenericDOMDataNode,
public nsIDOMDocumentType
{
public:
explicit DocumentTypeForward(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
}
};
class DocumentType final : public DocumentTypeForward
class DocumentType final : public nsGenericDOMDataNode,
public nsIDOMNode
{
public:
DocumentType(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
@ -50,9 +41,6 @@ public:
// nsIDOMNode
// Forwarded by base class
// nsIDOMDocumentType
NS_DECL_NSIDOMDOCUMENTTYPE
// nsINode
virtual bool IsNodeOfType(uint32_t aFlags) const override;
virtual void GetNodeValueInternal(nsAString& aNodeValue) override
@ -72,6 +60,12 @@ public:
virtual nsIDOMNode* AsDOMNode() override { return this; }
// WebIDL API
void GetName(nsAString& aName) const;
void GetPublicId(nsAString& aPublicId) const;
void GetSystemId(nsAString& aSystemId) const;
void GetInternalSubset(nsAString& aInternalSubset) const;
protected:
virtual ~DocumentType();
@ -87,15 +81,6 @@ protected:
already_AddRefed<mozilla::dom::DocumentType>
NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
nsAtom *aName,
const nsAString& aPublicId,
const nsAString& aSystemId,
const nsAString& aInternalSubset,
mozilla::ErrorResult& rv);
nsresult
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
nsNodeInfoManager* aNodeInfoManager,
nsAtom *aName,
const nsAString& aPublicId,
const nsAString& aSystemId,

View File

@ -106,7 +106,6 @@
#include "nsNodeInfoManager.h"
#include "nsICategoryManager.h"
#include "nsIDOMDocumentType.h"
#include "nsGenericHTMLElement.h"
#include "nsContentCreatorFunctions.h"
#include "nsIControllers.h"

View File

@ -132,7 +132,6 @@
#include "nsIDocumentEncoder.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
@ -6034,15 +6033,9 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
nsCOMPtr<nsIDragSession> dragSession = GetDragSession();
NS_ENSURE_TRUE(dragSession, NS_OK); // no drag in progress
nsCOMPtr<nsIDOMDataTransfer> dataTransfer;
nsCOMPtr<DataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(dataTransfer));
if (dataTransfer) {
initialDataTransfer = do_QueryInterface(dataTransfer);
if (!initialDataTransfer) {
return NS_ERROR_FAILURE;
}
} else {
RefPtr<DataTransfer> initialDataTransfer =
dragSession->GetDataTransfer();
if (!initialDataTransfer) {
// A dataTransfer won't exist when a drag was started by some other
// means, for instance calling the drag service directly, or a drag
// from another application. In either case, a new dataTransfer should
@ -6072,9 +6065,9 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
// from the drop action, which platform specific widget code sets before
// the event is fired based on the keyboard state.
if (aDragEvent->mMessage == eDragEnter || aDragEvent->mMessage == eDragOver) {
uint32_t action, effectAllowed;
uint32_t action;
dragSession->GetDragAction(&action);
aDragEvent->mDataTransfer->GetEffectAllowedInt(&effectAllowed);
uint32_t effectAllowed = aDragEvent->mDataTransfer->EffectAllowedInt();
aDragEvent->mDataTransfer->SetDropEffectInt(
FilterDropEffect(action, effectAllowed));
}
@ -6084,9 +6077,8 @@ nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
// last value that the dropEffect had. This will have been set in
// EventStateManager::PostHandleEvent for the last dragenter or
// dragover event.
uint32_t dropEffect;
initialDataTransfer->GetDropEffectInt(&dropEffect);
aDragEvent->mDataTransfer->SetDropEffectInt(dropEffect);
aDragEvent->mDataTransfer->SetDropEffectInt(
initialDataTransfer->DropEffectInt());
}
return NS_OK;

View File

@ -919,7 +919,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
}
} else if (clipboardData) {
// check to see if any data was put on the data transfer.
clipboardData->GetMozItemCount(&count);
count = clipboardData->MozItemCount();
if (count) {
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1"));
NS_ENSURE_TRUE(clipboard, false);

View File

@ -7389,18 +7389,16 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
RefPtr<DocumentType> docType = GetDoctype();
if (docType) {
nsAutoString docId;
nsresult rv = docType->GetPublicId(docId);
if (NS_SUCCEEDED(rv)) {
if ((docId.Find("WAP") != -1) ||
(docId.Find("Mobile") != -1) ||
(docId.Find("WML") != -1))
{
// We're making an assumption that the docType can't change here
mViewportType = DisplayWidthHeight;
return nsViewportInfo(aDisplaySize,
defaultScale,
/*allowZoom*/true);
}
docType->GetPublicId(docId);
if ((docId.Find("WAP") != -1) ||
(docId.Find("Mobile") != -1) ||
(docId.Find("WML") != -1))
{
// We're making an assumption that the docType can't change here
mViewportType = DisplayWidthHeight;
return nsViewportInfo(aDisplaySize,
defaultScale,
/*allowZoom*/true);
}
}

View File

@ -24,7 +24,6 @@
#include "nsIDOMText.h"
#include "nsIDOMComment.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMNodeList.h"
#include "nsRange.h"
#include "nsIDOMRange.h"
@ -45,6 +44,7 @@
#include "nsTArray.h"
#include "nsIFrame.h"
#include "nsStringBuffer.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsLayoutUtils.h"
@ -430,7 +430,7 @@ nsDocumentEncoder::SerializeNodeStart(nsINode* aNode,
}
case nsINode::DOCUMENT_TYPE_NODE:
{
mSerializer->AppendDoctype(static_cast<nsIContent*>(node), aStr);
mSerializer->AppendDoctype(static_cast<DocumentType*>(node), aStr);
break;
}
}

View File

@ -2033,7 +2033,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
// fall back to the default.
if (OwnerIsMozBrowserFrame() &&
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::Remote)) {
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::remote)) {
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
}
@ -2043,7 +2043,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
return (OwnerIsMozBrowserFrame() ||
mOwnerContent->GetNameSpaceID() == kNameSpaceID_XUL) &&
mOwnerContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::Remote,
nsGkAtoms::remote,
nsGkAtoms::_true,
eCaseMatters);
}

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Base class for DOM Core's nsIDOMComment, nsIDOMDocumentType, nsIDOMText,
* Base class for DOM Core's nsIDOMComment, DocumentType, nsIDOMText,
* CDATASection and nsIDOMProcessingInstruction nodes.
*/

View File

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Base class for DOM Core's nsIDOMComment, nsIDOMDocumentType, nsIDOMText,
* Base class for DOM Core's nsIDOMComment, DocumentType, nsIDOMText,
* CDATASection, and nsIDOMProcessingInstruction nodes.
*/

View File

@ -640,7 +640,7 @@ GK_ATOM(level, "level")
GK_ATOM(li, "li")
GK_ATOM(line, "line")
GK_ATOM(link, "link")
GK_ATOM(list, "list")
//GK_ATOM(list, "list") # "list" is present below
GK_ATOM(listbox, "listbox")
GK_ATOM(listboxbody, "listboxbody")
GK_ATOM(listcell, "listcell")
@ -714,7 +714,7 @@ GK_ATOM(minlength, "minlength")
GK_ATOM(minpos, "minpos")
GK_ATOM(minusSign, "minus-sign")
GK_ATOM(minwidth, "minwidth")
GK_ATOM(_mixed, "mixed")
GK_ATOM(mixed, "mixed")
GK_ATOM(messagemanagergroup, "messagemanagergroup")
GK_ATOM(mod, "mod")
GK_ATOM(mode, "mode")
@ -1319,7 +1319,7 @@ GK_ATOM(sub, "sub")
GK_ATOM(sum, "sum")
GK_ATOM(sup, "sup")
GK_ATOM(summary, "summary")
GK_ATOM(_switch, "switch")
//GK_ATOM(_switch, "switch") # "switch" is present below
GK_ATOM(systemProperty, "system-property")
GK_ATOM(tab, "tab")
GK_ATOM(tabbox, "tabbox")
@ -1669,7 +1669,7 @@ GK_ATOM(rx, "rx")
GK_ATOM(ry, "ry")
GK_ATOM(saturate, "saturate")
GK_ATOM(saturation, "saturation")
GK_ATOM(set, "set")
//GK_ATOM(set, "set") # "set" is present below
GK_ATOM(seed, "seed")
GK_ATOM(shape_rendering, "shape-rendering")
GK_ATOM(skewX, "skewX")
@ -1837,7 +1837,7 @@ GK_ATOM(divide_, "divide")
GK_ATOM(domain_, "domain")
GK_ATOM(domainofapplication_, "domainofapplication")
GK_ATOM(edge_, "edge")
GK_ATOM(el_, "el")
GK_ATOM(el, "el")
GK_ATOM(emptyset_, "emptyset")
GK_ATOM(eq_, "eq")
GK_ATOM(equalcolumns_, "equalcolumns")
@ -1958,7 +1958,7 @@ GK_ATOM(notin_, "notin")
GK_ATOM(notprsubset_, "notprsubset")
GK_ATOM(notsubset_, "notsubset")
GK_ATOM(numalign_, "numalign")
GK_ATOM(other_, "other")
GK_ATOM(other, "other")
GK_ATOM(outerproduct_, "outerproduct")
GK_ATOM(partialdiff_, "partialdiff")
GK_ATOM(piece_, "piece")
@ -2232,7 +2232,7 @@ GK_ATOM(x_tibt, "x-tibt")
GK_ATOM(az, "az")
GK_ATOM(ba, "ba")
GK_ATOM(crh, "crh")
GK_ATOM(el, "el")
//GK_ATOM(el, "el") # "el" is present above
GK_ATOM(ga, "ga")
GK_ATOM(nl, "nl")
@ -2253,7 +2253,7 @@ GK_ATOM(monospace, "monospace")
GK_ATOM(mozfixed, "-moz-fixed")
// IPC stuff
GK_ATOM(Remote, "remote")
//GK_ATOM(Remote, "remote") # "remote" is present above
GK_ATOM(RemoteId, "_remote_id")
GK_ATOM(RemoteType, "remoteType")
GK_ATOM(DisplayPort, "_displayport")
@ -2371,7 +2371,7 @@ GK_ATOM(pixels, "pixels")
GK_ATOM(lines, "lines")
GK_ATOM(pages, "pages")
GK_ATOM(scrollbars, "scrollbars")
GK_ATOM(other, "other")
//GK_ATOM(other, "other") # "other" is present above
// Scroll origins without smooth-scrolling prefs
GK_ATOM(apz, "apz")
GK_ATOM(restore, "restore")
@ -2420,7 +2420,7 @@ GK_ATOM(linkedPanel, "linkedpanel")
GK_ATOM(live, "live")
GK_ATOM(menuitemcheckbox, "menuitemcheckbox")
GK_ATOM(menuitemradio, "menuitemradio")
GK_ATOM(mixed, "mixed")
//GK_ATOM(mixed, "mixed") # "mixed" is present above
GK_ATOM(multiline, "multiline")
GK_ATOM(navigation, "navigation")
GK_ATOM(polite, "polite")
@ -2508,6 +2508,21 @@ GK_ATOM(onupdateend, "onupdateend")
GK_ATOM(onaddsourcebuffer, "onaddsourcebuffer")
GK_ATOM(onremovesourcebuffer, "onremovesourcebuffer")
// RDF
GK_ATOM(about, "about")
GK_ATOM(ID, "ID")
GK_ATOM(nodeID, "nodeID")
GK_ATOM(aboutEach, "aboutEach")
GK_ATOM(resource, "resource")
GK_ATOM(RDF, "RDF")
GK_ATOM(Description, "Description")
GK_ATOM(Bag, "Bag")
GK_ATOM(Seq, "Seq")
GK_ATOM(Alt, "Alt")
//GK_ATOM(kLiAtom, "li") # "li" is present above
//GK_ATOM(kXMLNSAtom, "xmlns") # "xmlns" is present above
GK_ATOM(parseType, "parseType")
// THE REST OF THE FILE IS GENERATED BY THE HTML PARSER TRANSLATOR AND
// WILL BE OVERWRITTEN!
// Please put manually-added atoms above this section and please avoid #ifdefing

View File

@ -16,6 +16,7 @@ class nsIDocument;
namespace mozilla {
class Encoding;
namespace dom {
class DocumentType;
class Element;
} // namespace dom
} // namespace mozilla
@ -51,7 +52,7 @@ class nsIContentSerializer : public nsISupports {
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) = 0;
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
nsAString& aStr) = 0;
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,

View File

@ -95,7 +95,6 @@ class nsIDocShellTreeItem;
class nsIDocumentEncoder;
class nsIDocumentObserver;
class nsIDOMDocument;
class nsIDOMDocumentType;
class nsIDOMElement;
class nsIDOMNodeList;
class nsIHTMLCollection;
@ -4587,7 +4586,7 @@ nsresult
NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
const nsAString& aNamespaceURI,
const nsAString& aQualifiedName,
nsIDOMDocumentType* aDoctype,
mozilla::dom::DocumentType* aDoctype,
nsIURI* aDocumentURI,
nsIURI* aBaseURI,
nsIPrincipal* aPrincipal,

View File

@ -5,7 +5,6 @@
#include "nsISupports.idl"
#include "nsIPrincipal.idl"
interface nsIDOMDataTransfer;
interface nsIDOMDragEvent;
[scriptable, uuid(69E14F91-2E09-4CA6-A511-A715C99A2804)]
@ -95,8 +94,10 @@ interface nsIDroppedLinkHandler : nsISupports
* dragged. Since drag/drop performs a roundtrip of parent, child, parent,
* it allows the parent to verify that the child did not modify links
* being dropped.
*
* @param dataTransfer is a DataTransfer. See bug 1444991.
*/
void queryLinks(in nsIDOMDataTransfer aDataTransfer,
void queryLinks(in nsISupports aDataTransfer,
[optional] out unsigned long aCount,
[retval, array, size_is(aCount)] out nsIDroppedLinkItem aLinks);

View File

@ -28,6 +28,7 @@
#ifdef MOZ_OLD_STYLE
#include "mozilla/css/StyleRule.h"
#endif
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/L10nUtilsBinding.h"
@ -62,7 +63,6 @@
#include "nsIControllers.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMNodeList.h"
@ -106,7 +106,6 @@
#include "HTMLLegendElement.h"
#include "nsWrapperCacheInlines.h"
#include "WrapperFactory.h"
#include "DocumentType.h"
#include <algorithm>
#include "nsGlobalWindow.h"
#include "nsDOMMutationObserver.h"
@ -1048,10 +1047,8 @@ nsINode::IsEqualNode(nsINode* aOther)
}
case DOCUMENT_TYPE_NODE:
{
nsCOMPtr<nsIDOMDocumentType> docType1 = do_QueryInterface(node1);
nsCOMPtr<nsIDOMDocumentType> docType2 = do_QueryInterface(node2);
NS_ASSERTION(docType1 && docType2, "Why don't we have a document type node?");
DocumentType* docType1 = static_cast<DocumentType*>(node1);
DocumentType* docType2 = static_cast<DocumentType*>(node2);
// Public ID
docType1->GetPublicId(string1);

View File

@ -418,7 +418,9 @@ public:
/** animation elements */
eANIMATION = 1 << 10,
/** filter elements that implement SVGFilterPrimitiveStandardAttributes */
eFILTER = 1 << 11
eFILTER = 1 << 11,
/** SVGGeometryElement */
eSHAPE = 1 << 12
};
/**

View File

@ -21,7 +21,6 @@
class nsBindingManager;
class nsAtom;
class nsIDocument;
class nsIDOMDocumentType;
class nsIPrincipal;
class nsWindowSizes;
struct PLHashEntry;
@ -137,12 +136,6 @@ public:
protected:
friend class nsIDocument;
friend class nsXULPrototypeDocument;
friend nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** ,
nsNodeInfoManager *,
nsAtom *,
const nsAString& ,
const nsAString& ,
const nsAString& );
/**
* Sets the principal of the document this nodeinfo manager belongs to.

View File

@ -29,6 +29,7 @@ class nsIContent;
namespace mozilla {
namespace dom {
class DocumentType;
class Element;
} // namespace dom
} // namespace mozilla
@ -60,7 +61,7 @@ public:
nsAString& aStr) override { return NS_OK; }
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) override { return NS_OK; }
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
nsAString& aStr) override { return NS_OK; }
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,
mozilla::dom::Element* aOriginalElement,

View File

@ -205,7 +205,7 @@ nsStaticAtom** const kAttributesHTML[] = {
&nsGkAtoms::kind,
&nsGkAtoms::label,
&nsGkAtoms::lang,
&nsGkAtoms::list,
&nsGkAtoms::list_,
&nsGkAtoms::longdesc,
&nsGkAtoms::loop,
&nsGkAtoms::low,
@ -659,7 +659,7 @@ nsStaticAtom** const kElementsMathML[] = {
&nsGkAtoms::divide_, // divide
&nsGkAtoms::domain_, // domain
&nsGkAtoms::domainofapplication_, // domainofapplication
&nsGkAtoms::el_, // el
&nsGkAtoms::el, // el
&nsGkAtoms::emptyset_, // emptyset
&nsGkAtoms::eq_, // eq
&nsGkAtoms::equivalent_, // equivalent
@ -892,7 +892,7 @@ nsStaticAtom** const kAttributesMathML[] = {
&nsGkAtoms::number, // number
&nsGkAtoms::open, // open
&nsGkAtoms::order, // order
&nsGkAtoms::other_, // other
&nsGkAtoms::other, // other
&nsGkAtoms::overflow, // overflow
&nsGkAtoms::position, // position
&nsGkAtoms::role, // role

View File

@ -15,7 +15,6 @@
#include "nsGkAtoms.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocumentType.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsIDocument.h"
@ -29,6 +28,7 @@
#include "nsCRT.h"
#include "nsContentUtils.h"
#include "nsAttrName.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#include "mozilla/intl/LineBreaker.h"
#include "nsParserConstants.h"
@ -360,20 +360,13 @@ nsXMLContentSerializer::AppendComment(nsIContent* aComment,
}
NS_IMETHODIMP
nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
nsXMLContentSerializer::AppendDoctype(DocumentType* aDocType,
nsAString& aStr)
{
nsCOMPtr<nsIDOMDocumentType> docType = do_QueryInterface(aDocType);
NS_ENSURE_ARG(docType);
nsresult rv;
nsAutoString name, publicId, systemId;
rv = docType->GetName(name);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
rv = docType->GetPublicId(publicId);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
rv = docType->GetSystemId(systemId);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
aDocType->GetName(name);
aDocType->GetPublicId(publicId);
aDocType->GetSystemId(systemId);
NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(aStr), NS_ERROR_OUT_OF_MEMORY);

View File

@ -58,7 +58,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) override;
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
nsAString& aStr) override;
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,

View File

@ -12,6 +12,7 @@
#include "mozilla/dom/StructuredCloneHolder.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/BackgroundUtils.h"
@ -51,15 +52,15 @@ private:
namespace {
nsIPrincipal*
GetPrincipalFromWorkerPrivate(WorkerPrivate* aWorkerPrivate)
GetPrincipalFromThreadSafeWorkerRef(ThreadSafeWorkerRef* aWorkerRef)
{
nsIPrincipal* principal = aWorkerPrivate->GetPrincipal();
nsIPrincipal* principal = aWorkerRef->Private()->GetPrincipal();
if (principal) {
return principal;
}
// Walk up to our containing page
WorkerPrivate* wp = aWorkerPrivate;
WorkerPrivate* wp = aWorkerRef->Private();
while (wp->GetParent()) {
wp = wp->GetParent();
}
@ -70,23 +71,23 @@ GetPrincipalFromWorkerPrivate(WorkerPrivate* aWorkerPrivate)
class InitializeRunnable final : public WorkerMainThreadRunnable
{
public:
InitializeRunnable(WorkerPrivate* aWorkerPrivate, nsACString& aOrigin,
InitializeRunnable(ThreadSafeWorkerRef* aWorkerRef, nsACString& aOrigin,
PrincipalInfo& aPrincipalInfo, ErrorResult& aRv)
: WorkerMainThreadRunnable(aWorkerPrivate,
: WorkerMainThreadRunnable(aWorkerRef->Private(),
NS_LITERAL_CSTRING("BroadcastChannel :: Initialize"))
, mWorkerPrivate(GetCurrentThreadWorkerPrivate())
, mWorkerRef(aWorkerRef)
, mOrigin(aOrigin)
, mPrincipalInfo(aPrincipalInfo)
, mRv(aRv)
{
MOZ_ASSERT(mWorkerPrivate);
MOZ_ASSERT(mWorkerRef);
}
bool MainThreadRun() override
{
MOZ_ASSERT(NS_IsMainThread());
nsIPrincipal* principal = GetPrincipalFromWorkerPrivate(mWorkerPrivate);
nsIPrincipal* principal = GetPrincipalFromThreadSafeWorkerRef(mWorkerRef);
if (!principal) {
mRv.Throw(NS_ERROR_FAILURE);
return true;
@ -103,7 +104,7 @@ public:
}
// Walk up to our containing page
WorkerPrivate* wp = mWorkerPrivate;
WorkerPrivate* wp = mWorkerRef->Private();
while (wp->GetParent()) {
wp = wp->GetParent();
}
@ -118,7 +119,7 @@ public:
}
private:
WorkerPrivate* mWorkerPrivate;
RefPtr<ThreadSafeWorkerRef> mWorkerRef;
nsACString& mOrigin;
PrincipalInfo& mPrincipalInfo;
ErrorResult& mRv;
@ -277,42 +278,12 @@ public:
{}
};
class BroadcastChannelWorkerHolder final : public WorkerHolder
{
BroadcastChannel* mChannel;
public:
explicit BroadcastChannelWorkerHolder(BroadcastChannel* aChannel)
: WorkerHolder("BroadcastChannelWorkerHolder")
, mChannel(aChannel)
{
MOZ_COUNT_CTOR(BroadcastChannelWorkerHolder);
}
virtual bool Notify(WorkerStatus aStatus) override
{
if (aStatus >= Closing) {
mChannel->Shutdown();
}
return true;
}
private:
~BroadcastChannelWorkerHolder()
{
MOZ_COUNT_DTOR(BroadcastChannelWorkerHolder);
}
};
} // namespace
BroadcastChannel::BroadcastChannel(nsPIDOMWindowInner* aWindow,
const PrincipalInfo& aPrincipalInfo,
const nsACString& aOrigin,
const nsAString& aChannel)
: DOMEventTargetHelper(aWindow)
, mWorkerHolder(nullptr)
, mChannel(aChannel)
, mInnerID(0)
, mState(StateActive)
@ -325,7 +296,7 @@ BroadcastChannel::BroadcastChannel(nsPIDOMWindowInner* aWindow,
BroadcastChannel::~BroadcastChannel()
{
Shutdown();
MOZ_ASSERT(!mWorkerHolder);
MOZ_ASSERT(!mWorkerRef);
}
JSObject*
@ -343,9 +314,10 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
do_QueryInterface(aGlobal.GetAsSupports());
// Window is null in workers.
RefPtr<BroadcastChannel> bc = new BroadcastChannel(window, aChannel);
nsAutoCString origin;
PrincipalInfo principalInfo;
WorkerPrivate* workerPrivate = nullptr;
if (NS_IsMainThread()) {
nsCOMPtr<nsIGlobalObject> incumbent = mozilla::dom::GetIncumbentGlobal();
@ -372,21 +344,32 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
}
} else {
JSContext* cx = aGlobal.Context();
workerPrivate = GetWorkerPrivateFromContext(cx);
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(cx);
MOZ_ASSERT(workerPrivate);
RefPtr<StrongWorkerRef> workerRef =
StrongWorkerRef::Create(workerPrivate, "BroadcastChannel",
[bc] () { bc->Shutdown(); });
// We are already shutting down the worker. Let's return a non-active
// object.
if (NS_WARN_IF(!workerRef)) {
bc->mState = StateClosed;
return bc.forget();
}
RefPtr<ThreadSafeWorkerRef> tsr = new ThreadSafeWorkerRef(workerRef);
RefPtr<InitializeRunnable> runnable =
new InitializeRunnable(workerPrivate, origin, principalInfo, aRv);
new InitializeRunnable(tsr, origin, principalInfo, aRv);
runnable->Dispatch(Closing, aRv);
}
if (aRv.Failed()) {
return nullptr;
}
if (aRv.Failed()) {
return nullptr;
bc->mWorkerRef = Move(workerRef);
}
RefPtr<BroadcastChannel> bc =
new BroadcastChannel(window, principalInfo, origin, aChannel);
// Register this component to PBackground.
PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
@ -404,7 +387,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
bc->mActor->SetParent(bc);
if (!workerPrivate) {
if (!bc->mWorkerRef) {
MOZ_ASSERT(window);
bc->mInnerID = window->WindowID();
@ -413,13 +396,6 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
if (obs) {
obs->AddObserver(bc, "inner-window-destroyed", false);
}
} else {
bc->mWorkerHolder = new BroadcastChannelWorkerHolder(bc);
if (NS_WARN_IF(!bc->mWorkerHolder->HoldWorker(workerPrivate, Closing))) {
bc->mWorkerHolder = nullptr;
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
}
return bc.forget();
@ -489,8 +465,8 @@ BroadcastChannel::Shutdown()
{
mState = StateClosed;
// The DTOR of this WorkerHolder will release the worker for us.
mWorkerHolder = nullptr;
// The DTOR of this WorkerRef will release the worker for us.
mWorkerRef = nullptr;
if (mActor) {
mActor->SetParent(nullptr);

View File

@ -26,7 +26,7 @@ namespace dom {
class BroadcastChannelChild;
class BroadcastChannelMessage;
class WorkerHolder;
class WorkerRef;
class BroadcastChannel final
: public DOMEventTargetHelper
@ -68,8 +68,6 @@ public:
private:
BroadcastChannel(nsPIDOMWindowInner* aWindow,
const PrincipalInfo& aPrincipalInfo,
const nsACString& aOrigin,
const nsAString& aChannel);
~BroadcastChannel();
@ -83,7 +81,7 @@ private:
RefPtr<BroadcastChannelChild> mActor;
nsAutoPtr<WorkerHolder> mWorkerHolder;
RefPtr<WorkerRef> mWorkerRef;
nsString mChannel;

View File

@ -15,7 +15,6 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/dom/WorkerPrivate.h"
namespace mozilla {

View File

@ -59,7 +59,7 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
aName, /* aNotify = */ false);
// Indicate whether the iframe is should be remote.
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::Remote,
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::remote,
aRemote ? NS_LITERAL_STRING("true") :
NS_LITERAL_STRING("false"),
/* aNotify = */ false);

View File

@ -66,8 +66,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DataTransfer)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DataTransfer)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(mozilla::dom::DataTransfer)
NS_INTERFACE_MAP_ENTRY(nsIDOMDataTransfer)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDataTransfer)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
// the size of the array
@ -223,16 +222,7 @@ DataTransfer::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return DataTransferBinding::Wrap(aCx, this, aGivenProto);
}
NS_IMETHODIMP
DataTransfer::GetDropEffect(nsAString& aDropEffect)
{
nsString dropEffect;
GetDropEffect(dropEffect);
aDropEffect = dropEffect;
return NS_OK;
}
NS_IMETHODIMP
void
DataTransfer::SetDropEffect(const nsAString& aDropEffect)
{
// the drop effect can only be 'none', 'copy', 'move' or 'link'.
@ -246,25 +236,14 @@ DataTransfer::SetDropEffect(const nsAString& aDropEffect)
break;
}
}
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::GetEffectAllowed(nsAString& aEffectAllowed)
{
nsString effectAllowed;
GetEffectAllowed(effectAllowed);
aEffectAllowed = effectAllowed;
return NS_OK;
}
NS_IMETHODIMP
void
DataTransfer::SetEffectAllowed(const nsAString& aEffectAllowed)
{
if (aEffectAllowed.EqualsLiteral("uninitialized")) {
mEffectAllowed = nsIDragService::DRAGDROP_ACTION_UNINITIALIZED;
return NS_OK;
return;
}
static_assert(nsIDragService::DRAGDROP_ACTION_NONE == 0,
@ -282,29 +261,6 @@ DataTransfer::SetEffectAllowed(const nsAString& aEffectAllowed)
break;
}
}
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::GetDropEffectInt(uint32_t* aDropEffect)
{
*aDropEffect = mDropEffect;
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::SetDropEffectInt(uint32_t aDropEffect)
{
mDropEffect = aDropEffect;
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::GetEffectAllowedInt(uint32_t* aEffectAllowed)
{
*aEffectAllowed = mEffectAllowed;
return NS_OK;
}
void
@ -321,46 +277,12 @@ DataTransfer::GetMozTriggeringPrincipalURISpec(nsAString& aPrincipalURISpec)
CopyUTF8toUTF16(principalURISpec, aPrincipalURISpec);
}
NS_IMETHODIMP
DataTransfer::SetEffectAllowedInt(uint32_t aEffectAllowed)
{
mEffectAllowed = aEffectAllowed;
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::GetMozUserCancelled(bool* aUserCancelled)
{
*aUserCancelled = MozUserCancelled();
return NS_OK;
}
already_AddRefed<FileList>
DataTransfer::GetFiles(nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)
DataTransfer::GetFiles(nsIPrincipal& aSubjectPrincipal)
{
return mItems->Files(&aSubjectPrincipal);
}
NS_IMETHODIMP
DataTransfer::GetFiles(nsIDOMFileList** aFileList)
{
if (!aFileList) {
return NS_ERROR_FAILURE;
}
// The XPCOM interface is only avaliable to system code, and thus we can
// assume the system principal. This is consistent with the previous behavour
// of this function, which also assumed the system principal.
//
// This code is also called from C++ code, which expects it to have a System
// Principal, and thus the SubjectPrincipal cannot be used.
RefPtr<FileList> files = mItems->Files(nsContentUtils::GetSystemPrincipal());
files.forget(aFileList);
return NS_OK;
}
void
DataTransfer::GetTypes(nsTArray<nsString>& aTypes, CallerType aCallerType) const
{
@ -494,29 +416,11 @@ DataTransfer::ClearData(const Optional<nsAString>& aFormat,
}
}
NS_IMETHODIMP
DataTransfer::GetMozItemCount(uint32_t* aCount)
{
*aCount = MozItemCount();
return NS_OK;
}
NS_IMETHODIMP
DataTransfer::GetMozCursor(nsAString& aCursorState)
{
nsString cursor;
GetMozCursor(cursor);
aCursorState = cursor;
return NS_OK;
}
NS_IMETHODIMP
void
DataTransfer::SetMozCursor(const nsAString& aCursorState)
{
// Lock the cursor to an arrow during the drag.
mCursorState = aCursorState.EqualsLiteral("default");
return NS_OK;
}
already_AddRefed<nsINode>
@ -538,18 +442,6 @@ DataTransfer::GetMozSourceNode()
return node.forget();
}
NS_IMETHODIMP
DataTransfer::GetMozSourceNode(nsIDOMNode** aSourceNode)
{
nsCOMPtr<nsINode> sourceNode = GetMozSourceNode();
if (!sourceNode) {
*aSourceNode = nullptr;
return NS_OK;
}
return CallQueryInterface(sourceNode, aSourceNode);
}
already_AddRefed<DOMStringList>
DataTransfer::MozTypesAt(uint32_t aIndex, CallerType aCallerType,
ErrorResult& aRv) const
@ -843,16 +735,6 @@ DataTransfer::SetDragImage(Element& aImage, int32_t aX, int32_t aY)
}
}
NS_IMETHODIMP
DataTransfer::SetDragImage(nsIDOMElement* aImage, int32_t aX, int32_t aY)
{
nsCOMPtr<Element> image = do_QueryInterface(aImage);
if (image) {
SetDragImage(*image, aX, aY);
}
return NS_OK;
}
void
DataTransfer::UpdateDragImage(Element& aImage, int32_t aX, int32_t aY)
{
@ -924,19 +806,6 @@ DataTransfer::AddElement(Element& aElement, ErrorResult& aRv)
mDragTarget = &aElement;
}
NS_IMETHODIMP
DataTransfer::AddElement(nsIDOMElement* aElement)
{
NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
nsCOMPtr<Element> element = do_QueryInterface(aElement);
NS_ENSURE_TRUE(element, NS_ERROR_INVALID_ARG);
ErrorResult rv;
AddElement(*element, rv);
return rv.StealNSResult();
}
nsresult
DataTransfer::Clone(nsISupports* aParent, EventMessage aEventMessage,
bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,

View File

@ -11,11 +11,12 @@
#include "nsTArray.h"
#include "nsIVariant.h"
#include "nsIPrincipal.h"
#include "nsIDOMDataTransfer.h"
#include "nsIDOMElement.h"
#include "nsIDragService.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/BindingDeclarations.h"
@ -43,24 +44,18 @@ template<typename T> class Optional;
{ 0x6c5f90d1, 0xa886, 0x42c8, \
{ 0x85, 0x06, 0x10, 0xbe, 0x5c, 0x0d, 0xc6, 0x77 } }
class DataTransfer final : public nsIDOMDataTransfer,
class DataTransfer final : public nsISupports,
public nsWrapperCache
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DATATRANSFER_IID)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMDATATRANSFER
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DataTransfer)
friend class mozilla::EventStateManager;
static DataTransfer* Cast(nsIDOMDataTransfer* aArg)
{
return static_cast<DataTransfer*>(aArg);
}
/// An enum which represents which "Drag Data Store Mode" the DataTransfer is
/// in according to the spec.
enum class Mode : uint8_t {
@ -128,12 +123,57 @@ public:
Constructor(const GlobalObject& aGlobal, const nsAString& aEventType,
bool aIsExternal, ErrorResult& aRv);
void GetDropEffect(nsString& aDropEffect)
/**
* The actual effect that will be used, and should always be one of the
* possible values of effectAllowed.
*
* For dragstart, drag and dragleave events, the dropEffect is initialized
* to none. Any value assigned to the dropEffect will be set, but the value
* isn't used for anything.
*
* For the dragenter and dragover events, the dropEffect will be initialized
* based on what action the user is requesting. How this is determined is
* platform specific, but typically the user can press modifier keys to
* adjust which action is desired. Within an event handler for the dragenter
* and dragover events, the dropEffect should be modified if the action the
* user is requesting is not the one that is desired.
*
* For the drop and dragend events, the dropEffect will be initialized to
* the action that was desired, which will be the value that the dropEffect
* had after the last dragenter or dragover event.
*
* Possible values:
* copy - a copy of the source item is made at the new location
* move - an item is moved to a new location
* link - a link is established to the source at the new location
* none - the item may not be dropped
*
* Assigning any other value has no effect and retains the old value.
*/
void GetDropEffect(nsAString& aDropEffect)
{
aDropEffect.AssignASCII(sEffects[mDropEffect]);
}
void SetDropEffect(const nsAString& aDropEffect);
void GetEffectAllowed(nsString& aEffectAllowed)
/*
* Specifies the effects that are allowed for this drag. You may set this in
* the dragstart event to set the desired effects for the source, and within
* the dragenter and dragover events to set the desired effects for the
* target. The value is not used for other events.
*
* Possible values:
* copy - a copy of the source item is made at the new location
* move - an item is moved to a new location
* link - a link is established to the source at the new location
* copyLink, copyMove, linkMove, all - combinations of the above
* none - the item may not be dropped
* uninitialized - the default value when the effect has not been set,
* equivalent to all.
*
* Assigning any other value has no effect and retains the old value.
*/
void GetEffectAllowed(nsAString& aEffectAllowed)
{
if (mEffectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED) {
aEffectAllowed.AssignLiteral("uninitialized");
@ -141,7 +181,26 @@ public:
aEffectAllowed.AssignASCII(sEffects[mEffectAllowed]);
}
}
void SetEffectAllowed(const nsAString& aEffectAllowed);
/**
* Set the image to be used for dragging if a custom one is desired. Most of
* the time, this would not be set, as a default image is created from the
* node that was dragged.
*
* If the node is an HTML img element, an HTML canvas element or a XUL image
* element, the image data is used. Otherwise, image should be a visible
* node and the drag image will be created from this. If image is null, any
* custom drag image is cleared and the default is used instead.
*
* The coordinates specify the offset into the image where the mouse cursor
* should be. To center the image for instance, use values that are half the
* width and height.
*
* @param image a node to use
* @param x the horizontal offset
* @param y the vertical offset
*/
void SetDragImage(Element& aElement, int32_t aX, int32_t aY);
void UpdateDragImage(Element& aElement, int32_t aX, int32_t aY);
@ -159,9 +218,13 @@ public:
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aRv);
/**
* Holds a list of all the local files available on this data transfer.
* A dataTransfer containing no files will return an empty list, and an
* invalid index access on the resulting file list will return null.
*/
already_AddRefed<FileList>
GetFiles(nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aRv);
GetFiles(nsIPrincipal& aSubjectPrincipal);
already_AddRefed<Promise>
GetFilesAndDirectories(nsIPrincipal& aSubjectPrincipal,
@ -177,7 +240,7 @@ public:
uint32_t MozItemCount() const;
void GetMozCursor(nsString& aCursor)
void GetMozCursor(nsAString& aCursor)
{
if (mCursorState) {
aCursor.AssignLiteral("default");
@ -185,6 +248,7 @@ public:
aCursor.AssignLiteral("auto");
}
}
void SetMozCursor(const nsAString& aCursor);
already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex,
CallerType aCallerType,
@ -211,6 +275,29 @@ public:
already_AddRefed<nsINode> GetMozSourceNode();
/*
* Integer version of dropEffect, set to one of the constants in nsIDragService.
*/
uint32_t DropEffectInt() const
{
return mDropEffect;
}
void SetDropEffectInt(uint32_t aDropEffectInt)
{
MOZ_RELEASE_ASSERT(aDropEffectInt < ArrayLength(sEffects),
"Bogus drop effect value");
mDropEffect = aDropEffectInt;
}
/*
* Integer version of effectAllowed, set to one or a combination of the
* constants in nsIDragService.
*/
uint32_t EffectAllowedInt() const
{
return mEffectAllowed;
}
void GetMozTriggeringPrincipalURISpec(nsAString& aPrincipalURISpec);
mozilla::dom::Element* GetDragTarget() const

View File

@ -239,13 +239,13 @@ DataTransferItemList::Files(nsIPrincipal* aPrincipal)
// advanced caching mechanism for the FileList objects will be required.
RefPtr<FileList> files;
if (nsContentUtils::IsSystemPrincipal(aPrincipal)) {
files = new FileList(static_cast<nsIDOMDataTransfer*>(mDataTransfer));
files = new FileList(mDataTransfer);
GenerateFiles(files, aPrincipal);
return files.forget();
}
if (!mFiles) {
mFiles = new FileList(static_cast<nsIDOMDataTransfer*>(mDataTransfer));
mFiles = new FileList(mDataTransfer);
mFilesPrincipal = aPrincipal;
RegenerateFiles();
}

View File

@ -66,13 +66,6 @@ DragEvent::InitDragEvent(const nsAString& aType,
}
}
NS_IMETHODIMP
DragEvent::GetDataTransfer(nsIDOMDataTransfer** aDataTransfer)
{
NS_IF_ADDREF(*aDataTransfer = GetDataTransfer());
return NS_OK;
}
DataTransfer*
DragEvent::GetDataTransfer()
{

View File

@ -30,12 +30,20 @@ public:
NS_DECL_NSIDOMDRAGEVENT
NS_FORWARD_TO_MOUSEEVENT
// And now pull in some things we just shadowed.
using UIEvent::GetRangeParent;
using UIEvent::RangeOffset;
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return DragEventBinding::Wrap(aCx, this, aGivenProto);
}
DragEvent* AsDragEvent() override
{
return this;
}
DataTransfer* GetDataTransfer();
void InitDragEvent(const nsAString& aType,

View File

@ -30,6 +30,7 @@ namespace mozilla {
namespace dom {
class BeforeUnloadEvent;
class DragEvent;
class EventTarget;
class EventMessageAutoOverride;
// ExtendableEvent is a ServiceWorker event that is not
@ -126,6 +127,12 @@ public:
return nullptr;
}
// DragEvent has a non-autogeneratable initDragEvent.
virtual DragEvent* AsDragEvent()
{
return nullptr;
}
// nsIDOMEvent Interface
NS_DECL_NSIDOMEVENT

View File

@ -1337,10 +1337,9 @@ EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
dragSession->DragEventDispatchedToChildProcess();
dragSession->GetDragAction(&action);
dragSession->GetTriggeringPrincipalURISpec(principalURISpec);
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
if (initialDataTransfer) {
initialDataTransfer->GetDropEffectInt(&dropEffect);
dropEffect = initialDataTransfer->DropEffectInt();
}
}
@ -2059,10 +2058,12 @@ EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
// No drag session is currently active, so check if a handler added
// any items to be dragged. If not, there isn't anything to drag.
uint32_t count = 0;
if (aDataTransfer)
aDataTransfer->GetMozItemCount(&count);
if (!count)
if (aDataTransfer) {
count = aDataTransfer->MozItemCount();
}
if (!count) {
return false;
}
// Get the target being dragged, which may not be the same as the
// target of the mouse event. If one wasn't set in the
@ -2077,8 +2078,7 @@ EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
// check which drag effect should initially be used. If the effect was not
// set, just use all actions, otherwise Windows won't allow a drop.
uint32_t action;
aDataTransfer->GetEffectAllowedInt(&action);
uint32_t action = aDataTransfer->EffectAllowedInt();
if (action == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED)
action = nsIDragService::DRAGDROP_ACTION_COPY |
nsIDragService::DRAGDROP_ACTION_MOVE |
@ -2101,9 +2101,7 @@ EventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
false, getter_AddRefs(dataTransfer));
// Copy over the drop effect, as Clone doesn't copy it for us.
uint32_t dropEffect;
aDataTransfer->GetDropEffectInt(&dropEffect);
dataTransfer->SetDropEffectInt(dropEffect);
dataTransfer->SetDropEffectInt(aDataTransfer->DropEffectInt());
// XXXndeakin don't really want to create a new drag DOM event
// here, but we need something to pass to the InvokeDragSession
@ -3531,9 +3529,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// the initial dataTransfer is the one from the dragstart event that
// was set on the dragSession when the drag began.
nsCOMPtr<nsIDOMDataTransfer> dataTransfer;
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
RefPtr<DataTransfer> dataTransfer;
RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
WidgetDragEvent *dragEvent = aEvent->AsDragEvent();
@ -3556,8 +3553,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// if the event has a dataTransfer set, use it.
if (dragEvent->mDataTransfer) {
// get the dataTransfer and the dropEffect that was set on it
dataTransfer = do_QueryInterface(dragEvent->mDataTransfer);
dataTransfer->GetDropEffectInt(&dropEffect);
dataTransfer = dragEvent->mDataTransfer;
dropEffect = dataTransfer->DropEffectInt();
}
else {
// if dragEvent->mDataTransfer is null, it means that no attempt was
@ -3581,8 +3578,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// drag was originally started by directly calling the drag service.
// Just assume that all effects are allowed.
uint32_t effectAllowed = nsIDragService::DRAGDROP_ACTION_UNINITIALIZED;
if (dataTransfer)
dataTransfer->GetEffectAllowedInt(&effectAllowed);
if (dataTransfer) {
effectAllowed = dataTransfer->EffectAllowedInt();
}
// set the drag action based on the drop effect and effect allowed.
// The drop effect field on the drag transfer object specifies the
@ -4779,8 +4777,7 @@ EventStateManager::UpdateDragDataTransfer(WidgetDragEvent* dragEvent)
if (dragSession) {
// the initial dataTransfer is the one from the dragstart event that
// was set on the dragSession when the drag began.
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
if (initialDataTransfer) {
// retrieve the current moz cursor setting and save it.
nsAutoString mozCursor;

View File

@ -16,7 +16,8 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileReaderBinding.h"
#include "mozilla/dom/ProgressEvent.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/Encoding.h"
#include "nsAlgorithm.h"
@ -93,9 +94,8 @@ FileReader::RootResultArrayBuffer()
//FileReader constructors/initializers
FileReader::FileReader(nsIGlobalObject* aGlobal,
WorkerPrivate* aWorkerPrivate)
WeakWorkerRef* aWorkerRef)
: DOMEventTargetHelper(aGlobal)
, WorkerHolder("FileReader")
, mFileData(nullptr)
, mDataLen(0)
, mDataFormat(FILE_AS_BINARY)
@ -106,10 +106,10 @@ FileReader::FileReader(nsIGlobalObject* aGlobal,
, mTotal(0)
, mTransferred(0)
, mBusyCount(0)
, mWorkerPrivate(aWorkerPrivate)
, mWeakWorkerRef(aWorkerRef)
{
MOZ_ASSERT(aGlobal);
MOZ_ASSERT(NS_IsMainThread() == !mWorkerPrivate);
MOZ_ASSERT_IF(NS_IsMainThread(), !mWeakWorkerRef);
if (NS_IsMainThread()) {
mTarget = aGlobal->EventTargetFor(TaskCategory::Other);
@ -130,15 +130,16 @@ FileReader::~FileReader()
FileReader::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
WorkerPrivate* workerPrivate = nullptr;
RefPtr<WeakWorkerRef> workerRef;
if (!NS_IsMainThread()) {
JSContext* cx = aGlobal.Context();
workerPrivate = GetWorkerPrivateFromContext(cx);
MOZ_ASSERT(workerPrivate);
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(cx);
workerRef = WeakWorkerRef::Create(workerPrivate);
}
RefPtr<FileReader> fileReader = new FileReader(global, workerPrivate);
RefPtr<FileReader> fileReader = new FileReader(global, workerRef);
return fileReader.forget();
}
@ -384,6 +385,11 @@ FileReader::ReadFileContent(Blob& aBlob,
eDataFormat aDataFormat,
ErrorResult& aRv)
{
if (IsCurrentThreadRunningWorker() && !mWeakWorkerRef) {
// The worker is already shutting down.
return;
}
if (mReadyState == LOADING) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
@ -647,7 +653,7 @@ FileReader::OnInputStreamReady(nsIAsyncInputStream* aStream)
// We use this class to decrease the busy counter at the end of this method.
// In theory we can do it immediatelly but, for debugging reasons, we want to
// be 100% sure we have a workerHolder when OnLoadEnd() is called.
// be 100% sure we have a workerRef when OnLoadEnd() is called.
FileReaderDecreaseBusyCounter RAII(this);
uint64_t count;
@ -778,9 +784,21 @@ FileReader::Abort()
nsresult
FileReader::IncreaseBusyCounter()
{
if (mWorkerPrivate && mBusyCount++ == 0 &&
!HoldWorker(mWorkerPrivate, Closing)) {
return NS_ERROR_FAILURE;
if (mWeakWorkerRef && mBusyCount++ == 0) {
if (NS_WARN_IF(!mWeakWorkerRef->GetPrivate())) {
return NS_ERROR_FAILURE;
}
RefPtr<FileReader> self = this;
RefPtr<StrongWorkerRef> ref =
StrongWorkerRef::Create(mWeakWorkerRef->GetPrivate(), "FileReader",
[self]() { self->Shutdown(); });
if (NS_WARN_IF(!ref)) {
return NS_ERROR_FAILURE;
}
mStrongWorkerRef = ref;
}
return NS_OK;
@ -789,25 +807,12 @@ FileReader::IncreaseBusyCounter()
void
FileReader::DecreaseBusyCounter()
{
MOZ_ASSERT_IF(mWorkerPrivate, mBusyCount);
if (mWorkerPrivate && --mBusyCount == 0) {
ReleaseWorker();
MOZ_ASSERT_IF(mStrongWorkerRef, mBusyCount);
if (mStrongWorkerRef && --mBusyCount == 0) {
mStrongWorkerRef = nullptr;
}
}
bool
FileReader::Notify(WorkerStatus aStatus)
{
MOZ_ASSERT(mWorkerPrivate);
mWorkerPrivate->AssertIsOnWorkerThread();
if (aStatus > Running) {
Shutdown();
}
return true;
}
void
FileReader::Shutdown()
{
@ -821,9 +826,9 @@ FileReader::Shutdown()
FreeFileData();
mResultArrayBuffer = nullptr;
if (mWorkerPrivate && mBusyCount != 0) {
ReleaseWorker();
mWorkerPrivate = nullptr;
if (mWeakWorkerRef && mBusyCount != 0) {
mStrongWorkerRef = nullptr;
mWeakWorkerRef = nullptr;
mBusyCount = 0;
}
}

View File

@ -9,7 +9,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/WorkerHolder.h"
#include "nsIAsyncInputStream.h"
#include "nsIInterfaceRequestor.h"
@ -28,7 +27,8 @@ namespace dom {
class Blob;
class DOMException;
class WorkerPrivate;
class StrongWorkerRef;
class WeakWorkerRef;
extern const uint64_t kUnknownSize;
@ -39,14 +39,13 @@ class FileReader final : public DOMEventTargetHelper,
public nsSupportsWeakReference,
public nsIInputStreamCallback,
public nsITimerCallback,
public nsINamed,
public WorkerHolder
public nsINamed
{
friend class FileReaderDecreaseBusyCounter;
public:
FileReader(nsIGlobalObject* aGlobal,
WorkerPrivate* aWorkerPrivate);
WeakWorkerRef* aWorkerRef);
NS_DECL_ISUPPORTS_INHERITED
@ -111,9 +110,6 @@ public:
ReadFileContent(aBlob, EmptyString(), FILE_AS_BINARY, aRv);
}
// WorkerHolder
bool Notify(WorkerStatus) override;
private:
virtual ~FileReader();
@ -197,8 +193,14 @@ private:
uint64_t mBusyCount;
// Kept alive with a WorkerHolder.
WorkerPrivate* mWorkerPrivate;
// This is set if FileReader is created on workers, but it is null if the
// worker is shutting down. The null value is checked in ReadFileContent()
// before starting any reading.
RefPtr<WeakWorkerRef> mWeakWorkerRef;
// This value is set when the reading starts in order to keep the worker alive
// during the process.
RefPtr<StrongWorkerRef> mStrongWorkerRef;
};
} // dom namespace

View File

@ -1843,7 +1843,7 @@ nsGenericHTMLElement*
HTMLInputElement::GetList() const
{
nsAutoString dataListId;
GetAttr(kNameSpaceID_None, nsGkAtoms::list, dataListId);
GetAttr(kNameSpaceID_None, nsGkAtoms::list_, dataListId);
if (dataListId.IsEmpty()) {
return nullptr;
}

View File

@ -35,24 +35,21 @@ HTMLMetaElement::~HTMLMetaElement()
NS_IMPL_ELEMENT_CLONE(HTMLMetaElement)
nsresult
void
HTMLMetaElement::SetMetaReferrer(nsIDocument* aDocument)
{
if (!aDocument ||
!AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, nsGkAtoms::referrer, eIgnoreCase)) {
return NS_OK;
return;
}
nsAutoString content;
nsresult rv = GetContent(content);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
GetContent(content);
Element* headElt = aDocument->GetHeadElement();
if (headElt && nsContentUtils::ContentIsDescendantOf(this, headElt)) {
content = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(content);
aDocument->SetHeaderData(nsGkAtoms::referrer, content);
}
return NS_OK;
}
nsresult
@ -68,17 +65,13 @@ HTMLMetaElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
if (document && AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
nsGkAtoms::viewport, eIgnoreCase)) {
nsAutoString content;
nsresult rv = GetContent(content);
NS_ENSURE_SUCCESS(rv, rv);
GetContent(content);
nsContentUtils::ProcessViewportInfo(document, content);
}
CreateAndDispatchEvent(document, NS_LITERAL_STRING("DOMMetaChanged"));
}
// Update referrer policy when it got changed from JS
nsresult rv = SetMetaReferrer(document);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
SetMetaReferrer(document);
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
@ -97,8 +90,7 @@ HTMLMetaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aDocument &&
AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, nsGkAtoms::viewport, eIgnoreCase)) {
nsAutoString content;
rv = GetContent(content);
NS_ENSURE_SUCCESS(rv, rv);
GetContent(content);
nsContentUtils::ProcessViewportInfo(aDocument, content);
}
@ -111,8 +103,7 @@ HTMLMetaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (headElt && nsContentUtils::ContentIsDescendantOf(this, headElt)) {
nsAutoString content;
rv = GetContent(content);
NS_ENSURE_SUCCESS(rv, rv);
GetContent(content);
content = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(content);
nsIPrincipal* principal = aDocument->NodePrincipal();
@ -145,10 +136,7 @@ HTMLMetaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// Referrer Policy spec requires a <meta name="referrer" tag to be in the
// <head> element.
rv = SetMetaReferrer(aDocument);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
SetMetaReferrer(aDocument);
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMMetaAdded"));
return rv;
}

View File

@ -54,10 +54,9 @@ public:
{
SetHTMLAttr(nsGkAtoms::httpEquiv, aHttpEquiv, aRv);
}
nsresult GetContent(nsAString& aValue)
void GetContent(nsAString& aValue)
{
GetHTMLAttr(nsGkAtoms::content, aValue);
return NS_OK;
}
void SetContent(const nsAString& aContent, ErrorResult& aRv)
{
@ -78,7 +77,7 @@ protected:
virtual ~HTMLMetaElement();
private:
nsresult SetMetaReferrer(nsIDocument* aDocument);
void SetMetaReferrer(nsIDocument* aDocument);
};
} // namespace dom

View File

@ -37,7 +37,6 @@
#include "nsGenericHTMLElement.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIScriptElement.h"
#include "nsIComponentManager.h"

View File

@ -20,7 +20,6 @@ interface nsIDOMCharacterData;
interface nsIDOMComment;
interface nsIDOMDocument;
interface nsIDOMDocumentFragment;
interface nsIDOMDocumentType;
interface nsIDOMElement;
interface nsIDOMNode;
interface nsIDOMNodeList;

View File

@ -12,7 +12,6 @@ XPIDL_SOURCES += [
'nsIDOMComment.idl',
'nsIDOMDocument.idl',
'nsIDOMDocumentFragment.idl',
'nsIDOMDocumentType.idl',
'nsIDOMDOMException.idl',
'nsIDOMElement.idl',
'nsIDOMNode.idl',

View File

@ -1,25 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMNode.idl"
/**
* Each Document has a doctype attribute whose value is either null
* or a DocumentType object.
* The nsIDOMDocumentType interface in the DOM Core provides an
* interface to the list of entities that are defined for the document.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
*/
[uuid(cd7467b9-0f26-4787-a359-66e80ba8db92)]
interface nsIDOMDocumentType : nsIDOMNode
{
readonly attribute DOMString name;
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
readonly attribute DOMString internalSubset;
};

View File

@ -9,7 +9,6 @@ with Files("**"):
XPIDL_SOURCES += [
'nsIDOMCustomEvent.idl',
'nsIDOMDataTransfer.idl',
'nsIDOMDragEvent.idl',
'nsIDOMEvent.idl',
'nsIDOMEventListener.idl',

View File

@ -1,143 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
interface nsIVariant;
interface nsIDOMFileList;
[builtinclass, uuid(655078bf-1675-4aa0-a48d-a133e864ce57)]
interface nsIDOMDataTransfer : nsISupports
{
/**
* The actual effect that will be used, and should always be one of the
* possible values of effectAllowed.
*
* For dragstart, drag and dragleave events, the dropEffect is initialized
* to none. Any value assigned to the dropEffect will be set, but the value
* isn't used for anything.
*
* For the dragenter and dragover events, the dropEffect will be initialized
* based on what action the user is requesting. How this is determined is
* platform specific, but typically the user can press modifier keys to
* adjust which action is desired. Within an event handler for the dragenter
* and dragover events, the dropEffect should be modified if the action the
* user is requesting is not the one that is desired.
*
* For the drop and dragend events, the dropEffect will be initialized to
* the action that was desired, which will be the value that the dropEffect
* had after the last dragenter or dragover event.
*
* Possible values:
* copy - a copy of the source item is made at the new location
* move - an item is moved to a new location
* link - a link is established to the source at the new location
* none - the item may not be dropped
*
* Assigning any other value has no effect and retains the old value.
*/
attribute DOMString dropEffect;
/*
* Specifies the effects that are allowed for this drag. You may set this in
* the dragstart event to set the desired effects for the source, and within
* the dragenter and dragover events to set the desired effects for the
* target. The value is not used for other events.
*
* Possible values:
* copy - a copy of the source item is made at the new location
* move - an item is moved to a new location
* link - a link is established to the source at the new location
* copyLink, copyMove, linkMove, all - combinations of the above
* none - the item may not be dropped
* uninitialized - the default value when the effect has not been set,
* equivalent to all.
*
* Assigning any other value has no effect and retains the old value.
*/
attribute DOMString effectAllowed;
/**
* Holds a list of all the local files available on this data transfer.
* A dataTransfer containing no files will return an empty list, and an
* invalid index access on the resulting file list will return null.
*/
readonly attribute nsIDOMFileList files;
/**
* Set the image to be used for dragging if a custom one is desired. Most of
* the time, this would not be set, as a default image is created from the
* node that was dragged.
*
* If the node is an HTML img element, an HTML canvas element or a XUL image
* element, the image data is used. Otherwise, image should be a visible
* node and the drag image will be created from this. If image is null, any
* custom drag image is cleared and the default is used instead.
*
* The coordinates specify the offset into the image where the mouse cursor
* should be. To center the image for instance, use values that are half the
* width and height.
*
* @param image a node to use
* @param x the horizontal offset
* @param y the vertical offset
* @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
*/
void setDragImage(in nsIDOMElement image, in long x, in long y);
/*
* Set the drag source. Usually you would not change this, but it will
* affect which node the drag and dragend events are fired at. The
* default target is the node that was dragged.
*
* @param element drag source to use
* @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
*/
void addElement(in nsIDOMElement element);
/**
* The number of items being dragged.
*/
readonly attribute unsigned long mozItemCount;
/**
* Sets the drag cursor state. Primarily used to control the cursor during
* tab drags, but could be expanded to other uses. XXX Currently implemented
* on Win32 only.
*
* Possible values:
* auto - use default system behavior.
* default - set the cursor to an arrow during the drag operation.
*
* Values other than 'default' are indentical to setting mozCursor to
* 'auto'.
*/
attribute DOMString mozCursor;
/**
* Will be true when the user has cancelled the drag (typically by pressing
* Escape) and when the drag has been cancelled unexpectedly. This will be
* false otherwise, including when the drop has been rejected by its target.
* This property is only relevant for the dragend event.
*/
readonly attribute boolean mozUserCancelled;
/**
* The node that the mouse was pressed over to begin the drag. For external
* drags, or if the caller cannot access this node, this will be null.
*/
readonly attribute nsIDOMNode mozSourceNode;
/*
* Integer version of dropEffect, set to one of the constants in nsIDragService.
*/
[noscript] attribute unsigned long dropEffectInt;
/*
* Integer version of effectAllowed, set to one or a combination of the
* constants in nsIDragService.
*/
[noscript] attribute unsigned long effectAllowedInt;
};

View File

@ -6,10 +6,8 @@
#include "domstubs.idl"
#include "nsIDOMMouseEvent.idl"
interface nsIDOMDataTransfer;
// FIXME: Bug 1445417, we should really remove this interface.
[builtinclass, uuid(d5c0d4c2-c646-4b4b-836e-48408b9c7b80)]
interface nsIDOMDragEvent : nsIDOMMouseEvent
{
readonly attribute nsIDOMDataTransfer dataTransfer;
};

View File

@ -4512,9 +4512,7 @@ ContentParent::MaybeInvokeDragSession(TabParent* aParent)
dragService->GetCurrentSession(getter_AddRefs(session));
if (session) {
nsTArray<IPCDataTransfer> dataTransfers;
nsCOMPtr<nsIDOMDataTransfer> domTransfer;
session->GetDataTransfer(getter_AddRefs(domTransfer));
nsCOMPtr<DataTransfer> transfer = do_QueryInterface(domTransfer);
RefPtr<DataTransfer> transfer = session->GetDataTransfer();
if (!transfer) {
// Pass eDrop to get DataTransfer with external
// drag formats cached.
@ -4548,8 +4546,7 @@ ContentParent::RecvUpdateDropEffect(const uint32_t& aDragAction,
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (dragSession) {
dragSession->SetDragAction(aDragAction);
nsCOMPtr<nsIDOMDataTransfer> dt;
dragSession->GetDataTransfer(getter_AddRefs(dt));
RefPtr<DataTransfer> dt = dragSession->GetDataTransfer();
if (dt) {
dt->SetDropEffectInt(aDropEffect);
}

View File

@ -19,6 +19,7 @@
#include "mozilla/BrowserElementParent.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
#include "mozilla/dom/PaymentRequestChild.h"
#include "mozilla/dom/TelemetryScrollProbe.h"
@ -1955,8 +1956,7 @@ TabChild::RecvRealDragEvent(const WidgetDragEvent& aEvent,
if (dragSession) {
dragSession->SetDragAction(aDragAction);
dragSession->SetTriggeringPrincipalURISpec(aPrincipalURISpec);
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
if (initialDataTransfer) {
initialDataTransfer->SetDropEffectInt(aDropEffect);
}

View File

@ -1179,8 +1179,7 @@ TabParent::QueryDropLinksForVerification()
return false;
}
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
RefPtr<DataTransfer> initialDataTransfer = dragSession->GetDataTransfer();
if (!initialDataTransfer) {
NS_WARNING("No initialDataTransfer to query links for verification");
return false;

View File

@ -9,7 +9,6 @@
#include "mozilla/dom/MessageChannelBinding.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/Navigator.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "nsContentUtils.h"
#include "nsIDocument.h"

View File

@ -18,7 +18,7 @@
#include "mozilla/dom/PMessagePort.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/StructuredCloneTags.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
@ -200,41 +200,6 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(MessagePort, DOMEventTargetHelper)
NS_IMPL_RELEASE_INHERITED(MessagePort, DOMEventTargetHelper)
namespace {
class MessagePortWorkerHolder final : public WorkerHolder
{
MessagePort* mPort;
public:
explicit MessagePortWorkerHolder(MessagePort* aPort)
: WorkerHolder("MessagePortWorkerHolder")
, mPort(aPort)
{
MOZ_ASSERT(aPort);
MOZ_COUNT_CTOR(MessagePortWorkerHolder);
}
virtual bool Notify(WorkerStatus aStatus) override
{
if (aStatus > Running) {
// We cannot process messages anymore because we cannot dispatch new
// runnables. Let's force a Close().
mPort->CloseForced();
}
return true;
}
private:
~MessagePortWorkerHolder()
{
MOZ_COUNT_DTOR(MessagePortWorkerHolder);
}
};
} // namespace
MessagePort::MessagePort(nsIGlobalObject* aGlobal)
: DOMEventTargetHelper(aGlobal)
, mInnerID(0)
@ -251,7 +216,7 @@ MessagePort::MessagePort(nsIGlobalObject* aGlobal)
MessagePort::~MessagePort()
{
CloseForced();
MOZ_ASSERT(!mWorkerHolder);
MOZ_ASSERT(!mWorkerRef);
}
/* static */ already_AddRefed<MessagePort>
@ -304,7 +269,7 @@ MessagePort::Initialize(const nsID& aUUID,
if (mNeutered) {
// If this port is neutered we don't want to keep it alive artificially nor
// we want to add listeners or workerWorkerHolders.
// we want to add listeners or WorkerRefs.
mState = eStateDisentangled;
return;
}
@ -322,17 +287,24 @@ MessagePort::Initialize(const nsID& aUUID,
UpdateMustKeepAlive();
if (!NS_IsMainThread()) {
RefPtr<MessagePort> self = this;
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(workerPrivate);
MOZ_ASSERT(!mWorkerHolder);
nsAutoPtr<WorkerHolder> workerHolder(new MessagePortWorkerHolder(this));
if (NS_WARN_IF(!workerHolder->HoldWorker(workerPrivate, Closing))) {
aRv.Throw(NS_ERROR_FAILURE);
// When the callback is executed, we cannot process messages anymore because
// we cannot dispatch new runnables. Let's force a Close().
RefPtr<StrongWorkerRef> strongWorkerRef =
StrongWorkerRef::Create(workerPrivate, "MessagePort",
[self]() { self->CloseForced(); });
if (NS_WARN_IF(!strongWorkerRef)) {
// The worker is shutting down. Let's return an already closed port.
mState = eStateDisentangledForClose;
return;
}
mWorkerHolder = Move(workerHolder);
MOZ_ASSERT(!mWorkerRef);
mWorkerRef = Move(strongWorkerRef);
} else if (GetOwner()) {
MOZ_ASSERT(NS_IsMainThread());
mInnerID = GetOwner()->WindowID();
@ -869,8 +841,8 @@ MessagePort::UpdateMustKeepAlive()
mIsKeptAlive) {
mIsKeptAlive = false;
// The DTOR of this WorkerHolder will release the worker for us.
mWorkerHolder = nullptr;
// The DTOR of this WorkerRef will release the worker for us.
mWorkerRef = nullptr;
if (NS_IsMainThread()) {
nsCOMPtr<nsIObserverService> obs =

View File

@ -26,7 +26,7 @@ class MessagePortChild;
class MessagePortIdentifier;
class PostMessageRunnable;
class SharedMessagePortMessage;
class WorkerHolder;
class StrongWorkerRef;
class MessagePort final : public DOMEventTargetHelper
, public nsIObserver
@ -162,7 +162,7 @@ private:
return mIsKeptAlive;
}
nsAutoPtr<WorkerHolder> mWorkerHolder;
RefPtr<StrongWorkerRef> mWorkerRef;
RefPtr<PostMessageRunnable> mPostMessageRunnable;

View File

@ -7,6 +7,7 @@
#include <limits>
#include "mozilla/Hal.h"
#include "ConnectionWorker.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"
namespace mozilla {
@ -14,7 +15,6 @@ namespace dom {
namespace network {
class ConnectionProxy final : public NetworkObserver
, public WorkerHolder
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ConnectionProxy)
@ -22,45 +22,37 @@ public:
static already_AddRefed<ConnectionProxy>
Create(WorkerPrivate* aWorkerPrivate, ConnectionWorker* aConnection)
{
RefPtr<ConnectionProxy> proxy =
new ConnectionProxy(aWorkerPrivate, aConnection);
if (!proxy->HoldWorker(aWorkerPrivate, Closing)) {
proxy->mConnection = nullptr;
RefPtr<ConnectionProxy> proxy = new ConnectionProxy(aConnection);
RefPtr<StrongWorkerRef> workerRef =
StrongWorkerRef::Create(aWorkerPrivate, "ConnectionProxy",
[proxy]() { proxy->Shutdown(); });
if (NS_WARN_IF(!workerRef)) {
return nullptr;
}
proxy->mWorkerRef = new ThreadSafeWorkerRef(workerRef);
return proxy.forget();
}
ThreadSafeWorkerRef* WorkerRef() const { return mWorkerRef; }
// For IObserver - main-thread only.
void Notify(const hal::NetworkInformation& aNetworkInfo) override;
// Worker notification
virtual bool Notify(WorkerStatus aStatus) override
{
Shutdown();
return true;
}
void Shutdown();
void Update(ConnectionType aType, bool aIsWifi, uint32_t aDHCPGateway)
{
MOZ_ASSERT(mConnection);
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(IsCurrentThreadRunningWorker());
mConnection->Update(aType, aIsWifi, aDHCPGateway, true);
}
private:
ConnectionProxy(WorkerPrivate* aWorkerPrivate, ConnectionWorker* aConnection)
: WorkerHolder("ConnectionProxy")
, mConnection(aConnection)
, mWorkerPrivate(aWorkerPrivate)
{
MOZ_ASSERT(mWorkerPrivate);
MOZ_ASSERT(mConnection);
mWorkerPrivate->AssertIsOnWorkerThread();
}
explicit ConnectionProxy(ConnectionWorker* aConnection)
: mConnection(aConnection)
{}
~ConnectionProxy() = default;
@ -69,7 +61,7 @@ private:
// shutdown procedure starts.
ConnectionWorker* mConnection;
WorkerPrivate* mWorkerPrivate;
RefPtr<ThreadSafeWorkerRef> mWorkerRef;
};
namespace {
@ -168,7 +160,7 @@ public:
/* static */ already_AddRefed<ConnectionWorker>
ConnectionWorker::Create(WorkerPrivate* aWorkerPrivate, ErrorResult& aRv)
{
RefPtr<ConnectionWorker> c = new ConnectionWorker(aWorkerPrivate);
RefPtr<ConnectionWorker> c = new ConnectionWorker();
c->mProxy = ConnectionProxy::Create(aWorkerPrivate, c);
if (!c->mProxy) {
aRv.ThrowTypeError<MSG_WORKER_THREAD_SHUTTING_DOWN>();
@ -189,12 +181,10 @@ ConnectionWorker::Create(WorkerPrivate* aWorkerPrivate, ErrorResult& aRv)
return c.forget();
}
ConnectionWorker::ConnectionWorker(WorkerPrivate* aWorkerPrivate)
ConnectionWorker::ConnectionWorker()
: Connection(nullptr)
, mWorkerPrivate(aWorkerPrivate)
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(IsCurrentThreadRunningWorker());
}
ConnectionWorker::~ConnectionWorker()
@ -205,7 +195,7 @@ ConnectionWorker::~ConnectionWorker()
void
ConnectionWorker::ShutdownInternal()
{
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(IsCurrentThreadRunningWorker());
mProxy->Shutdown();
}
@ -215,7 +205,7 @@ ConnectionProxy::Notify(const hal::NetworkInformation& aNetworkInfo)
MOZ_ASSERT(NS_IsMainThread());
RefPtr<NotifyRunnable> runnable =
new NotifyRunnable(mWorkerPrivate, this,
new NotifyRunnable(mWorkerRef->Private(), this,
static_cast<ConnectionType>(aNetworkInfo.type()),
aNetworkInfo.isWifi(), aNetworkInfo.dhcpGateway());
runnable->Dispatch();
@ -224,7 +214,7 @@ ConnectionProxy::Notify(const hal::NetworkInformation& aNetworkInfo)
void
ConnectionProxy::Shutdown()
{
mWorkerPrivate->AssertIsOnWorkerThread();
MOZ_ASSERT(IsCurrentThreadRunningWorker());
// Already shut down.
if (!mConnection) {
@ -234,7 +224,7 @@ ConnectionProxy::Shutdown()
mConnection = nullptr;
RefPtr<ShutdownRunnable> runnable =
new ShutdownRunnable(mWorkerPrivate, this);
new ShutdownRunnable(mWorkerRef->Private(), this);
ErrorResult rv;
// This runnable _must_ be executed.
@ -243,7 +233,7 @@ ConnectionProxy::Shutdown()
rv.SuppressException();
}
ReleaseWorker();
mWorkerRef = nullptr;
}
} // namespace network

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