Merge mozilla-inbound to mozilla-central. a=merge

This commit is contained in:
Dorel Luca 2018-03-29 12:50:33 +03:00
Родитель 3e1eaab1ee 9cd4eecb3c
Коммит 57bbc1ac58
279 изменённых файлов: 2455 добавлений и 2849 удалений

Просмотреть файл

@ -61,10 +61,12 @@ tasks:
- "notify.email.${ownerEmail}.on-failed"
- "notify.email.${ownerEmail}.on-exception"
else:
- "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
- $if: 'tasks_for == "action"'
then: "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
else: "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
$if: 'tasks_for == "action"'
then:
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
- "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
else:
- "index.gecko.v2.${repository.project}.latest.firefox.decision-${cron.job_name}"
scopes:
$if: 'tasks_for == "hg-push"'

Просмотреть файл

@ -11,6 +11,7 @@
#include "AccIterator.h"
#include "nsCoreUtils.h"
#include "nsIDOMXULLabeledControlEl.h"
#include "mozilla/dom/Text.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -116,7 +117,7 @@ nsresult
nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
nsAString *aString)
{
if (aContent->IsNodeOfType(nsINode::eTEXT)) {
if (aContent->IsText()) {
bool isHTMLBlock = false;
nsIContent *parentContent = aContent->GetFlattenedTreeParent();
@ -146,7 +147,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
aString->Append(text.mString);
} else {
// If aContent is an object that is display: none, we have no a frame.
aContent->AppendTextTo(*aString);
aContent->GetAsText()->AppendTextTo(*aString);
}
if (isHTMLBlock && !aString->IsEmpty()) {
aString->Append(char16_t(' '));

Просмотреть файл

@ -0,0 +1,6 @@
"use strict";
module.exports = {
"extends": "../../../../toolkit/components/extensions/child/.eslintrc.js",
};

Просмотреть файл

@ -2,28 +2,28 @@
extensions.registerModules({
devtools: {
url: "chrome://browser/content/ext-c-devtools.js",
url: "chrome://browser/content/child/ext-devtools.js",
scopes: ["devtools_child"],
paths: [
["devtools"],
],
},
devtools_inspectedWindow: {
url: "chrome://browser/content/ext-c-devtools-inspectedWindow.js",
url: "chrome://browser/content/child/ext-devtools-inspectedWindow.js",
scopes: ["devtools_child"],
paths: [
["devtools", "inspectedWindow"],
],
},
devtools_panels: {
url: "chrome://browser/content/ext-c-devtools-panels.js",
url: "chrome://browser/content/child/ext-devtools-panels.js",
scopes: ["devtools_child"],
paths: [
["devtools", "panels"],
],
},
devtools_network: {
url: "chrome://browser/content/ext-c-devtools-network.js",
url: "chrome://browser/content/child/ext-devtools-network.js",
scopes: ["devtools_child"],
paths: [
["devtools", "network"],
@ -31,7 +31,7 @@ extensions.registerModules({
},
// Because of permissions, the module name must differ from both namespaces.
menusInternal: {
url: "chrome://browser/content/ext-c-menus.js",
url: "chrome://browser/content/child/ext-menus.js",
scopes: ["addon_child"],
paths: [
["contextMenus"],
@ -39,14 +39,14 @@ extensions.registerModules({
],
},
omnibox: {
url: "chrome://browser/content/ext-c-omnibox.js",
url: "chrome://browser/content/child/ext-omnibox.js",
scopes: ["addon_child"],
paths: [
["omnibox"],
],
},
tabs: {
url: "chrome://browser/content/ext-c-tabs.js",
url: "chrome://browser/content/child/ext-tabs.js",
scopes: ["addon_child"],
paths: [
["tabs"],

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ../../../toolkit/components/extensions/ext-c-toolkit.js */
/**
* Responsible for fetching HTTP response content from the backend.
*

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ../../../toolkit/components/extensions/ext-c-toolkit.js */
ChromeUtils.defineModuleGetter(this, "ExtensionChildDevToolsUtils",
"resource://gre/modules/ExtensionChildDevToolsUtils.jsm");

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ../../../toolkit/components/extensions/ext-c-toolkit.js */
var {
withHandlingUserInput,
} = ExtensionUtils;

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ../../../toolkit/components/extensions/ext-c-toolkit.js */
this.omnibox = class extends ExtensionAPI {
getAPI(context) {
return {

Просмотреть файл

@ -1,6 +1,6 @@
{
"bookmarks": {
"url": "chrome://browser/content/ext-bookmarks.js",
"url": "chrome://browser/content/parent/ext-bookmarks.js",
"schema": "chrome://browser/content/schemas/bookmarks.json",
"scopes": ["addon_parent"],
"paths": [
@ -8,7 +8,7 @@
]
},
"browserAction": {
"url": "chrome://browser/content/ext-browserAction.js",
"url": "chrome://browser/content/parent/ext-browserAction.js",
"schema": "chrome://browser/content/schemas/browser_action.json",
"scopes": ["addon_parent"],
"manifest": ["browser_action"],
@ -17,7 +17,7 @@
]
},
"browsingData": {
"url": "chrome://browser/content/ext-browsingData.js",
"url": "chrome://browser/content/parent/ext-browsingData.js",
"schema": "chrome://browser/content/schemas/browsing_data.json",
"scopes": ["addon_parent"],
"paths": [
@ -25,14 +25,14 @@
]
},
"chrome_settings_overrides": {
"url": "chrome://browser/content/ext-chrome-settings-overrides.js",
"url": "chrome://browser/content/parent/ext-chrome-settings-overrides.js",
"scopes": [],
"events": ["update", "uninstall"],
"schema": "chrome://browser/content/schemas/chrome_settings_overrides.json",
"manifest": ["chrome_settings_overrides"]
},
"commands": {
"url": "chrome://browser/content/ext-commands.js",
"url": "chrome://browser/content/parent/ext-commands.js",
"schema": "chrome://browser/content/schemas/commands.json",
"scopes": ["addon_parent"],
"events": ["uninstall"],
@ -42,7 +42,7 @@
]
},
"devtools": {
"url": "chrome://browser/content/ext-devtools.js",
"url": "chrome://browser/content/parent/ext-devtools.js",
"schema": "chrome://browser/content/schemas/devtools.json",
"scopes": ["devtools_parent"],
"manifest": ["devtools_page"],
@ -51,7 +51,7 @@
]
},
"devtools_inspectedWindow": {
"url": "chrome://browser/content/ext-devtools-inspectedWindow.js",
"url": "chrome://browser/content/parent/ext-devtools-inspectedWindow.js",
"schema": "chrome://browser/content/schemas/devtools_inspected_window.json",
"scopes": ["devtools_parent"],
"paths": [
@ -59,7 +59,7 @@
]
},
"devtools_network": {
"url": "chrome://browser/content/ext-devtools-network.js",
"url": "chrome://browser/content/parent/ext-devtools-network.js",
"schema": "chrome://browser/content/schemas/devtools_network.json",
"scopes": ["devtools_parent"],
"paths": [
@ -67,7 +67,7 @@
]
},
"devtools_panels": {
"url": "chrome://browser/content/ext-devtools-panels.js",
"url": "chrome://browser/content/parent/ext-devtools-panels.js",
"schema": "chrome://browser/content/schemas/devtools_panels.json",
"scopes": ["devtools_parent"],
"paths": [
@ -75,7 +75,7 @@
]
},
"find": {
"url": "chrome://browser/content/ext-find.js",
"url": "chrome://browser/content/parent/ext-find.js",
"schema": "chrome://browser/content/schemas/find.json",
"scopes": ["addon_parent"],
"paths": [
@ -83,7 +83,7 @@
]
},
"history": {
"url": "chrome://browser/content/ext-history.js",
"url": "chrome://browser/content/parent/ext-history.js",
"schema": "chrome://browser/content/schemas/history.json",
"scopes": ["addon_parent"],
"paths": [
@ -91,7 +91,7 @@
]
},
"identity": {
"url": "chrome://extensions/content/ext-identity.js",
"url": "chrome://extensions/content/parent/ext-identity.js",
"schema": "chrome://extensions/content/schemas/identity.json",
"scopes": ["addon_parent"],
"paths": [
@ -99,7 +99,7 @@
]
},
"menusInternal": {
"url": "chrome://browser/content/ext-menus.js",
"url": "chrome://browser/content/parent/ext-menus.js",
"schema": "chrome://browser/content/schemas/menus.json",
"scopes": ["addon_parent"],
"paths": [
@ -109,7 +109,7 @@
]
},
"omnibox": {
"url": "chrome://browser/content/ext-omnibox.js",
"url": "chrome://browser/content/parent/ext-omnibox.js",
"schema": "chrome://browser/content/schemas/omnibox.json",
"scopes": ["addon_parent"],
"manifest": ["omnibox"],
@ -118,7 +118,7 @@
]
},
"pageAction": {
"url": "chrome://browser/content/ext-pageAction.js",
"url": "chrome://browser/content/parent/ext-pageAction.js",
"schema": "chrome://browser/content/schemas/page_action.json",
"scopes": ["addon_parent"],
"manifest": ["page_action"],
@ -127,7 +127,7 @@
]
},
"pkcs11": {
"url": "chrome://browser/content/ext-pkcs11.js",
"url": "chrome://browser/content/parent/ext-pkcs11.js",
"schema": "chrome://browser/content/schemas/pkcs11.json",
"scopes": ["addon_parent"],
"paths": [
@ -135,7 +135,7 @@
]
},
"geckoProfiler": {
"url": "chrome://browser/content/ext-geckoProfiler.js",
"url": "chrome://browser/content/parent/ext-geckoProfiler.js",
"schema": "chrome://browser/content/schemas/geckoProfiler.json",
"scopes": ["addon_parent"],
"paths": [
@ -143,7 +143,7 @@
]
},
"sessions": {
"url": "chrome://browser/content/ext-sessions.js",
"url": "chrome://browser/content/parent/ext-sessions.js",
"schema": "chrome://browser/content/schemas/sessions.json",
"scopes": ["addon_parent"],
"paths": [
@ -151,7 +151,7 @@
]
},
"sidebarAction": {
"url": "chrome://browser/content/ext-sidebarAction.js",
"url": "chrome://browser/content/parent/ext-sidebarAction.js",
"schema": "chrome://browser/content/schemas/sidebar_action.json",
"scopes": ["addon_parent"],
"manifest": ["sidebar_action"],
@ -160,7 +160,7 @@
]
},
"tabs": {
"url": "chrome://browser/content/ext-tabs.js",
"url": "chrome://browser/content/parent/ext-tabs.js",
"schema": "chrome://browser/content/schemas/tabs.json",
"scopes": ["addon_parent"],
"events": ["update", "disable"],
@ -169,7 +169,7 @@
]
},
"urlOverrides": {
"url": "chrome://browser/content/ext-url-overrides.js",
"url": "chrome://browser/content/parent/ext-url-overrides.js",
"schema": "chrome://browser/content/schemas/url_overrides.json",
"scopes": ["addon_parent"],
"manifest": ["chrome_url_overrides"],
@ -178,7 +178,7 @@
]
},
"windows": {
"url": "chrome://browser/content/ext-windows.js",
"url": "chrome://browser/content/parent/ext-windows.js",
"schema": "chrome://browser/content/schemas/windows.json",
"scopes": ["addon_parent"],
"paths": [

Просмотреть файл

@ -1,7 +1,7 @@
category webextension-modules browser chrome://browser/content/ext-browser.json
category webextension-scripts c-browser chrome://browser/content/ext-browser.js
category webextension-scripts-devtools browser chrome://browser/content/ext-c-browser.js
category webextension-scripts-addon browser chrome://browser/content/ext-c-browser.js
category webextension-scripts c-browser chrome://browser/content/parent/ext-browser.js
category webextension-scripts-devtools browser chrome://browser/content/child/ext-browser.js
category webextension-scripts-addon browser chrome://browser/content/child/ext-browser.js
category webextension-schemas menus_internal chrome://browser/content/schemas/menus_internal.json

Просмотреть файл

@ -12,34 +12,34 @@ browser.jar:
content/browser/extension-win-panel.css
#endif
content/browser/extension.svg
content/browser/ext-bookmarks.js
content/browser/ext-browser.js
content/browser/ext-browser.json
content/browser/ext-browserAction.js
content/browser/ext-browsingData.js
content/browser/ext-chrome-settings-overrides.js
content/browser/ext-commands.js
content/browser/ext-devtools.js
content/browser/ext-devtools-inspectedWindow.js
content/browser/ext-devtools-network.js
content/browser/ext-devtools-panels.js
content/browser/ext-find.js
content/browser/ext-geckoProfiler.js
content/browser/ext-history.js
content/browser/ext-menus.js
content/browser/ext-omnibox.js
content/browser/ext-pageAction.js
content/browser/ext-pkcs11.js
content/browser/ext-sessions.js
content/browser/ext-sidebarAction.js
content/browser/ext-tabs.js
content/browser/ext-url-overrides.js
content/browser/ext-windows.js
content/browser/ext-c-browser.js
content/browser/ext-c-devtools-inspectedWindow.js
content/browser/ext-c-devtools-network.js
content/browser/ext-c-devtools-panels.js
content/browser/ext-c-devtools.js
content/browser/ext-c-menus.js
content/browser/ext-c-omnibox.js
content/browser/ext-c-tabs.js
content/browser/parent/ext-bookmarks.js (parent/ext-bookmarks.js)
content/browser/parent/ext-browser.js (parent/ext-browser.js)
content/browser/parent/ext-browserAction.js (parent/ext-browserAction.js)
content/browser/parent/ext-browsingData.js (parent/ext-browsingData.js)
content/browser/parent/ext-chrome-settings-overrides.js (parent/ext-chrome-settings-overrides.js)
content/browser/parent/ext-commands.js (parent/ext-commands.js)
content/browser/parent/ext-devtools.js (parent/ext-devtools.js)
content/browser/parent/ext-devtools-inspectedWindow.js (parent/ext-devtools-inspectedWindow.js)
content/browser/parent/ext-devtools-network.js (parent/ext-devtools-network.js)
content/browser/parent/ext-devtools-panels.js (parent/ext-devtools-panels.js)
content/browser/parent/ext-find.js (parent/ext-find.js)
content/browser/parent/ext-geckoProfiler.js (parent/ext-geckoProfiler.js)
content/browser/parent/ext-history.js (parent/ext-history.js)
content/browser/parent/ext-menus.js (parent/ext-menus.js)
content/browser/parent/ext-omnibox.js (parent/ext-omnibox.js)
content/browser/parent/ext-pageAction.js (parent/ext-pageAction.js)
content/browser/parent/ext-pkcs11.js (parent/ext-pkcs11.js)
content/browser/parent/ext-sessions.js (parent/ext-sessions.js)
content/browser/parent/ext-sidebarAction.js (parent/ext-sidebarAction.js)
content/browser/parent/ext-tabs.js (parent/ext-tabs.js)
content/browser/parent/ext-url-overrides.js (parent/ext-url-overrides.js)
content/browser/parent/ext-windows.js (parent/ext-windows.js)
content/browser/child/ext-browser.js (child/ext-browser.js)
content/browser/child/ext-devtools-inspectedWindow.js (child/ext-devtools-inspectedWindow.js)
content/browser/child/ext-devtools-network.js (child/ext-devtools-network.js)
content/browser/child/ext-devtools-panels.js (child/ext-devtools-panels.js)
content/browser/child/ext-devtools.js (child/ext-devtools.js)
content/browser/child/ext-menus.js (child/ext-menus.js)
content/browser/child/ext-omnibox.js (child/ext-omnibox.js)
content/browser/child/ext-tabs.js (child/ext-tabs.js)

Просмотреть файл

@ -0,0 +1,29 @@
"use strict";
module.exports = {
"extends": "../../../../toolkit/components/extensions/parent/.eslintrc.js",
"globals": {
"Tab": true,
"TabContext": true,
"Window": true,
"WindowEventManager": true,
"actionContextMenu": true,
"browserActionFor": true,
"getContainerForCookieStoreId": true,
"getDevToolsTargetForContext": true,
"getInspectedWindowFront": true,
"getTargetTabIdForToolbox": true,
"getToolboxEvalOptions": true,
"isContainerCookieStoreId": true,
"isPrivateCookieStoreId": true,
"isValidCookieStoreId": true,
"makeWidgetId": true,
"openOptionsPage": true,
"pageActionFor": true,
"sidebarActionFor": true,
"tabGetSender": true,
"tabTracker": true,
"windowTracker": true,
},
};

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browserAction.js */
ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
const {

Просмотреть файл

@ -6,12 +6,6 @@
// modules. All of the code is installed on |global|, which is a scope
// shared among the different ext-*.js scripts.
/* global EventEmitter:false, TabContext:false, WindowEventManager:false,
makeWidgetId:false, tabTracker:true, windowTracker:true */
/* import-globals-from ../../../toolkit/components/extensions/ext-toolkit.js */
/* globals TabBase, WindowBase, TabTrackerBase, WindowTrackerBase, TabManagerBase, WindowManagerBase */
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
ChromeUtils.defineModuleGetter(this, "RecentWindow",

Просмотреть файл

@ -2,12 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
/* exported browserActionFor, sidebarActionFor, pageActionFor */
/* global browserActionFor:false, sidebarActionFor:false, pageActionFor:false */
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
ChromeUtils.defineModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
ChromeUtils.defineModuleGetter(this, "clearTimeout",

Просмотреть файл

@ -2,15 +2,15 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browserAction.js */
/* import-globals-from ext-browser.js */
ChromeUtils.defineModuleGetter(this, "ExtensionParent",
"resource://gre/modules/ExtensionParent.jsm");
ChromeUtils.defineModuleGetter(this, "ExtensionSettingsStore",
"resource://gre/modules/ExtensionSettingsStore.jsm");
var {
ExtensionError,
} = ExtensionUtils;
var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const EXECUTE_PAGE_ACTION = "_execute_page_action";

Просмотреть файл

@ -2,10 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-devtools.js */
/* import-globals-from ext-browser.js */
var {
SpreadArgs,
} = ExtensionCommon;

Просмотреть файл

@ -2,13 +2,14 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-devtools.js */
var {
SpreadArgs,
} = ExtensionCommon;
var {
ExtensionError,
} = ExtensionUtils;
this.devtools_network = class extends ExtensionAPI {
getAPI(context) {
return {

Просмотреть файл

@ -2,10 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-devtools.js */
/* import-globals-from ext-browser.js */
ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm");
ChromeUtils.defineModuleGetter(this, "E10SUtils",

Просмотреть файл

@ -2,12 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
/* exported getDevToolsTargetForContext, getInspectedWindowFront, getToolboxEvalOptions */
/* global getTargetTabIdForToolbox, getDevToolsTargetForContext, getInspectedWindowFront, getToolboxEvalOptions */
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
/**
* This module provides helpers used by the other specialized `ext-devtools-*.js` modules
* and the implementation of the `devtools_page`.

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ../../../toolkit/components/extensions/ext-toolkit.js */
ChromeUtils.import("resource://gre/modules/Services.jsm");
Cu.importGlobalProperties(["TextEncoder", "TextDecoder"]);

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browserAction.js */
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Services",

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ../../../toolkit/components/extensions/ext-toolkit.js */
ChromeUtils.defineModuleGetter(this, "ExtensionSearchHandler",
"resource://gre/modules/ExtensionSearchHandler.jsm");

Просмотреть файл

@ -2,10 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browserAction.js */
/* import-globals-from ext-browser.js */
ChromeUtils.defineModuleGetter(this, "PageActions",
"resource:///modules/PageActions.jsm");
ChromeUtils.defineModuleGetter(this, "PanelPopup",
@ -21,6 +17,10 @@ var {
StartupCache,
} = ExtensionParent;
var {
DefaultWeakMap,
} = ExtensionUtils;
const popupOpenTimingHistogram = "WEBEXT_PAGEACTION_POPUP_OPEN_MS";
// WeakMap[Extension -> PageAction]

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
var {
ExtensionError,
promiseObserved,

Просмотреть файл

@ -2,10 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
/* globals WINDOW_ID_CURRENT */
ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm");
var {
@ -432,7 +428,7 @@ this.sidebarAction = class extends ExtensionAPI {
isOpen(details) {
let {windowId} = details;
if (windowId == null) {
windowId = WINDOW_ID_CURRENT;
windowId = Window.WINDOW_ID_CURRENT;
}
let window = windowTracker.getWindow(windowId, context);
return sidebarAction.isOpen(window);

Просмотреть файл

@ -2,10 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
/* import-globals-from ../../../toolkit/components/extensions/ext-tabs-base.js */
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PromiseUtils",
@ -146,7 +142,7 @@ class TabsUpdateFilterEventManager extends EventManager {
}
function getWindowID(windowId) {
if (windowId === WINDOW_ID_CURRENT) {
if (windowId === Window.WINDOW_ID_CURRENT) {
return windowTracker.getId(windowTracker.topWindow);
}
return windowId;

Просмотреть файл

@ -1,7 +1,6 @@
/* 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/. */
/* import-globals-from ext-browser.js */
"use strict";

Просмотреть файл

@ -2,9 +2,6 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
// The ext-* files are imported into the same scopes.
/* import-globals-from ext-browser.js */
XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
"@mozilla.org/browser/aboutnewtab-service;1",
"nsIAboutNewTabService");

Просмотреть файл

@ -5,3 +5,4 @@ support-files =
tags = webextensions
[test_ext_all_apis.html]
skip-if = true

Просмотреть файл

@ -45,6 +45,7 @@ class RemoteAutomation(Automation):
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['MOZ_CRASHREPORTER'] = '1'
env['MOZ_CRASHREPORTER_SHUTDOWN'] = '1'
else:
env['MOZ_CRASHREPORTER_DISABLE'] = '1'

Просмотреть файл

@ -66,6 +66,12 @@ NullPrincipal::Create(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
return nullPrin.forget();
}
/* static */ already_AddRefed<NullPrincipal>
NullPrincipal::CreateWithoutOriginAttributes()
{
return NullPrincipal::Create(mozilla::OriginAttributes(), nullptr);
}
nsresult
NullPrincipal::Init(const OriginAttributes& aOriginAttributes, nsIURI* aURI)
{

Просмотреть файл

@ -64,9 +64,12 @@ public:
CreateWithInheritedAttributes(nsIDocShell* aDocShell, bool aIsFirstParty = false);
static already_AddRefed<NullPrincipal>
Create(const mozilla::OriginAttributes& aOriginAttributes = mozilla::OriginAttributes(),
Create(const mozilla::OriginAttributes& aOriginAttributes,
nsIURI* aURI = nullptr);
static already_AddRefed<NullPrincipal>
CreateWithoutOriginAttributes();
nsresult Init(const mozilla::OriginAttributes& aOriginAttributes = mozilla::OriginAttributes(),
nsIURI* aURI = nullptr);

Просмотреть файл

@ -90,6 +90,8 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(CharacterData)
return Element::CanSkipThis(tmp);
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
// We purposefully don't TRAVERSE_BEGIN_INHERITED here. All the bits
// we should traverse should be added here or in nsINode::Traverse.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(CharacterData)
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
char name[40];
@ -105,6 +107,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(CharacterData)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
// We purposefully don't UNLINK_BEGIN_INHERITED here.
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CharacterData)
nsIContent::Unlink(tmp);
@ -119,23 +122,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CharacterData)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN(CharacterData)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(CharacterData)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
// DOM bindings depend on the identity pointer being the
// same as nsINode (which nsIContent inherits).
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_END
NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_ADDREF(CharacterData)
NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(CharacterData,
nsNodeUtils::LastRelease(this))
NS_INTERFACE_MAP_END_INHERITING(nsIContent)
void
CharacterData::GetNodeValueInternal(nsAString& aNodeValue)
@ -786,46 +774,6 @@ CharacterData::ThreadSafeTextIsOnlyWhitespace() const
return true;
}
bool
CharacterData::HasTextForTranslation()
{
if (NodeType() != TEXT_NODE &&
NodeType() != CDATA_SECTION_NODE) {
return false;
}
if (mText.Is2b()) {
// The fragment contains non-8bit characters which means there
// was at least one "interesting" character to trigger non-8bit.
return true;
}
if (HasFlag(NS_CACHED_TEXT_IS_ONLY_WHITESPACE) &&
HasFlag(NS_TEXT_IS_ONLY_WHITESPACE)) {
return false;
}
const char* cp = mText.Get1b();
const char* end = cp + mText.GetLength();
unsigned char ch;
for (; cp < end; cp++) {
ch = *cp;
// These are the characters that are letters
// in the first 256 UTF-8 codepoints.
if ((ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
(ch >= 192 && ch <= 214) ||
(ch >= 216 && ch <= 246) ||
(ch >= 248)) {
return true;
}
}
return false;
}
void
CharacterData::AppendTextTo(nsAString& aResult)
{

Просмотреть файл

@ -77,7 +77,11 @@ namespace dom {
class CharacterData : public nsIContent
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
// We want to avoid the overhead of extra function calls for
// refcounting when we're not doing refcount logging, so we can't
// NS_DECL_ISUPPORTS_INHERITED.
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
NS_INLINE_DECL_REFCOUNTING_INHERITED(CharacterData, nsIContent);
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
@ -130,22 +134,42 @@ public:
virtual const nsTextFragment *GetText() override;
virtual uint32_t TextLength() const override;
virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) override;
// Need to implement this here too to avoid hiding.
/**
* Set the text to the given value. If aNotify is true then
* the document is notified of the content change.
*/
nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify);
/**
* Append the given value to the current text. If aNotify is true then
* the document is notified of the content change.
*/
nsresult SetText(const nsAString& aStr, bool aNotify)
{
return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
}
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) override;
/**
* Append the given value to the current text. If aNotify is true then
* the document is notified of the content change.
*/
nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify);
virtual bool TextIsOnlyWhitespace() override;
bool ThreadSafeTextIsOnlyWhitespace() const final;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
/**
* Append the text content to aResult.
*/
void AppendTextTo(nsAString& aResult);
/**
* Append the text content to aResult.
*/
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult,
const fallible_t&) override;
bool AppendTextTo(nsAString& aResult, const fallible_t&);
virtual void SaveSubtreeState() override;
#ifdef DEBUG
@ -193,7 +217,8 @@ public:
void ToCString(nsAString& aBuf, int32_t aOffset, int32_t aLen) const;
#endif
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(CharacterData)
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(CharacterData,
nsIContent)
protected:
virtual ~CharacterData();
@ -223,21 +248,6 @@ protected:
nsTextFragment mText;
public:
virtual bool OwnedOnlyByTheDOMTree() override
{
return GetParent() && mRefCnt.get() == 1;
}
virtual bool IsPurple() override
{
return mRefCnt.IsPurple();
}
virtual void RemovePurple() override
{
mRefCnt.RemovePurple();
}
private:
already_AddRefed<nsAtom> GetCurrentValueAtom();
};

Просмотреть файл

@ -346,7 +346,7 @@ DOMParser::Init(nsIPrincipal* principal, nsIURI* documentURI,
// Don't give DOMParsers the system principal. Use a null
// principal instead.
mOriginalPrincipalWasSystem = true;
mPrincipal = NullPrincipal::Create();
mPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
if (!mDocumentURI) {
rv = mPrincipal->GetURI(getter_AddRefs(mDocumentURI));
@ -457,7 +457,7 @@ DOMParser::SetUpDocument(DocumentFlavor aFlavor, nsIDOMDocument** aResult)
NS_ENSURE_TRUE(!mAttemptedInit, NS_ERROR_NOT_INITIALIZED);
AttemptedInitMarker marker(&mAttemptedInit);
nsCOMPtr<nsIPrincipal> prin = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> prin = NullPrincipal::CreateWithoutOriginAttributes();
rv = Init(prin, nullptr, nullptr, scriptHandlingObject);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -941,7 +941,11 @@ public:
void ListAttributes(FILE* out) const;
#endif
void Describe(nsAString& aOutDescription) const override;
/**
* Append to aOutDescription a short (preferably one line) string
* describing the element.
*/
void Describe(nsAString& aOutDescription) const;
/*
* Attribute Mapping Helpers

Просмотреть файл

@ -134,6 +134,35 @@ int32_t nsIContent::sTabFocusModel = eTabFocus_any;
bool nsIContent::sTabFocusModelAppliesToXUL = false;
uint64_t nsMutationGuard::sGeneration = 0;
NS_IMPL_CYCLE_COLLECTION_CLASS(nsIContent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsIContent)
MOZ_ASSERT_UNREACHABLE("Our subclasses don't call us");
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsIContent)
MOZ_ASSERT_UNREACHABLE("Our subclasses don't call us");
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN(nsIContent)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
// Don't bother to QI to cycle collection, because our CC impl is
// not doing anything anyway.
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
// DOM bindings depend on the identity pointer being the
// same as nsINode (which nsIContent inherits).
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_ADDREF(nsIContent)
NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(nsIContent,
nsNodeUtils::LastRelease(this))
nsIContent*
nsIContent::FindFirstNonChromeOnlyAccessContent() const
{
@ -182,7 +211,7 @@ nsIContent::GetAssignedSlotByMode() const
nsIContent::IMEState
nsIContent::GetDesiredIMEState()
{
if (!IsEditableInternal()) {
if (!IsEditable()) {
// Check for the special case where we're dealing with elements which don't
// have the editable flag set, but are readwrite (such as text controls).
if (!IsElement() ||
@ -227,7 +256,7 @@ dom::Element*
nsIContent::GetEditingHost()
{
// If this isn't editable, return nullptr.
if (!IsEditableInternal()) {
if (!IsEditable()) {
return nullptr;
}
@ -1426,8 +1455,9 @@ FragmentOrElement::ClearContentUnbinder()
NS_IMPL_CYCLE_COLLECTION_CLASS(FragmentOrElement)
// We purposefully don't UNLINK_BEGIN_INHERITED here.
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FragmentOrElement)
nsINode::Unlink(tmp);
nsIContent::Unlink(tmp);
// The XBL binding is removed by RemoveFromBindingManagerRunnable
// which is dispatched in UnbindFromTree.
@ -1921,6 +1951,8 @@ static const char* kNSURIs[] = {
" (XML Events)"
};
// We purposefully don't TRAVERSE_BEGIN_INHERITED here. All the bits
// we should traverse should be added here or in nsINode::Traverse.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
char name[512];
@ -1973,7 +2005,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(FragmentOrElement, tmp->mRefCnt.get())
}
if (!nsINode::Traverse(tmp, cb)) {
if (!nsIContent::Traverse(tmp, cb)) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
@ -2045,22 +2077,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
// DOM bindings depend on the identity pointer being the
// same as nsINode (which nsIContent inherits).
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
NS_INTERFACE_MAP_END
NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_ADDREF(FragmentOrElement)
NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(FragmentOrElement,
nsNodeUtils::LastRelease(this))
NS_INTERFACE_MAP_END_INHERITING(nsIContent)
//----------------------------------------------------------------------
@ -2102,24 +2120,6 @@ FragmentOrElement::TextLength() const
return 0;
}
nsresult
FragmentOrElement::SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify)
{
NS_ERROR("called FragmentOrElement::SetText");
return NS_ERROR_FAILURE;
}
nsresult
FragmentOrElement::AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify)
{
NS_ERROR("called FragmentOrElement::AppendText");
return NS_ERROR_FAILURE;
}
bool
FragmentOrElement::TextIsOnlyWhitespace()
{
@ -2132,30 +2132,6 @@ FragmentOrElement::ThreadSafeTextIsOnlyWhitespace() const
return false;
}
bool
FragmentOrElement::HasTextForTranslation()
{
return false;
}
void
FragmentOrElement::AppendTextTo(nsAString& aResult)
{
// We can remove this assertion if it turns out to be useful to be able
// to depend on this appending nothing.
NS_NOTREACHED("called FragmentOrElement::TextLength");
}
bool
FragmentOrElement::AppendTextTo(nsAString& aResult, const mozilla::fallible_t&)
{
// We can remove this assertion if it turns out to be useful to be able
// to depend on this appending nothing.
NS_NOTREACHED("called FragmentOrElement::TextLength");
return false;
}
uint32_t
FragmentOrElement::GetChildCount() const
{

Просмотреть файл

@ -113,7 +113,11 @@ public:
explicit FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
explicit FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
// We want to avoid the overhead of extra function calls for
// refcounting when we're not doing refcount logging, so we can't
// NS_DECL_ISUPPORTS_INHERITED.
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
NS_INLINE_DECL_REFCOUNTING_INHERITED(FragmentOrElement, nsIContent);
NS_DECL_ADDSIZEOFEXCLUDINGTHIS
@ -137,21 +141,8 @@ public:
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) override;
virtual const nsTextFragment *GetText() override;
virtual uint32_t TextLength() const override;
virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) override;
// Need to implement this here too to avoid hiding.
nsresult SetText(const nsAString& aStr, bool aNotify)
{
return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
}
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) override;
virtual bool TextIsOnlyWhitespace() override;
virtual bool ThreadSafeTextIsOnlyWhitespace() const override;
virtual bool HasTextForTranslation() override;
virtual void AppendTextTo(nsAString& aResult) override;
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) override;
virtual nsXBLBinding* DoGetXBLBinding() const override;
virtual bool IsLink(nsIURI** aURI) const override;
@ -173,33 +164,14 @@ public:
nsINode* aParent,
nsTArray<nsCOMPtr<nsIContent> >& aNodes);
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(FragmentOrElement)
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED(FragmentOrElement,
nsIContent)
/**
* Fire a DOMNodeRemoved mutation event for all children of this node
*/
void FireNodeRemovedForChildren();
virtual bool OwnedOnlyByTheDOMTree() override
{
uint32_t rc = mRefCnt.get();
if (GetParent()) {
--rc;
}
rc -= mAttrsAndChildren.ChildCount();
return rc == 0;
}
virtual bool IsPurple() override
{
return mRefCnt.IsPurple();
}
virtual void RemovePurple() override
{
mRefCnt.RemovePurple();
}
static void ClearContentUnbinder();
static bool CanSkip(nsINode* aNode, bool aRemovingAllowed);
static bool CanSkipInCC(nsINode* aNode);

Просмотреть файл

@ -143,5 +143,40 @@ Text::Constructor(const GlobalObject& aGlobal,
return window->GetDoc()->CreateTextNode(aData);
}
bool
Text::HasTextForTranslation()
{
if (mText.Is2b()) {
// The fragment contains non-8bit characters which means there
// was at least one "interesting" character to trigger non-8bit.
return true;
}
if (HasFlag(NS_CACHED_TEXT_IS_ONLY_WHITESPACE) &&
HasFlag(NS_TEXT_IS_ONLY_WHITESPACE)) {
return false;
}
const char* cp = mText.Get1b();
const char* end = cp + mText.GetLength();
unsigned char ch;
for (; cp < end; cp++) {
ch = *cp;
// These are the characters that are letters
// in the first 256 UTF-8 codepoints.
if ((ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
(ch >= 192 && ch <= 214) ||
(ch >= 216 && ch <= 246) ||
(ch >= 248)) {
return true;
}
}
return false;
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -31,6 +31,13 @@ public:
static already_AddRefed<Text>
Constructor(const GlobalObject& aGlobal,
const nsAString& aData, ErrorResult& aRv);
/**
* Method to see if the text node contains data that is useful
* for a translation: i.e., it consists of more than just whitespace,
* digits and punctuation.
*/
bool HasTextForTranslation();
};
} // namespace dom
@ -38,14 +45,24 @@ public:
inline mozilla::dom::Text* nsINode::GetAsText()
{
return IsText() ? static_cast<mozilla::dom::Text*>(this)
: nullptr;
return IsText() ? AsText() : nullptr;
}
inline const mozilla::dom::Text* nsINode::GetAsText() const
{
return IsText() ? static_cast<const mozilla::dom::Text*>(this)
: nullptr;
return IsText() ? AsText() : nullptr;
}
inline mozilla::dom::Text* nsINode::AsText()
{
MOZ_ASSERT(IsText());
return static_cast<mozilla::dom::Text*>(this);
}
inline const mozilla::dom::Text* nsINode::AsText() const
{
MOZ_ASSERT(IsText());
return static_cast<const mozilla::dom::Text*>(this);
}
#endif // mozilla_dom_Text_h

Просмотреть файл

@ -59,6 +59,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/Text.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/XULCommandEvent.h"
@ -590,7 +591,7 @@ nsContentUtils::Init()
sSecurityManager->GetSystemPrincipal(&sSystemPrincipal);
MOZ_ASSERT(sSystemPrincipal);
RefPtr<NullPrincipal> nullPrincipal = NullPrincipal::Create();
RefPtr<NullPrincipal> nullPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
if (!nullPrincipal) {
return NS_ERROR_FAILURE;
}
@ -5220,7 +5221,7 @@ nsContentUtils::ConvertToPlainText(const nsAString& aSourceBuffer,
{
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), "about:blank");
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::CreateWithoutOriginAttributes();
nsCOMPtr<nsIDOMDocument> domDocument;
nsresult rv = NS_NewDOMDocument(getter_AddRefs(domDocument),
EmptyString(),
@ -5297,7 +5298,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
// Let's remove nodes until we find a eTEXT.
while (aContent->HasChildren()) {
nsIContent* child = aContent->GetFirstChild();
if (child->IsNodeOfType(nsINode::eTEXT)) {
if (child->IsText()) {
break;
}
aContent->RemoveChildNode(child, true);
@ -5306,8 +5307,7 @@ nsContentUtils::SetNodeTextContent(nsIContent* aContent,
// If we have a node, it must be a eTEXT and we reuse it.
if (aContent->HasChildren()) {
nsIContent* child = aContent->GetFirstChild();
MOZ_ASSERT(child->IsNodeOfType(nsINode::eTEXT));
nsresult rv = child->SetText(aValue, true);
nsresult rv = child->AsText()->SetText(aValue, true);
NS_ENSURE_SUCCESS(rv, rv);
// All the following nodes, if they exist, must be deleted.
@ -5356,8 +5356,8 @@ AppendNodeTextContentsRecurse(nsINode* aNode, nsAString& aResult,
return false;
}
}
else if (child->IsNodeOfType(nsINode::eTEXT)) {
bool ok = child->AppendTextTo(aResult, aFallible);
else if (Text* text = child->GetAsText()) {
bool ok = text->AppendTextTo(aResult, aFallible);
if (!ok) {
return false;
}
@ -5373,9 +5373,8 @@ nsContentUtils::AppendNodeTextContent(nsINode* aNode, bool aDeep,
nsAString& aResult,
const fallible_t& aFallible)
{
if (aNode->IsNodeOfType(nsINode::eTEXT)) {
return static_cast<nsIContent*>(aNode)->AppendTextTo(aResult,
aFallible);
if (Text* text = aNode->GetAsText()) {
return text->AppendTextTo(aResult, aFallible);
}
if (aDeep) {
return AppendNodeTextContentsRecurse(aNode, aResult, aFallible);
@ -5384,8 +5383,8 @@ nsContentUtils::AppendNodeTextContent(nsINode* aNode, bool aDeep,
for (nsIContent* child = aNode->GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->IsNodeOfType(nsINode::eTEXT)) {
bool ok = child->AppendTextTo(aResult, fallible);
if (Text* text = child->GetAsText()) {
bool ok = text->AppendTextTo(aResult, fallible);
if (!ok) {
return false;
}

Просмотреть файл

@ -78,6 +78,7 @@
#include "mozilla/dom/IDBMutableFile.h"
#include "mozilla/dom/IndexedDatabaseManager.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/Text.h"
#include "mozilla/dom/quota/PersistenceType.h"
#include "mozilla/dom/quota/QuotaManager.h"
#include "mozilla/dom/ContentChild.h"
@ -1425,7 +1426,7 @@ nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
child;
child = child->GetNextSibling()) {
if (child->HasTextForTranslation()) {
if (child->IsText() && child->GetAsText()->HasTextForTranslation()) {
translationNodesHash.PutEntry(content);
bool isBlockFrame = false;

Просмотреть файл

@ -12259,6 +12259,7 @@ nsIDocument::SetContentTypeInternal(const nsACString& aType)
mCachedEncoder = nullptr;
mContentType = aType;
mContentTypeForWriteCalls = aType;
}
nsILoadContext*

Просмотреть файл

@ -53,6 +53,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/Text.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
@ -2586,7 +2587,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
if (startContent->NodeType() == nsINode::TEXT_NODE) {
nsAutoString nodeValue;
startContent->AppendTextTo(nodeValue);
startContent->GetAsText()->AppendTextTo(nodeValue);
bool isFormControl =
startContent->IsNodeOfType(nsINode::eHTML_FORM_CONTROL);

Просмотреть файл

@ -169,7 +169,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, nsPIDOMWindowOuter* aOpener,
, mRemoteBrowser(nullptr)
, mChildID(0)
, mJSPluginID(aJSPluginID)
, mEventMode(FrameLoaderBinding::EVENT_MODE_NORMAL_DISPATCH)
, mBrowserChangingProcessBlockers(nullptr)
, mDepthTooGreat(false)
, mIsTopLevelContent(false)

Просмотреть файл

@ -173,12 +173,6 @@ public:
already_AddRefed<nsIMessageSender> GetMessageManager();
uint32_t EventMode() const { return mEventMode; }
void SetEventMode(uint32_t aEventMode)
{
mEventMode = aEventMode;
}
already_AddRefed<Element> GetOwnerElement();
uint32_t LazyWidth() const;
@ -479,10 +473,6 @@ private:
int32_t mJSPluginID;
// See FrameLoader.webidl. EVENT_MODE_NORMAL_DISPATCH automatically
// forwards some input events to out-of-process content.
uint32_t mEventMode;
// Holds the last known size of the frame.
mozilla::ScreenIntSize mLazySize;

Просмотреть файл

@ -11,6 +11,7 @@
#include "nsCaseTreatment.h" // for enum, cannot be forward-declared
#include "nsINode.h"
#include "nsStringFwd.h"
#include "nsISupportsImpl.h"
// Forward declarations
class nsAtom;
@ -68,6 +69,9 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_IID)
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsIContent)
/**
* Bind this content node to a tree. If this method throws, the caller must
* call UnbindFromTree() on the node. In the typical case of a node being
@ -375,32 +379,6 @@ public:
return false;
}
/**
* Set the text to the given value. If aNotify is true then
* the document is notified of the content change.
* NOTE: For elements this always ASSERTS and returns NS_ERROR_FAILURE
*/
virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) = 0;
/**
* Append the given value to the current text. If aNotify is true then
* the document is notified of the content change.
* NOTE: For elements this always ASSERTS and returns NS_ERROR_FAILURE
*/
virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) = 0;
/**
* Set the text to the given value. If aNotify is true then
* the document is notified of the content change.
* NOTE: For elements this always asserts and returns NS_ERROR_FAILURE
*/
nsresult SetText(const nsAString& aStr, bool aNotify)
{
return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
}
/**
* Query method to see if the frame is nothing but whitespace
* NOTE: Always returns false for elements
@ -412,27 +390,6 @@ public:
*/
virtual bool ThreadSafeTextIsOnlyWhitespace() const = 0;
/**
* Method to see if the text node contains data that is useful
* for a translation: i.e., it consists of more than just whitespace,
* digits and punctuation.
* NOTE: Always returns false for elements.
*/
virtual bool HasTextForTranslation() = 0;
/**
* Append the text content to aResult.
* NOTE: This asserts and returns for elements
*/
virtual void AppendTextTo(nsAString& aResult) = 0;
/**
* Append the text content to aResult.
* NOTE: This asserts and returns for elements
*/
MOZ_MUST_USE
virtual bool AppendTextTo(nsAString& aResult, const mozilla::fallible_t&) = 0;
/**
* Check if this content is focusable and in the current tab order.
* Note: most callers should use nsIFrame::IsFocusable() instead as it
@ -666,16 +623,6 @@ public:
{
}
/**
* This method is called when the parser begins creating the element's
* children, if any are present.
*
* This is only called for XTF elements currently.
*/
virtual void BeginAddingChildren()
{
}
/**
* This method is called when the parser finishes creating the element's children,
* if any are present.
@ -827,14 +774,24 @@ public:
virtual nsresult GetEventTargetParent(
mozilla::EventChainPreVisitor& aVisitor) override;
virtual bool IsPurple() = 0;
virtual void RemovePurple() = 0;
virtual bool OwnedOnlyByTheDOMTree() { return false; }
virtual already_AddRefed<nsITextControlElement> GetAsTextControlElement()
bool IsPurple() const
{
return nullptr;
return mRefCnt.IsPurple();
}
void RemovePurple()
{
mRefCnt.RemovePurple();
}
bool OwnedOnlyByTheDOMTree()
{
uint32_t rc = mRefCnt.get();
if (GetParent()) {
--rc;
}
rc -= GetChildCount();
return rc == 0;
}
protected:
@ -952,6 +909,8 @@ protected:
*/
nsAtom* DoGetID() const;
~nsIContent() {}
public:
#ifdef DEBUG
/**
@ -968,15 +927,6 @@ public:
bool aDumpAll = true) const = 0;
#endif
/**
* Append to aOutDescription a short (preferably one line) string
* describing the content.
* Currently implemented for elements only.
*/
virtual void Describe(nsAString& aOutDescription) const {
aOutDescription = NS_LITERAL_STRING("(not an element)");
}
enum ETabFocusType {
eTabFocus_textControlsMask = (1<<0), // textboxes and lists always tabbable
eTabFocus_formElementsMask = (1<<1), // non-text form elements

Просмотреть файл

@ -4239,6 +4239,8 @@ protected:
private:
nsCString mContentType;
protected:
// For document.write() we may need a different content type than mContentType.
nsCString mContentTypeForWriteCalls;
// The document's security info
nsCOMPtr<nsISupports> mSecurityInfo;

Просмотреть файл

@ -25,6 +25,7 @@
#include "mozilla/Telemetry.h"
#include "mozilla/TextEditor.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
@ -205,7 +206,7 @@ nsINode::CreateSlots()
}
bool
nsINode::IsEditableInternal() const
nsINode::IsEditable() const
{
if (HasFlag(NODE_IS_EDITABLE)) {
// The node is in an editable contentEditable subtree.
@ -908,10 +909,12 @@ nsINode::IsEqualNode(nsINode* aOther)
case CDATA_SECTION_NODE:
case PROCESSING_INSTRUCTION_NODE:
{
MOZ_ASSERT(node1->IsCharacterData());
MOZ_ASSERT(node2->IsCharacterData());
string1.Truncate();
static_cast<nsIContent*>(node1)->AppendTextTo(string1);
static_cast<CharacterData*>(node1)->AppendTextTo(string1);
string2.Truncate();
static_cast<nsIContent*>(node2)->AppendTextTo(string2);
static_cast<CharacterData*>(node2)->AppendTextTo(string2);
if (!string1.Equals(string2)) {
return false;

Просмотреть файл

@ -511,6 +511,13 @@ public:
mozilla::dom::Text* GetAsText();
const mozilla::dom::Text* GetAsText() const;
/**
* Return this node as Text. Asserts IsText(). This is defined inline in
* Text.h.
*/
mozilla::dom::Text* AsText();
const mozilla::dom::Text* AsText() const;
/*
* Return whether the node is a ProcessingInstruction node.
*/
@ -1217,14 +1224,7 @@ public:
}
}
bool IsEditable() const
{
#ifdef MOZILLA_INTERNAL_API
return IsEditableInternal();
#else
return IsEditableExternal();
#endif
}
bool IsEditable() const;
/**
* Returns true if |this| is native anonymous (i.e. created by
@ -1298,7 +1298,7 @@ public:
*/
nsIContent* GetSelectionRootContent(nsIPresShell* aPresShell);
virtual nsINodeList* ChildNodes();
nsINodeList* ChildNodes();
nsIContent* GetFirstChild() const { return mFirstChild; }
nsIContent* GetLastChild() const
{
@ -1349,14 +1349,6 @@ public:
*/
virtual bool IsNodeApzAwareInternal() const;
// HTML elements named <shadow> may or may not be HTMLShadowElement. This is
// a way to ask an element whether it's an HTMLShadowElement.
virtual bool IsHTMLShadowElement() const { return false; }
// Elements named <content> may or may not be HTMLContentElement. This is a
// way to ask an element whether it's an HTMLContentElement.
virtual bool IsHTMLContentElement() const { return false; }
void GetTextContent(nsAString& aTextContent,
mozilla::OOMReporter& aError)
{
@ -1961,12 +1953,6 @@ protected:
*/
void InvalidateChildNodes();
bool IsEditableInternal() const;
virtual bool IsEditableExternal() const
{
return IsEditableInternal();
}
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::OOMReporter& aError);
virtual void SetTextContentInternal(const nsAString& aTextContent,

Просмотреть файл

@ -110,7 +110,7 @@ nsNodeInfoManager::Init(nsIDocument *aDocument)
NS_PRECONDITION(!mPrincipal,
"Being inited when we already have a principal?");
mPrincipal = NullPrincipal::Create();
mPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
if (aDocument) {
mBindingManager = new nsBindingManager(aDocument);

Просмотреть файл

@ -1586,7 +1586,7 @@ nsTreeSanitizer::InitializeStatics()
sAttributesMathML->PutEntry(*kAttributesMathML[i]);
}
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::CreateWithoutOriginAttributes();
principal.forget(&sNullPrincipal);
}

Просмотреть файл

@ -118,7 +118,7 @@ SimpleGlobalObject::Create(GlobalType globalType, JS::Handle<JS::Value> proto)
.setSystemZone();
if (NS_IsMainThread()) {
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::CreateWithoutOriginAttributes();
options.creationOptions().setTrace(xpc::TraceXPCGlobal);
global = xpc::CreateGlobalObject(cx, js::Jsvalify(&SimpleGlobalClass),
nsJSPrincipals::get(principal),

Просмотреть файл

@ -150,7 +150,7 @@ ConsoleUtils::GetOrCreateSandbox(JSContext* aCx)
nsIXPConnect* xpc = nsContentUtils::XPConnect();
MOZ_ASSERT(xpc, "This should never be null!");
RefPtr<NullPrincipal> nullPrincipal = NullPrincipal::Create();
RefPtr<NullPrincipal> nullPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
JS::Rooted<JSObject*> sandbox(aCx);
nsresult rv = xpc->CreateSandbox(aCx, nullPrincipal, sandbox.address());

Просмотреть файл

@ -1439,11 +1439,6 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
continue;
}
if (frameLoader->EventMode() ==
FrameLoaderBinding::EVENT_MODE_DONT_FORWARD_TO_CHILD) {
continue;
}
DispatchCrossProcessEvent(aEvent, frameLoader, aStatus);
}
return aEvent->HasBeenPostedToRemoteProcess();

Просмотреть файл

@ -860,7 +860,14 @@ WindowsGamepadService::HandleRawInput(HRAWINPUT handle)
memset(buttons.Elements(), 0, gamepad->numButtons * sizeof(bool));
for (unsigned i = 0; i < usageLength; i++) {
buttons[usages[i] - 1] = true;
// The button index in usages may be larger than what we detected when
// enumerating gamepads. If so, warn and continue.
//
// Usage ID of 0 is reserved, so it should always be 1 or higher.
if (NS_WARN_IF((usages[i] - 1u) >= buttons.Length())) {
continue;
}
buttons[usages[i] - 1u] = true;
}
if (gamepad->hasDpad) {

Просмотреть файл

@ -22,7 +22,6 @@ class HTMLAnchorElement final : public nsGenericHTMLElement,
{
public:
using Element::GetText;
using Element::SetText;
explicit HTMLAnchorElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)

Просмотреть файл

@ -21,7 +21,6 @@ class HTMLBodyElement final : public nsGenericHTMLElement
{
public:
using Element::GetText;
using Element::SetText;
explicit HTMLBodyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)

Просмотреть файл

@ -342,12 +342,6 @@ public:
return mHasPatternAttribute;
}
virtual already_AddRefed<nsITextControlElement> GetAsTextControlElement() override
{
nsCOMPtr<nsITextControlElement> txt = this;
return txt.forget();
}
// nsIConstraintValidation
bool IsTooLong();
bool IsTooShort();

Просмотреть файл

@ -247,9 +247,8 @@ HTMLOptionElement::GetText(nsAString& aText)
nsIContent* child = nsINode::GetFirstChild();
while (child) {
if (child->NodeType() == TEXT_NODE ||
child->NodeType() == CDATA_SECTION_NODE) {
child->AppendTextTo(text);
if (Text* textChild = child->GetAsText()) {
textChild->AppendTextTo(text);
}
if (child->IsHTMLElement(nsGkAtoms::script) ||
child->IsSVGElement(nsGkAtoms::script)) {

Просмотреть файл

@ -34,7 +34,6 @@ public:
// nsISupports
NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOptionElement, nsGenericHTMLElement)
using mozilla::dom::Element::SetText;
using mozilla::dom::Element::GetText;
bool Selected() const

Просмотреть файл

@ -19,7 +19,6 @@ class HTMLScriptElement final : public nsGenericHTMLElement,
{
public:
using Element::GetText;
using Element::SetText;
HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
FromParser aFromParser);

Просмотреть файл

@ -164,12 +164,6 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTextAreaElement,
nsGenericHTMLFormElementWithState)
virtual already_AddRefed<nsITextControlElement> GetAsTextControlElement() override
{
nsCOMPtr<nsITextControlElement> txt = this;
return txt.forget();
}
// nsIConstraintValidation
bool IsTooLong();
bool IsTooShort();

Просмотреть файл

@ -21,7 +21,6 @@ class HTMLTitleElement final : public nsGenericHTMLElement,
{
public:
using Element::GetText;
using Element::SetText;
explicit HTMLTitleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);

Просмотреть файл

@ -1205,7 +1205,7 @@ nsHTMLDocument::Open(JSContext* /* unused */,
already_AddRefed<nsIDocument>
nsHTMLDocument::Open(JSContext* cx,
const nsAString& aType,
const Optional<nsAString>& /* unused */,
const nsAString& aReplace,
ErrorResult& aError)
{
@ -1225,18 +1225,6 @@ nsHTMLDocument::Open(JSContext* cx,
return nullptr;
}
nsAutoCString contentType;
contentType.AssignLiteral("text/html");
nsAutoString type;
nsContentUtils::ASCIIToLower(aType, type);
nsAutoCString actualType, dummy;
NS_ParseRequestContentType(NS_ConvertUTF16toUTF8(type), actualType, dummy);
if (!actualType.EqualsLiteral("text/html") &&
!type.EqualsLiteral("replace")) {
contentType.AssignLiteral("text/plain");
}
// If we already have a parser we ignore the document.open call.
if (mParser || mParserAborted) {
// The WHATWG spec says: "If the document has an active parser that isn't
@ -1489,12 +1477,17 @@ nsHTMLDocument::Open(JSContext* cx,
mDidDocumentOpen = true;
nsAutoCString contentType(GetContentTypeInternal());
// Call Reset(), this will now do the full reset
Reset(channel, group);
if (baseURI) {
mDocumentBaseURI = baseURI;
}
// Restore our type, since Reset() resets it.
SetContentTypeInternal(contentType);
// Store the security info of the caller now that we're done
// resetting the document.
mSecurityInfo = securityInfo;
@ -1512,8 +1505,7 @@ nsHTMLDocument::Open(JSContext* cx,
}
}
// This will be propagated to the parser when someone actually calls write()
SetContentTypeInternal(contentType);
mContentTypeForWriteCalls.AssignLiteral("text/html");
// Prepare the docshell and the document viewer for the impending
// out of band document.write()
@ -1579,7 +1571,7 @@ nsHTMLDocument::Close(ErrorResult& rv)
++mWriteLevel;
rv = (static_cast<nsHtml5Parser*>(mParser.get()))->Parse(
EmptyString(), nullptr, GetContentTypeInternal(), true);
EmptyString(), nullptr, mContentTypeForWriteCalls, true);
--mWriteLevel;
// Even if that Parse() call failed, do the rest of this method
@ -1711,7 +1703,7 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
mDocumentURI);
return;
}
nsCOMPtr<nsIDocument> ignored = Open(cx, NS_LITERAL_STRING("text/html"),
nsCOMPtr<nsIDocument> ignored = Open(cx, Optional<nsAString>(),
EmptyString(), aRv);
// If Open() fails, or if it didn't create a parser (as it won't
@ -1745,10 +1737,10 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
// why pay that price when we don't need to?
if (aNewlineTerminate) {
aRv = (static_cast<nsHtml5Parser*>(mParser.get()))->Parse(
aText + new_line, key, GetContentTypeInternal(), false);
aText + new_line, key, mContentTypeForWriteCalls, false);
} else {
aRv = (static_cast<nsHtml5Parser*>(mParser.get()))->Parse(
aText, key, GetContentTypeInternal(), false);
aText, key, mContentTypeForWriteCalls, false);
}
--mWriteLevel;

Просмотреть файл

@ -167,7 +167,7 @@ public:
mozilla::ErrorResult& rv);
void GetSupportedNames(nsTArray<nsString>& aNames);
already_AddRefed<nsIDocument> Open(JSContext* cx,
const nsAString& aType,
const mozilla::dom::Optional<nsAString>& /* unused */,
const nsAString& aReplace,
mozilla::ErrorResult& aError);
already_AddRefed<nsPIDOMWindowOuter>

Просмотреть файл

@ -42,6 +42,7 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/Text.h"
#include "nsNumberControlFrame.h"
#include "nsFrameSelection.h"
#include "mozilla/ErrorResult.h"
@ -2585,7 +2586,7 @@ nsTextEditorState::SetPreviewText(const nsAString& aValue, bool aNotify)
nsContentUtils::RemoveNewlines(previewValue);
MOZ_ASSERT(previewDiv->GetFirstChild(), "preview div has no child");
previewDiv->GetFirstChild()->SetText(previewValue, aNotify);
previewDiv->GetFirstChild()->AsText()->SetText(previewValue, aNotify);
UpdateOverlayTextVisibility(aNotify);
}

Просмотреть файл

@ -1379,7 +1379,7 @@ private:
MOZ_ASSERT(xpc, "This should never be null!");
// Let's use a null principal.
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::CreateWithoutOriginAttributes();
JS::Rooted<JSObject*> sandbox(aCx);
nsresult rv = xpc->CreateSandbox(aCx, principal, sandbox.address());

Просмотреть файл

@ -773,7 +773,7 @@ GetCreateWindowParams(mozIDOMWindowProxy* aParent,
*aFullZoom = 1.0f;
auto* opener = nsPIDOMWindowOuter::From(aParent);
if (!opener) {
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
NS_ADDREF(*aTriggeringPrincipal = nullPrincipal);
return NS_OK;
}

Просмотреть файл

@ -563,7 +563,7 @@ TabParent::RecvDropLinks(nsTArray<nsString>&& aLinks)
if (loadUsingSystemPrincipal) {
triggeringPrincipal = nsContentUtils::GetSystemPrincipal();
} else {
triggeringPrincipal = NullPrincipal::Create();
triggeringPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
}
browser->DropLinks(aLinks.Length(), links.get(), triggeringPrincipal);
}

Просмотреть файл

@ -114,7 +114,11 @@ SVGTransformListParser::ParseArguments(float* aResult,
}
*aParsedCount = 1;
while (SkipWsp()) {
while (true) {
RangedPtr<const char16_t> iter(mIter);
if (!SkipWsp()) {
return false;
}
if (*mIter == ')') {
++mIter;
return true;
@ -123,6 +127,10 @@ SVGTransformListParser::ParseArguments(float* aResult,
return false;
}
SkipCommaWsp();
if (iter == mIter) {
// There must be either whitespace or a comma between values
return false;
}
if (!SVGContentUtils::ParseNumber(mIter, mEnd, aResult[(*aParsedCount)++])) {
return false;
}

Просмотреть файл

@ -116,25 +116,6 @@ interface FrameLoader {
nsIPrintSettings aPrintSettings,
optional nsIWebProgressListener? aProgressListener = null);
/**
* The default event mode automatically forwards the events
* handled in EventStateManager::HandleCrossProcessEvent to
* the child content process when these events are targeted to
* the remote browser element.
*
* Used primarly for input events (mouse, keyboard)
*/
const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000;
/**
* With this event mode, it's the application's responsability to
* convert and forward events to the content process
*/
const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001;
[Pure]
attribute unsigned long eventMode;
/**
* If false, then the subdocument is not clipped to its CSS viewport, and the
* subdocument's viewport scrollbar(s) are not rendered.

Просмотреть файл

@ -16,7 +16,7 @@ interface HTMLDocument : Document {
// dynamic markup insertion
[CEReactions, Throws]
Document open(optional DOMString type = "text/html", optional DOMString replace = "");
Document open(optional DOMString type, optional DOMString replace = ""); // type is ignored
[CEReactions, Throws]
WindowProxy? open(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
[CEReactions, Throws]

Просмотреть файл

@ -41,6 +41,7 @@
#include "nsXBLResourceLoader.h"
#include "mozilla/dom/CDATASection.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/Comment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/StyleSheet.h"
@ -1214,7 +1215,7 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
if (namespaceID == XBLBinding_Serialize_TextNode ||
namespaceID == XBLBinding_Serialize_CDATANode ||
namespaceID == XBLBinding_Serialize_CommentNode) {
nsCOMPtr<nsIContent> content;
RefPtr<CharacterData> content;
switch (namespaceID) {
case XBLBinding_Serialize_TextNode:
content = new nsTextNode(aNim);
@ -1234,7 +1235,7 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
NS_ENSURE_SUCCESS(rv, rv);
content->SetText(text, false);
content.swap(*aContent);
content.forget(aContent);
return NS_OK;
}

Просмотреть файл

@ -23,6 +23,7 @@ class nsIDocument;
class nsIURI;
class nsIContent;
class nsIParser;
class nsTextNode;
namespace mozilla {
namespace dom {
@ -194,7 +195,7 @@ protected:
int32_t mTextLength;
int32_t mNotifyLevel;
nsCOMPtr<nsIContent> mLastTextNode;
RefPtr<nsTextNode> mLastTextNode;
uint8_t mPrettyPrintXML : 1;
uint8_t mPrettyPrintHasSpecialRoot : 1;

Просмотреть файл

@ -19,6 +19,7 @@
#include "nsAttrName.h"
#include "nsTArray.h"
#include "mozilla/dom/Attr.h"
#include "mozilla/dom/CharacterData.h"
#include "mozilla/dom/Element.h"
#include <stdint.h>
#include <algorithm>
@ -469,7 +470,8 @@ txXPathNodeUtils::appendNodeValue(const txXPathNode& aNode, nsAString& aResult)
return;
}
aNode.Content()->AppendTextTo(aResult);
MOZ_ASSERT(aNode.mNode->IsCharacterData());
static_cast<CharacterData*>(aNode.Content())->AppendTextTo(aResult);
}
/* static */

Просмотреть файл

@ -86,12 +86,14 @@ createTextNode(txIEvalContext *aContext, nsString& aValue,
const txXPathNode& document = es->getSourceDocument();
nsIDocument *doc = txXPathNativeNode::getDocument(document);
nsCOMPtr<nsIContent> text = new nsTextNode(doc->NodeInfoManager());
RefPtr<nsTextNode> text = new nsTextNode(doc->NodeInfoManager());
nsresult rv = text->SetText(aValue, false);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = txXPathNativeNode::createXPathNode(text, true);
// nsTextNode implements both nsIDOMNode and nsIContent, so the
// call would be ambiguous without the AsContent() call.
*aResult = txXPathNativeNode::createXPathNode(text->AsContent(), true);
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;

Просмотреть файл

@ -37,6 +37,7 @@
#include "nsError.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Text.h"
#include "mozilla/Encoding.h"
#include "mozilla/UniquePtr.h"
@ -564,9 +565,9 @@ handleNode(nsINode* aNode, txStylesheetCompiler* aCompiler)
rv = aCompiler->endElement();
NS_ENSURE_SUCCESS(rv, rv);
}
else if (aNode->IsNodeOfType(nsINode::eTEXT)) {
else if (dom::Text* text = aNode->GetAsText()) {
nsAutoString chars;
static_cast<nsIContent*>(aNode)->AppendTextTo(chars);
text->AppendTextTo(chars);
rv = aCompiler->characters(chars);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -357,7 +357,7 @@ gfxSVGGlyphsDocument::ParseDocument(const uint8_t *aBuffer, uint32_t aBufLen)
rv = NS_NewURI(getter_AddRefs(uri), mSVGGlyphsDocumentURI);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> principal = NullPrincipal::CreateWithoutOriginAttributes();
nsCOMPtr<nsIDOMDocument> domDoc;
rv = NS_NewDOMDocument(getter_AddRefs(domDoc),

Просмотреть файл

@ -115,7 +115,7 @@ moz_icon_to_channel(nsIURI* aURI, const nsACString& aFileExt,
// nsIconProtocolHandler::NewChannel2 will provide the correct loadInfo for
// this iconChannel. Use the most restrictive security settings for the
// temporary loadInfo to make sure the channel can not be openend.
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
return NS_NewInputStreamChannel(aChannel,
aURI,
stream.forget(),

Просмотреть файл

@ -106,7 +106,7 @@ moz_gdk_pixbuf_to_channel(GdkPixbuf* aPixbuf, nsIURI* aURI,
// nsIconProtocolHandler::NewChannel2 will provide the correct loadInfo for
// this iconChannel. Use the most restrictive security settings for the
// temporary loadInfo to make sure the channel can not be openend.
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::Create();
nsCOMPtr<nsIPrincipal> nullPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
return NS_NewInputStreamChannel(aChannel,
aURI,
stream.forget(),

Просмотреть файл

@ -979,7 +979,7 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
if (sop) {
principal = sop->GetPrincipal();
} else {
RefPtr<NullPrincipal> nullPrin = NullPrincipal::Create();
RefPtr<NullPrincipal> nullPrin = NullPrincipal::CreateWithoutOriginAttributes();
principal = nullPrin;
}
}

Просмотреть файл

@ -7,6 +7,7 @@
#include "nsBidiPresUtils.h"
#include "mozilla/IntegerRange.h"
#include "mozilla/dom/Text.h"
#include "gfxContext.h"
#include "nsAutoPtr.h"
@ -1136,14 +1137,14 @@ nsBidiPresUtils::TraverseFrames(nsBlockInFlowLineIterator* aLineIter,
aBpd->mPrevContent = content;
if (!frame->StyleText()->NewlineIsSignificant(
static_cast<nsTextFrame*>(frame))) {
content->AppendTextTo(aBpd->mBuffer);
content->GetAsText()->AppendTextTo(aBpd->mBuffer);
} else {
/*
* For preformatted text we have to do bidi resolution on each line
* separately.
*/
nsAutoString text;
content->AppendTextTo(text);
content->GetAsText()->AppendTextTo(text);
nsIFrame* next;
do {
next = nullptr;

Просмотреть файл

@ -14,6 +14,7 @@
#include "nsContentUtils.h"
#include "nsIContent.h"
#include "nsTArray.h"
#include "mozilla/dom/Text.h"
using namespace mozilla;
@ -33,7 +34,7 @@ nsCounterUseNode::InitTextFrame(nsGenConList* aList,
Calc(counterList);
nsAutoString contentString;
GetText(contentString);
aTextFrame->GetContent()->SetText(contentString, false);
aTextFrame->GetContent()->AsText()->SetText(contentString, false);
} else {
// In all other cases (list already dirty or node not at the end),
// just start with an empty string for now and when we recalculate

Просмотреть файл

@ -9453,7 +9453,11 @@ nsLayoutUtils::ComputeScrollMetadata(nsIFrame* aForFrame,
if (gfxPrefs::APZPrintTree() || gfxPrefs::APZTestLoggingEnabled()) {
if (nsIContent* content = frameForCompositionBoundsCalculation->GetContent()) {
nsAutoString contentDescription;
content->Describe(contentDescription);
if (content->IsElement()) {
content->AsElement()->Describe(contentDescription);
} else {
contentDescription.AssignLiteral("(not an element)");
}
metadata.SetContentDescription(NS_LossyConvertUTF16toASCII(contentDescription));
if (IsAPZTestLoggingEnabled()) {
LogTestDataForPaint(aLayerManager, scrollId, "contentDescription",

Просмотреть файл

@ -10,6 +10,7 @@
#include "nsReadableUtils.h"
#include "nsIContent.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/Text.h"
using namespace mozilla;
@ -29,7 +30,7 @@ nsQuoteNode::InitTextFrame(nsGenConList* aList, nsIFrame* aPseudoFrame,
// Don't set up text for 'no-open-quote' and 'no-close-quote'.
if (IsRealQuote()) {
aTextFrame->GetContent()->SetText(*Text(), false);
aTextFrame->GetContent()->AsText()->SetText(*Text(), false);
}
return dirty;
}

Просмотреть файл

@ -1297,6 +1297,12 @@ nsComboboxControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElement
}
}
nsIContent*
nsComboboxControlFrame::GetDisplayNode() const
{
return mDisplayContent;
}
// XXXbz this is a for-now hack. Now that display:inline-block works,
// need to revisit this.
class nsComboboxDisplayFrame : public nsBlockFrame {

Просмотреть файл

@ -36,6 +36,7 @@ class nsIListControlFrame;
class nsComboboxDisplayFrame;
class nsIDOMEventListener;
class nsIScrollableFrame;
class nsTextNode;
namespace mozilla {
namespace gfx {
@ -70,7 +71,7 @@ public:
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
nsIContent* GetDisplayNode() { return mDisplayContent; }
nsIContent* GetDisplayNode() const;
nsIFrame* CreateFrameForDisplayNode();
#ifdef ACCESSIBILITY
@ -285,7 +286,7 @@ private:
protected:
nsFrameList mPopupFrames; // additional named child list
nsCOMPtr<nsIContent> mDisplayContent; // Anonymous content used to display the current selection
RefPtr<nsTextNode> mDisplayContent; // Anonymous content used to display the current selection
RefPtr<Element> mButtonContent; // Anonymous content for the button
nsContainerFrame* mDisplayFrame; // frame to display selection
nsIFrame* mButtonFrame; // button frame

Просмотреть файл

@ -12,6 +12,8 @@
#include "nsCOMPtr.h"
#include "nsIAnonymousContentCreator.h"
class nsTextNode;
// Class which implements the input[type=button, reset, submit] and
// browse button for input[type=file].
// The label for button is specified through generated content
@ -56,7 +58,7 @@ protected:
virtual bool IsInput() override { return true; }
private:
nsCOMPtr<nsIContent> mTextContent;
RefPtr<nsTextNode> mTextContent;
};

Просмотреть файл

@ -508,7 +508,7 @@ nsTextControlFrame::CreatePlaceholderIfNeeded()
mPlaceholderDiv = CreateEmptyDivWithTextNode(*this);
// Associate ::placeholder pseudo-element with the placeholder node.
mPlaceholderDiv->SetPseudoElementType(CSSPseudoElementType::placeholder);
mPlaceholderDiv->GetFirstChild()->SetText(placeholderTxt, false);
mPlaceholderDiv->GetFirstChild()->AsText()->SetText(placeholderTxt, false);
}
void
@ -1241,8 +1241,10 @@ nsTextControlFrame::SetInitialChildList(ChildListID aListID,
void
nsTextControlFrame::SetValueChanged(bool aValueChanged)
{
nsCOMPtr<nsITextControlElement> txtCtrl =
GetContent()->GetAsTextControlElement();
nsCOMPtr<nsITextControlElement> txtCtrl = HTMLInputElement::FromNode(GetContent());
if (!txtCtrl) {
txtCtrl = HTMLTextAreaElement::FromNode(GetContent());
}
MOZ_ASSERT(txtCtrl, "Content not a text control element");
if (mPlaceholderDiv) {
@ -1269,8 +1271,9 @@ nsTextControlFrame::UpdateValueDisplay(bool aNotify,
NS_PRECONDITION(!mEditorHasBeenInitialized,
"Do not call this after editor has been initialized");
nsIContent* textContent = mRootNode->GetFirstChild();
if (!textContent) {
nsIContent* childContent = mRootNode->GetFirstChild();
Text* textContent;
if (!childContent) {
// Set up a textnode with our value
RefPtr<nsTextNode> textNode =
new nsTextNode(mContent->NodeInfo()->NodeInfoManager());
@ -1278,6 +1281,8 @@ nsTextControlFrame::UpdateValueDisplay(bool aNotify,
mRootNode->AppendChildTo(textNode, aNotify);
textContent = textNode;
} else {
textContent = childContent->AsText();
}
NS_ENSURE_TRUE(textContent, NS_ERROR_UNEXPECTED);

Просмотреть файл

@ -2177,14 +2177,42 @@ public:
private:
Color ComputeColor() const;
static Color ComputeColorFromSelectionStyle(ComputedStyle&);
static Color ApplyTransparencyIfNecessary(nscolor);
int16_t mSelectionValue;
};
Color
nsDisplaySelectionOverlay::ApplyTransparencyIfNecessary(nscolor aColor)
{
// If it has already alpha, leave it like that.
if (NS_GET_A(aColor) != 255) {
return ToDeviceColor(aColor);
}
// NOTE(emilio): Blink and WebKit do something slightly different here, and
// blend the color with white instead, both for overlays and text backgrounds.
auto color = Color::FromABGR(aColor);
color.a = 0.5;
return ToDeviceColor(color);
}
Color
nsDisplaySelectionOverlay::ComputeColorFromSelectionStyle(ComputedStyle& aStyle)
{
return ApplyTransparencyIfNecessary(
aStyle.GetVisitedDependentColor(&nsStyleBackground::mBackgroundColor));
}
Color
nsDisplaySelectionOverlay::ComputeColor() const
{
LookAndFeel::ColorID colorID;
if (mSelectionValue == nsISelectionController::SELECTION_ON) {
if (RefPtr<ComputedStyle> style = mFrame->ComputeSelectionStyle()) {
return ComputeColorFromSelectionStyle(*style);
}
colorID = LookAndFeel::eColorID_TextSelectBackground;
} else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
colorID = LookAndFeel::eColorID_TextSelectBackgroundAttention;
@ -2192,9 +2220,8 @@ nsDisplaySelectionOverlay::ComputeColor() const
colorID = LookAndFeel::eColorID_TextSelectBackgroundDisabled;
}
Color c = Color::FromABGR(LookAndFeel::GetColor(colorID, NS_RGB(255, 255, 255)));
c.a = .5;
return ToDeviceColor(c);
return ApplyTransparencyIfNecessary(
LookAndFeel::GetColor(colorID, NS_RGB(255, 255, 255)));
}
void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
@ -2227,6 +2254,34 @@ nsDisplaySelectionOverlay::CreateWebRenderCommands(mozilla::wr::DisplayListBuild
return true;
}
static Element*
FindElementAncestorForMozSelection(nsIContent* aContent)
{
NS_ENSURE_TRUE(aContent, nullptr);
while (aContent && aContent->IsInNativeAnonymousSubtree()) {
aContent = aContent->GetBindingParent();
}
NS_ASSERTION(aContent, "aContent isn't in non-anonymous tree?");
while (aContent && !aContent->IsElement()) {
aContent = aContent->GetParent();
}
return aContent ? aContent->AsElement() : nullptr;
}
already_AddRefed<ComputedStyle>
nsIFrame::ComputeSelectionStyle() const
{
Element* element = FindElementAncestorForMozSelection(GetContent());
if (!element) {
return nullptr;
}
RefPtr<ComputedStyle> sc =
PresContext()->StyleSet()->ProbePseudoElementStyle(
element, CSSPseudoElementType::mozSelection, Style());
return sc.forget();
}
/********************************************************
* Refreshes each content's frame
*********************************************************/
@ -2236,25 +2291,23 @@ nsFrame::DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
uint16_t aContentType)
{
if (!IsSelected() || !IsVisibleForPainting(aBuilder))
if (!IsSelected() || !IsVisibleForPainting(aBuilder)) {
return;
}
nsPresContext* presContext = PresContext();
nsIPresShell *shell = presContext->PresShell();
if (!shell)
return;
int16_t displaySelection = shell->GetSelectionFlags();
if (!(displaySelection & aContentType))
int16_t displaySelection = PresShell()->GetSelectionFlags();
if (!(displaySelection & aContentType)) {
return;
}
const nsFrameSelection* frameSelection = GetConstFrameSelection();
int16_t selectionValue = frameSelection->GetDisplaySelection();
if (selectionValue <= nsISelectionController::SELECTION_HIDDEN)
if (selectionValue <= nsISelectionController::SELECTION_HIDDEN) {
return; // selection is hidden or off
}
nsIContent *newContent = mContent->GetParent();
nsIContent* newContent = mContent->GetParent();
//check to see if we are anonymous content
int32_t offset = 0;
@ -2264,8 +2317,8 @@ nsFrame::DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder,
}
//look up to see what selection(s) are on this frame
UniquePtr<SelectionDetails> details
= frameSelection->LookUpSelection(newContent, offset, 1, false);
UniquePtr<SelectionDetails> details =
frameSelection->LookUpSelection(newContent, offset, 1, false);
if (!details)
return;
@ -4245,7 +4298,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// starting a new selection since the user may be trying to
// drag the selected region to some other app.
if (GetContent()->IsSelectionDescendant())
if (GetContent() && GetContent()->IsSelectionDescendant())
{
bool inSelection = false;
UniquePtr<SelectionDetails> details

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше