Merge mozilla-central to autoland. a=merge

This commit is contained in:
Andreea Pavel 2018-06-03 07:27:01 +03:00
Родитель bb80b73970 8f2a5e19c9
Коммит 4ced6e8b2d
549 изменённых файлов: 5527 добавлений и 26439 удалений

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

@ -118,3 +118,6 @@ jobs:
mozilla-esr60:
- {weekday: 'Monday', hour: 10, minute: 0}
- {weekday: 'Thursday', hour: 10, minute: 0}
mozilla-beta:
- {weekday: 'Monday', hour: 10, minute: 0}
- {weekday: 'Thursday', hour: 10, minute: 0}

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

@ -147,8 +147,7 @@ function invokeFocus(browser, id) {
Logger.log(`Setting focus on a node with id: ${id}`);
return ContentTask.spawn(browser, id, contentId => {
let elm = content.document.getElementById(contentId);
if (elm instanceof Ci.nsIDOMNSEditableElement && elm.editor ||
elm.localName == "textbox") {
if (elm.editor || elm.localName == "textbox") {
elm.selectionStart = elm.selectionEnd = elm.value.length;
}
elm.focus();

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

@ -200,10 +200,11 @@ function editableTextTest(aID) {
function getValue() {
var elm = getNode(aID);
if (elm instanceof Ci.nsIDOMNSEditableElement)
var elmClass = ChromeUtils.getClassName(elm);
if (elmClass === "HTMLTextAreaElement" || elmClass === "HTMLInputElement")
return elm.value;
if (ChromeUtils.getClassName(elm) == "HTMLDocument")
if (elmClass === "HTMLDocument")
return elm.body.textContent;
return elm.textContent;

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

@ -1264,8 +1264,7 @@ function synthFocus(aNodeOrID, aCheckerOrEventSeq) {
this.__proto__ = new synthAction(aNodeOrID, checkerOfEventSeq);
this.invoke = function synthFocus_invoke() {
if (this.DOMNode instanceof Ci.nsIDOMNSEditableElement &&
this.DOMNode.editor ||
if (this.DOMNode.editor ||
this.DOMNode.localName == "textbox") {
this.DOMNode.selectionStart = this.DOMNode.selectionEnd = this.DOMNode.value.length;
}

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

@ -24,9 +24,6 @@
<script type="application/javascript">
const nsIDOMNSEditableElement =
Ci.nsIDOMNSEditableElement;
ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
function spelledTextInvoker(aID) {
@ -37,7 +34,7 @@
];
this.invoke = function spelledTextInvoker_invoke() {
var editor = this.DOMNode.QueryInterface(nsIDOMNSEditableElement).editor;
var editor = this.DOMNode.editor;
var spellChecker = new InlineSpellChecker(editor);
spellChecker.enabled = true;

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

@ -63,7 +63,7 @@ public:
private:
explicit xpcAccessibleTextRange(TextRange&& aRange) :
mRange(Forward<TextRange>(aRange)) {}
mRange(std::forward<TextRange>(aRange)) {}
xpcAccessibleTextRange() {}
~xpcAccessibleTextRange() {}

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

@ -16,7 +16,6 @@
#include "TreeWalker.h"
#include "XULMenuAccessible.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIDOMXULButtonElement.h"
#include "nsIDOMXULCheckboxElement.h"
#include "nsIDOMXULMenuListElement.h"

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

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<blocklist lastupdate="1525377135149" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<blocklist lastupdate="1526381862851" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
<emItem blockID="i334" id="{0F827075-B026-42F3-885D-98981EE7B1AE}">
<prefs/>
@ -2259,6 +2259,14 @@
<prefs/>
<versionRange minVersion="0" maxVersion="*" severity="3"/>
</emItem>
<emItem blockID="cbfa5303-c1bf-49c8-87d8-259738a20064" id="@vkmad">
<prefs/>
<versionRange minVersion="0" maxVersion="*" severity="3"/>
</emItem>
<emItem blockID="0f0764d5-a290-428b-a5b2-3767e1d72c71" id="{38363d75-6591-4e8b-bf01-0270623d1b6c}">
<prefs/>
<versionRange minVersion="0" maxVersion="*" severity="3"/>
</emItem>
</emItems>
<pluginItems>
<pluginItem blockID="p332">

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

@ -253,7 +253,7 @@ nsContextMenu.prototype = {
if (this.isRemote) {
InlineSpellCheckerUI.initFromRemote(gContextMenuContentData.spellInfo);
} else {
InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor);
InlineSpellCheckerUI.init(this.target.editor);
InlineSpellCheckerUI.initFromEvent(document.popupRangeParent,
document.popupRangeOffset);
}

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

@ -397,7 +397,7 @@ add_task(async function() {
ok(result.info.selectionText.endsWith("quo voluptas nulla pariatur?"), "long text selection worked");
// Select a lot of text, excercise the nsIDOMNSEditableElement code path in
// Select a lot of text, excercise the editable element code path in
// the Browser:GetSelection handler.
await ContentTask.spawn(gBrowser.selectedBrowser, { }, function(arg) {
let doc = content.document;

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

@ -68,8 +68,9 @@ add_task(async function() {
is(countByTitle(closedTabs, REMEMBER), remember_count,
"Everything is set up.");
let promise = promiseClearHistory();
await ForgetAboutSite.removeDataFromDomain("example.net");
await promiseClearHistory();
await promise;
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, remember_count,
"The correct amout of tabs was removed");

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

@ -324,6 +324,9 @@
@RESPATH@/components/SlowScriptDebug.manifest
@RESPATH@/components/SlowScriptDebug.js
@RESPATH@/components/ClearDataService.manifest
@RESPATH@/components/ClearDataService.js
#ifdef MOZ_WEBRTC
@RESPATH@/components/PeerConnection.js
@RESPATH@/components/PeerConnection.manifest

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

@ -12,17 +12,10 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
FormHistory: "resource://gre/modules/FormHistory.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
TelemetryStopwatch: "resource://gre/modules/TelemetryStopwatch.jsm",
setTimeout: "resource://gre/modules/Timer.jsm",
ServiceWorkerCleanUp: "resource://gre/modules/ServiceWorkerCleanUp.jsm",
OfflineAppCacheHelper: "resource://gre/modules/offlineAppCache.jsm",
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
});
XPCOMUtils.defineLazyServiceGetter(this, "sas",
"@mozilla.org/storage/activity-service;1",
"nsIStorageActivityService");
XPCOMUtils.defineLazyServiceGetter(this, "quotaManagerService",
"@mozilla.org/dom/quota-manager-service;1",
"nsIQuotaManagerService");
@ -34,12 +27,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "serviceWorkerManager",
// Used as unique id for pending sanitizations.
var gPendingSanitizationSerial = 0;
/**
* A number of iterations after which to yield time back
* to the system.
*/
const YIELD_PERIOD = 10;
/**
* Cookie lifetime policy is currently used to cleanup on shutdown other
* components such as QuotaManager, localStorage, ServiceWorkers.
@ -322,202 +309,37 @@ var Sanitizer = {
items: {
cache: {
async clear(range) {
let seenException;
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_CACHE", refObj);
try {
// Cache doesn't consult timespan, nor does it have the
// facility for timespan-based eviction. Wipe it.
Services.cache2.clear();
} catch (ex) {
seenException = ex;
}
try {
let imageCache = Cc["@mozilla.org/image/tools;1"]
.getService(Ci.imgITools)
.getImgCacheForDocument(null);
imageCache.clearCache(false); // true=chrome, false=content
} catch (ex) {
seenException = ex;
}
await clearData(range, Ci.nsIClearDataService.CLEAR_ALL_CACHES);
TelemetryStopwatch.finish("FX_SANITIZE_CACHE", refObj);
if (seenException) {
throw seenException;
}
}
},
cookies: {
async clear(range) {
let seenException;
let yieldCounter = 0;
let refObj = {};
// Clear cookies.
TelemetryStopwatch.start("FX_SANITIZE_COOKIES_2", refObj);
try {
if (range) {
// Iterate through the cookies and delete any created after our cutoff.
let cookiesEnum = Services.cookies.enumerator;
while (cookiesEnum.hasMoreElements()) {
let cookie = cookiesEnum.getNext().QueryInterface(Ci.nsICookie2);
if (cookie.creationTime > range[0]) {
// This cookie was created after our cutoff, clear it
Services.cookies.remove(cookie.host, cookie.name, cookie.path,
false, cookie.originAttributes);
if (++yieldCounter % YIELD_PERIOD == 0) {
await new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long
}
}
}
} else {
// Remove everything
Services.cookies.removeAll();
await new Promise(resolve => setTimeout(resolve, 0)); // Don't block the main thread too long
}
} catch (ex) {
seenException = ex;
} finally {
TelemetryStopwatch.finish("FX_SANITIZE_COOKIES_2", refObj);
}
// Clear deviceIds. Done asynchronously (returns before complete).
try {
let mediaMgr = Cc["@mozilla.org/mediaManagerService;1"]
.getService(Ci.nsIMediaManagerService);
mediaMgr.sanitizeDeviceIds(range && range[0]);
} catch (ex) {
seenException = ex;
}
// Clear plugin data.
try {
await clearPluginData(range);
} catch (ex) {
seenException = ex;
}
if (seenException) {
throw seenException;
}
await clearData(range, Ci.nsIClearDataService.CLEAR_COOKIES |
Ci.nsIClearDataService.CLEAR_PLUGIN_DATA |
Ci.nsIClearDataService.CLEAR_MEDIA_DEVICES);
TelemetryStopwatch.finish("FX_SANITIZE_COOKIES_2", refObj);
},
},
offlineApps: {
async clear(range) {
// AppCache: this doesn't wait for the cleanup to be complete.
OfflineAppCacheHelper.clear();
if (range) {
let principals = sas.getActiveOrigins(range[0], range[1])
.QueryInterface(Ci.nsIArray);
let promises = [];
for (let i = 0; i < principals.length; ++i) {
let principal = principals.queryElementAt(i, Ci.nsIPrincipal);
if (principal.URI.scheme != "http" &&
principal.URI.scheme != "https" &&
principal.URI.scheme != "file") {
continue;
}
// LocalStorage
Services.obs.notifyObservers(null, "browser:purge-domain-data", principal.URI.host);
// ServiceWorkers
await ServiceWorkerCleanUp.removeFromPrincipal(principal);
// QuotaManager
promises.push(new Promise(r => {
let req = quotaManagerService.clearStoragesForPrincipal(principal, null, false);
req.callback = () => { r(); };
}));
}
return Promise.all(promises);
}
// LocalStorage
Services.obs.notifyObservers(null, "extension:purge-localStorage");
// ServiceWorkers
await ServiceWorkerCleanUp.removeAll();
// QuotaManager
let promises = [];
await new Promise(resolve => {
quotaManagerService.getUsage(request => {
if (request.resultCode != Cr.NS_OK) {
// We are probably shutting down. We don't want to propagate the
// error, rejecting the promise.
resolve();
return;
}
for (let item of request.result) {
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(item.origin);
let uri = principal.URI;
if (uri.scheme == "http" || uri.scheme == "https" || uri.scheme == "file") {
promises.push(new Promise(r => {
let req = quotaManagerService.clearStoragesForPrincipal(principal, null, false);
req.callback = () => { r(); };
}));
}
}
resolve();
});
});
return Promise.all(promises);
await clearData(range, Ci.nsIClearDataService.CLEAR_DOM_STORAGES);
}
},
history: {
async clear(range) {
let seenException;
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_HISTORY", refObj);
try {
if (range) {
await PlacesUtils.history.removeVisitsByFilter({
beginDate: new Date(range[0] / 1000),
endDate: new Date(range[1] / 1000)
});
} else {
// Remove everything.
await PlacesUtils.history.clear();
}
} catch (ex) {
seenException = ex;
} finally {
TelemetryStopwatch.finish("FX_SANITIZE_HISTORY", refObj);
}
try {
let clearStartingTime = range ? String(range[0]) : "";
Services.obs.notifyObservers(null, "browser:purge-session-history", clearStartingTime);
} catch (ex) {
seenException = ex;
}
try {
let predictor = Cc["@mozilla.org/network/predictor;1"]
.getService(Ci.nsINetworkPredictor);
predictor.reset();
} catch (ex) {
seenException = ex;
}
if (seenException) {
throw seenException;
}
await clearData(range, Ci.nsIClearDataService.CLEAR_HISTORY |
Ci.nsIClearDataService.CLEAR_SESSION_HISTORY);
TelemetryStopwatch.finish("FX_SANITIZE_HISTORY", refObj);
}
},
@ -590,22 +412,8 @@ var Sanitizer = {
async clear(range) {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_DOWNLOADS", refObj);
try {
let filterByTime = null;
if (range) {
// Convert microseconds back to milliseconds for date comparisons.
let rangeBeginMs = range[0] / 1000;
let rangeEndMs = range[1] / 1000;
filterByTime = download => download.startTime >= rangeBeginMs &&
download.startTime <= rangeEndMs;
}
// Clear all completed/cancelled downloads
let list = await Downloads.getList(Downloads.ALL);
list.removeFinished(filterByTime);
} finally {
TelemetryStopwatch.finish("FX_SANITIZE_DOWNLOADS", refObj);
}
await clearData(range, Ci.nsIClearDataService.CLEAR_DOWNLOADS);
TelemetryStopwatch.finish("FX_SANITIZE_DOWNLOADS", refObj);
}
},
@ -613,87 +421,21 @@ var Sanitizer = {
async clear(range) {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_SESSIONS", refObj);
try {
// clear all auth tokens
let sdr = Cc["@mozilla.org/security/sdr;1"]
.getService(Ci.nsISecretDecoderRing);
sdr.logoutAndTeardown();
// clear FTP and plain HTTP auth sessions
Services.obs.notifyObservers(null, "net:clear-active-logins");
} finally {
TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS", refObj);
}
await clearData(range, Ci.nsIClearDataService.CLEAR_AUTH_TOKENS |
Ci.nsIClearDataService.CLEAR_AUTH_CACHE);
TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS", refObj);
}
},
siteSettings: {
async clear(range) {
let seenException;
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_SITESETTINGS", refObj);
let startDateMS = range ? range[0] / 1000 : null;
try {
// Clear site-specific permissions like "Allow this site to open popups"
// we ignore the "end" range and hope it is now() - none of the
// interfaces used here support a true range anyway.
if (startDateMS == null) {
Services.perms.removeAll();
} else {
Services.perms.removeAllSince(startDateMS);
}
} catch (ex) {
seenException = ex;
}
try {
// Clear site-specific settings like page-zoom level
let cps = Cc["@mozilla.org/content-pref/service;1"]
.getService(Ci.nsIContentPrefService2);
if (startDateMS == null) {
cps.removeAllDomains(null);
} else {
cps.removeAllDomainsSince(startDateMS, null);
}
} catch (ex) {
seenException = ex;
}
try {
// Clear site security settings - no support for ranges in this
// interface either, so we clearAll().
let sss = Cc["@mozilla.org/ssservice;1"]
.getService(Ci.nsISiteSecurityService);
sss.clearAll();
} catch (ex) {
seenException = ex;
}
// Clear all push notification subscriptions
try {
await new Promise((resolve, reject) => {
let push = Cc["@mozilla.org/push/Service;1"]
.getService(Ci.nsIPushService);
push.clearForDomain("*", status => {
if (Components.isSuccessCode(status)) {
resolve();
} else {
reject(new Error("Error clearing push subscriptions: " +
status));
}
});
});
} catch (ex) {
seenException = ex;
}
await clearData(range, Ci.nsIClearDataService.CLEAR_PERMISSIONS |
Ci.nsIClearDataService.CLEAR_PREFERENCES |
Ci.nsIClearDataService.CLEAR_DOM_PUSH_NOTIFICATIONS |
Ci.nsIClearDataService.CLEAR_SECURITY_SETTINGS);
TelemetryStopwatch.finish("FX_SANITIZE_SITESETTINGS", refObj);
if (seenException) {
throw seenException;
}
}
},
@ -825,7 +567,7 @@ var Sanitizer = {
pluginData: {
async clear(range) {
await clearPluginData(range);
await clearData(range, Ci.nsIClearDataService.CLEAR_PLUGIN_DATA);
},
},
},
@ -915,70 +657,6 @@ async function sanitizeInternal(items, aItemsToClear, progress, options = {}) {
}
}
async function clearPluginData(range) {
// Clear plugin data.
// As evidenced in bug 1253204, clearing plugin data can sometimes be
// very, very long, for mysterious reasons. Unfortunately, this is not
// something actionable by Mozilla, so crashing here serves no purpose.
//
// For this reason, instead of waiting for sanitization to always
// complete, we introduce a soft timeout. Once this timeout has
// elapsed, we proceed with the shutdown of Firefox.
let seenException;
let promiseClearPluginData = async function() {
const FLAG_CLEAR_ALL = Ci.nsIPluginHost.FLAG_CLEAR_ALL;
let ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
// Determine age range in seconds. (-1 means clear all.) We don't know
// that range[1] is actually now, so we compute age range based
// on the lower bound. If range results in a negative age, do nothing.
let age = range ? (Date.now() / 1000 - range[0] / 1000000) : -1;
if (!range || age >= 0) {
let tags = ph.getPluginTags();
for (let tag of tags) {
try {
let rv = await new Promise(resolve =>
ph.clearSiteData(tag, null, FLAG_CLEAR_ALL, age, resolve)
);
// If the plugin doesn't support clearing by age, clear everything.
if (rv == Cr.NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED) {
await new Promise(resolve =>
ph.clearSiteData(tag, null, FLAG_CLEAR_ALL, -1, resolve)
);
}
} catch (ex) {
// Ignore errors from plug-ins
}
}
}
};
try {
// We don't want to wait for this operation to complete...
promiseClearPluginData = promiseClearPluginData(range);
// ... at least, not for more than 10 seconds.
await Promise.race([
promiseClearPluginData,
new Promise(resolve => setTimeout(resolve, 10000 /* 10 seconds */))
]);
} catch (ex) {
seenException = ex;
}
// Detach waiting for plugin data to be cleared.
promiseClearPluginData.catch(() => {
// If this exception is raised before the soft timeout, it
// will appear in `seenException`. Otherwise, it's too late
// to do anything about it.
});
if (seenException) {
throw seenException;
}
}
async function sanitizeOnShutdown(progress) {
if (Sanitizer.shouldSanitizeOnShutdown) {
// Need to sanitize upon shutdown
@ -1086,13 +764,11 @@ async function maybeSanitizeSessionPrincipals(principals) {
}
async function sanitizeSessionPrincipal(principal) {
return Promise.all([
new Promise(r => {
let req = quotaManagerService.clearStoragesForPrincipal(principal, null, false);
req.callback = () => { r(); };
}).catch(() => {}),
ServiceWorkerCleanUp.removeFromPrincipal(principal).catch(() => {}),
]);
await new Promise(resolve => {
Services.clearData.deleteDataFromPrincipal(principal, true /* user request */,
Ci.nsIClearDataService.CLEAR_DOM_STORAGES,
resolve);
});
}
function sanitizeNewTabSegregation() {
@ -1155,3 +831,16 @@ function safeGetPendingSanitizations() {
return [];
}
}
async function clearData(range, flags) {
if (range) {
await new Promise(resolve => {
Services.clearData.deleteDataInTimeRange(range[0], range[1], true /* user request */,
flags, resolve);
});
} else {
await new Promise(resolve => {
Services.clearData.deleteData(flags, resolve);
});
}
}

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

@ -194,14 +194,6 @@ panelview {
-moz-box-flex: 1;
}
#appMenu-popup > arrowscrollbox > autorepeatbutton {
display: none;
}
#appMenu-popup > arrowscrollbox > scrollbox {
overflow: visible;
}
#appMenu-popup > .panel-arrowcontainer > .panel-arrowcontent,
panel[photon] > .panel-arrowcontainer > .panel-arrowcontent {
overflow: hidden;
@ -1109,8 +1101,8 @@ menuitem.panel-subview-footer@menuStateActive@,
margin-inline-end: 3px;
}
#BMB_bookmarksPopup .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box > .autorepeatbutton-up,
#BMB_bookmarksPopup .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box > .autorepeatbutton-down {
#BMB_bookmarksPopup .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box > .scrollbutton-up,
#BMB_bookmarksPopup .panel-arrowcontainer > .panel-arrowcontent > .popup-internal-box > .scrollbutton-down {
-moz-appearance: none;
margin-top: 0;
margin-bottom: 0;

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

@ -16,8 +16,8 @@ gyp_vars.update({
'build_with_mozilla': 1,
'build_with_chromium': 0,
# 10.9 once we move to TC cross-compiles - bug 1270217
'mac_sdk_min': '10.7',
'mac_deployment_target': '10.7',
'mac_sdk_min': '10.9',
'mac_deployment_target': '10.9',
'use_official_google_api_keys': 0,
'have_clock_monotonic': 1 if CONFIG['HAVE_CLOCK_MONOTONIC'] else 0,
'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0,

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

@ -144,7 +144,7 @@ include('android-ndk.configure', when=compiling_android)
# This needs to happen before any compilation test is done.
option('--enable-macos-target', env='MACOSX_DEPLOYMENT_TARGET', nargs=1,
default='10.7', help='Set the minimum MacOS version needed at runtime')
default='10.9', help='Set the minimum MacOS version needed at runtime')
@depends('--enable-macos-target', target)

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

@ -4,46 +4,7 @@
# Setup for build cache
# Avoid duplication if the file happens to be included twice.
if test -z "$bucket" -a -z "$NO_CACHE"; then
# buildbot (or builders that use buildprops.json):
if [ -f $topsrcdir/../buildprops.json ]; then
read branch platform master <<EOF
$(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
EOF
bucket=
if test -z "$SCCACHE_DISABLE"; then
case "${branch}" in
try)
case "${master}" in
*scl1.mozilla.com*|*.scl3.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-west-1-try
;;
*use1.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-east-1-try
;;
*usw2.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-west-2-try
;;
esac
;;
autoland|mozilla-inbound)
case "${master}" in
*use1.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-east-1-prod
;;
*usw2.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-west-2-prod
;;
esac
;;
esac
fi
fi
# builds where buildprops didn't have the data (eg: taskcluster or non-buildbot) and without sccache disabled:
# builds where buildprops didn't have the data (eg: taskcluster) and without sccache disabled:
if test -z "$bucket" -a -z "$SCCACHE_DISABLE"; then
# prevent rerun if az is set, or wget is not available
@ -131,5 +92,3 @@ if test -n "$bucket"; then
;;
esac
fi
fi

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

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 61
Version 62
Comparison: https://github.com/devtools-html/debugger.html/compare/release-60...release-61
Comparison: https://github.com/devtools-html/debugger.html/compare/release-61...release-62
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2

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

@ -1759,6 +1759,37 @@ menuseparator {
.function-signature .comma {
color: var(--object-color);
}
.source-icon {
position: relative;
background-color: var(--theme-comment);
mask-size: 100%;
display: inline-block;
margin-inline-end: 5px;
}
.source-icon,
.source-icon svg {
width: 15px;
height: 15px;
}
.source-icon.prettyPrint {
mask: url("chrome://devtools/skin/images/debugger/prettyPrint.svg") no-repeat;
mask-size: 100%;
background: var(--theme-highlight-blue);
fill: var(--theme-textbox-box-shadow);
}
.source-icon.blackBox {
mask: url("chrome://devtools/skin/images/debugger/blackBox.svg") no-repeat;
mask-size: 100%;
background: var(--theme-highlight-blue);
}
.source-icon.react {
mask-size: 100%;
background: var(--theme-highlight-bluegrey);
}
/* 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/>. */
@ -2902,37 +2933,6 @@ debug-expression-error {
border-radius: 2px;
margin: 0 -1px -1px -1px;
}
.source-icon {
position: relative;
background-color: var(--theme-comment);
mask-size: 100%;
display: inline-block;
margin-inline-end: 5px;
}
.source-icon,
.source-icon svg {
width: 15px;
height: 15px;
}
.source-icon.prettyPrint {
mask: url("chrome://devtools/skin/images/debugger/prettyPrint.svg") no-repeat;
mask-size: 100%;
background: var(--theme-highlight-blue);
fill: var(--theme-textbox-box-shadow);
}
.source-icon.blackBox {
mask: url("chrome://devtools/skin/images/debugger/blackBox.svg") no-repeat;
mask-size: 100%;
background: var(--theme-highlight-blue);
}
.source-icon.react {
mask-size: 100%;
background: var(--theme-highlight-bluegrey);
}
/* 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/>. */

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

@ -239,7 +239,7 @@ class Editor extends _react.PureComponent {
}
setupEditor() {
const editor = (0, _editor.createEditor)(); // disables the default search shortcuts
const editor = (0, _editor.getEditor)(); // disables the default search shortcuts
// $FlowIgnore
editor._initShortcuts = () => {};
@ -284,7 +284,6 @@ class Editor extends _react.PureComponent {
this.setState({
editor
});
(0, _editor.setEditor)(editor);
return editor;
}

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

@ -16,6 +16,10 @@ var _devtoolsContextmenu = require("devtools/client/debugger/new/dist/vendors").
var _reactRedux = require("devtools/client/shared/vendor/react-redux");
var _SourceIcon = require("../shared/SourceIcon");
var _SourceIcon2 = _interopRequireDefault(_SourceIcon);
var _selectors = require("../../selectors/index");
var _sourceTree = require("../../actions/source-tree");
@ -311,8 +315,8 @@ var _initialiseProps = function () {
}
const source = this.getSource(item);
return _react2.default.createElement("img", {
className: (0, _classnames2.default)((0, _source.getSourceClassnames)(source), "source-icon")
return _react2.default.createElement(_SourceIcon2.default, {
source: source
});
};

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

@ -138,16 +138,16 @@ class Breakpoint extends _react.PureComponent {
highlightText() {
const text = this.getBreakpointText();
const codeMirror = (0, _editor.getCodeMirror)();
const editor = (0, _editor.getEditor)();
if (!text || !codeMirror) {
if (!editor.CodeMirror) {
return {
__html: ""
__html: text
};
}
const node = document.createElement("div");
codeMirror.constructor.runMode(text, "application/javascript", node);
editor.CodeMirror.runMode(text, "application/javascript", node);
return {
__html: node.innerHTML
};

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

@ -81,7 +81,8 @@ class Breakpoints extends _react.Component {
key: source.url,
onClick: () => this.props.selectSource(source.id)
}, _react2.default.createElement(_SourceIcon2.default, {
source: source
source: source,
shouldHide: icon => ["file", "javascript"].includes(icon)
}), (0, _source.getFilename)(source)), ...breakpoints.map(breakpoint => _react2.default.createElement(_Breakpoint2.default, {
breakpoint: breakpoint,
source: source,

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

@ -51,21 +51,7 @@ Object.keys(_ui).forEach(function (key) {
}
});
});
var _createEditor = require("./create-editor");
Object.keys(_createEditor).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _createEditor[key];
}
});
});
exports.setEditor = setEditor;
exports.getEditor = getEditor;
exports.getCodeMirror = getCodeMirror;
exports.removeEditor = removeEditor;
exports.shouldShowPrettyPrint = shouldShowPrettyPrint;
exports.shouldShowFooter = shouldShowFooter;
@ -84,6 +70,8 @@ exports.clearLineClass = clearLineClass;
exports.getTextForLine = getTextForLine;
exports.getCursorLine = getCursorLine;
var _createEditor = require("./create-editor");
var _source = require("../source");
var _wasm = require("../wasm");
@ -96,16 +84,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
let editor;
function setEditor(_editor) {
editor = _editor;
}
function getEditor() {
return editor;
}
if (editor) {
return editor;
}
function getCodeMirror() {
return editor && editor.codeMirror;
editor = (0, _createEditor.createEditor)();
return editor;
}
function removeEditor() {

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

@ -75,6 +75,10 @@ class SourceEditor {
return this.editor;
}
get CodeMirror() {
return CodeMirror;
}
setText(str) {
this.editor.setValue(str);
}

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

@ -25,6 +25,7 @@
} else { // Assuming it's a detached DOM element.
dialog.appendChild(template);
}
CodeMirror.addClass(wrap, 'dialog-opened');
return dialog;
}
@ -47,6 +48,7 @@
} else {
if (closed) return;
closed = true;
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
dialog.parentNode.removeChild(dialog);
me.focus();
@ -102,6 +104,7 @@
function close() {
if (closed) return;
closed = true;
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
dialog.parentNode.removeChild(dialog);
me.focus();
}
@ -141,6 +144,7 @@
if (closed) return;
closed = true;
clearTimeout(doneTimer);
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
dialog.parentNode.removeChild(dialog);
}

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

@ -333,7 +333,7 @@
i = avoidWrap ? 0 : this.data.list.length - 1;
if (this.selectedHint == i) return;
var node = this.hints.childNodes[this.selectedHint];
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
node = this.hints.childNodes[this.selectedHint = i];
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
if (node.offsetTop < this.hints.scrollTop)

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

@ -69,4 +69,4 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
}
};
});
});

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -746,6 +746,16 @@ function collapsedSpanAtSide(line, start) {
function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
function collapsedSpanAround(line, ch) {
var sps = sawCollapsedSpans && line.markedSpans, found
if (sps) { for (var i = 0; i < sps.length; ++i) {
var sp = sps[i]
if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
(!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker }
} }
return found
}
// Test whether there exists a collapsed span that partially
// overlaps (covers the start or end, but not both) of a new span.
// Such overlap is not allowed.
@ -2778,12 +2788,11 @@ function coordsChar(cm, x, y) {
var lineObj = getLine(doc, lineN)
for (;;) {
var found = coordsCharInner(cm, lineObj, lineN, x, y)
var merged = collapsedSpanAtEnd(lineObj)
var mergedPos = merged && merged.find(0, true)
if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
{ lineN = lineNo(lineObj = mergedPos.to.line) }
else
{ return found }
var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0))
if (!collapsed) { return found }
var rangeEnd = collapsed.find(1)
if (rangeEnd.line == lineN) { return rangeEnd }
lineObj = getLine(doc, lineN = rangeEnd.line)
}
}
@ -3543,6 +3552,7 @@ var NativeScrollbars = function(place, scroll, cm) {
this.cm = cm
var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar")
var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar")
vert.tabIndex = horiz.tabIndex = -1
place(vert); place(horiz)
on(vert, "scroll", function () {
@ -7476,7 +7486,7 @@ function leftButtonSelect(cm, event, start, behavior) {
}
var move = operation(cm, function (e) {
if (!e_button(e)) { done(e) }
if (e.buttons === 0 || !e_button(e)) { done(e) }
else { extend(e) }
})
var up = operation(cm, done)
@ -8755,8 +8765,12 @@ ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
this.showMultipleSelections(info)
};
ContentEditableInput.prototype.getSelection = function () {
return this.cm.display.wrapper.ownerDocument.getSelection()
};
ContentEditableInput.prototype.showPrimarySelection = function () {
var sel = window.getSelection(), cm = this.cm, prim = cm.doc.sel.primary()
var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary()
var from = prim.from(), to = prim.to()
if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
@ -8823,13 +8837,13 @@ ContentEditableInput.prototype.showMultipleSelections = function (info) {
};
ContentEditableInput.prototype.rememberSelection = function () {
var sel = window.getSelection()
var sel = this.getSelection()
this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset
this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset
};
ContentEditableInput.prototype.selectionInEditor = function () {
var sel = window.getSelection()
var sel = this.getSelection()
if (!sel.rangeCount) { return false }
var node = sel.getRangeAt(0).commonAncestorContainer
return contains(this.div, node)
@ -8864,14 +8878,14 @@ ContentEditableInput.prototype.receivedFocus = function () {
};
ContentEditableInput.prototype.selectionChanged = function () {
var sel = window.getSelection()
var sel = this.getSelection()
return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
};
ContentEditableInput.prototype.pollSelection = function () {
if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
var sel = window.getSelection(), cm = this.cm
var sel = this.getSelection(), cm = this.cm
// On Android Chrome (version 56, at least), backspacing into an
// uneditable block element will put the cursor in that element,
// and then, because it's not editable, hide the virtual keyboard.
@ -9045,12 +9059,13 @@ function isInGutter(node) {
function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
function domTextBetween(cm, from, to, fromLine, toLine) {
var text = "", closing = false, lineSep = cm.doc.lineSeparator()
var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false
function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
function close() {
if (closing) {
text += lineSep
closing = false
if (extraLinebreak) { text += lineSep }
closing = extraLinebreak = false
}
}
function addText(str) {
@ -9062,8 +9077,8 @@ function domTextBetween(cm, from, to, fromLine, toLine) {
function walk(node) {
if (node.nodeType == 1) {
var cmText = node.getAttribute("cm-text")
if (cmText != null) {
addText(cmText || node.textContent.replace(/\u200b/g, ""))
if (cmText) {
addText(cmText)
return
}
var markerID = node.getAttribute("cm-marker"), range
@ -9074,19 +9089,24 @@ function domTextBetween(cm, from, to, fromLine, toLine) {
return
}
if (node.getAttribute("contenteditable") == "false") { return }
var isBlock = /^(pre|div|p)$/i.test(node.nodeName)
var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName)
if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }
if (isBlock) { close() }
for (var i = 0; i < node.childNodes.length; i++)
{ walk(node.childNodes[i]) }
if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true }
if (isBlock) { closing = true }
} else if (node.nodeType == 3) {
addText(node.nodeValue)
addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "))
}
}
for (;;) {
walk(from)
if (from == to) { break }
from = from.nextSibling
extraLinebreak = false
}
return text
}
@ -9658,7 +9678,7 @@ CodeMirror.fromTextArea = fromTextArea
addLegacyProps(CodeMirror)
CodeMirror.version = "5.37.0"
CodeMirror.version = "5.38.0"
return CodeMirror;

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

@ -75,17 +75,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return ret(ch);
} else if (ch == "=" && stream.eat(">")) {
return ret("=>", "operator");
} else if (ch == "0" && stream.eat(/x/i)) {
stream.eatWhile(/[\da-f]/i);
return ret("number", "number");
} else if (ch == "0" && stream.eat(/o/i)) {
stream.eatWhile(/[0-7]/i);
return ret("number", "number");
} else if (ch == "0" && stream.eat(/b/i)) {
stream.eatWhile(/[01]/i);
} else if (ch == "0" && stream.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) {
return ret("number", "number");
} else if (/\d/.test(ch)) {
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
stream.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/);
return ret("number", "number");
} else if (ch == "/") {
if (stream.eat("*")) {
@ -96,7 +89,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return ret("comment", "comment");
} else if (expressionAllowed(stream, state, 1)) {
readRegexp(stream);
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
return ret("regexp", "string-2");
} else {
stream.eat("=");
@ -265,21 +258,42 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
pass.apply(null, arguments);
return true;
}
function inList(name, list) {
for (var v = list; v; v = v.next) if (v.name == name) return true
return false;
}
function register(varname) {
function inList(list) {
for (var v = list; v; v = v.next)
if (v.name == varname) return true;
return false;
}
var state = cx.state;
cx.marked = "def";
if (state.context) {
if (inList(state.localVars)) return;
state.localVars = {name: varname, next: state.localVars};
if (state.lexical.info == "var" && state.context && state.context.block) {
// FIXME function decls are also not block scoped
var newContext = registerVarScoped(varname, state.context)
if (newContext != null) {
state.context = newContext
return
}
} else if (!inList(varname, state.localVars)) {
state.localVars = new Var(varname, state.localVars)
return
}
}
// Fall through means this is global
if (parserConfig.globalVars && !inList(varname, state.globalVars))
state.globalVars = new Var(varname, state.globalVars)
}
function registerVarScoped(varname, context) {
if (!context) {
return null
} else if (context.block) {
var inner = registerVarScoped(varname, context.prev)
if (!inner) return null
if (inner == context.prev) return context
return new Context(inner, context.vars, true)
} else if (inList(varname, context.vars)) {
return context
} else {
if (inList(state.globalVars)) return;
if (parserConfig.globalVars)
state.globalVars = {name: varname, next: state.globalVars};
return new Context(context.prev, new Var(varname, context.vars), false)
}
}
@ -289,15 +303,23 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
// Combinators
var defaultVars = {name: "this", next: {name: "arguments"}};
function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
function Var(name, next) { this.name = name; this.next = next }
var defaultVars = new Var("this", new Var("arguments", null))
function pushcontext() {
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
cx.state.localVars = defaultVars;
cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
cx.state.localVars = defaultVars
}
function pushblockcontext() {
cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
cx.state.localVars = null
}
function popcontext() {
cx.state.localVars = cx.state.context.vars;
cx.state.context = cx.state.context.prev;
cx.state.localVars = cx.state.context.vars
cx.state.context = cx.state.context.prev
}
popcontext.lex = true
function pushlex(type, info) {
var result = function() {
var state = cx.state, indent = state.indented;
@ -329,12 +351,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function statement(type, value) {
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
if (type == "debugger") return cont(expect(";"));
if (type == "{") return cont(pushlex("}"), block, poplex);
if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
if (type == ";") return cont();
if (type == "if") {
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
@ -363,18 +385,20 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(pushlex("stat"), maybelabel);
}
}
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"),
block, poplex, poplex);
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
block, poplex, poplex, popcontext);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
statement, poplex, popcontext);
if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
if (type == "async") return cont(statement)
if (value == "@") return cont(expression, statement)
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
function maybeCatchBinding(type) {
if (type == "(") return cont(funarg, expect(")"))
}
function expression(type, value) {
return expressionInner(type, value, false);
}
@ -783,7 +807,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
cc: [],
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: parserConfig.localVars,
context: parserConfig.localVars && {vars: parserConfig.localVars},
context: parserConfig.localVars && new Context(null, null, false),
indented: basecolumn || 0
};
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
@ -824,7 +848,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
lexical = lexical.prev;
var type = lexical.type, closing = firstChar == type;
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "form") return lexical.indented + indentUnit;
else if (type == "stat")

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

@ -217,6 +217,15 @@ Editor.prototype = {
config: null,
Doc: null,
/**
* Exposes the CodeMirror class. We want to be able to
* invoke static commands such as runMode for syntax highlighting.
*/
get CodeMirror() {
const codeMirror = editors.get(this);
return codeMirror && codeMirror.constructor;
},
/**
* Exposes the CodeMirror instance. We want to get away from trying to
* abstract away the API entirely, and this makes it easier to integrate in

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

@ -86,6 +86,35 @@
" [keyword yield] [variable-2 i];",
"}");
MT("let_scoping",
"[keyword function] [def scoped]([def n]) {",
" { [keyword var] [def i]; } [variable-2 i];",
" { [keyword let] [def j]; [variable-2 j]; } [variable j];",
" [keyword if] ([atom true]) { [keyword const] [def k]; [variable-2 k]; } [variable k];",
"}");
MT("switch_scoping",
"[keyword switch] ([variable x]) {",
" [keyword default]:",
" [keyword let] [def j];",
" [keyword return] [variable-2 j]",
"}",
"[variable j];")
MT("leaving_scope",
"[keyword function] [def a]() {",
" {",
" [keyword const] [def x] [operator =] [number 1]",
" [keyword if] ([atom true]) {",
" [keyword let] [def y] [operator =] [number 2]",
" [keyword var] [def z] [operator =] [number 3]",
" [variable console].[property log]([variable-2 x], [variable-2 y], [variable-2 z])",
" }",
" [variable console].[property log]([variable-2 x], [variable y], [variable-2 z])",
" }",
" [variable console].[property log]([variable x], [variable y], [variable-2 z])",
"}")
MT("quotedStringAddition",
"[keyword let] [def f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];");
@ -239,6 +268,8 @@
"[keyword const] [def async] [operator =] {[property a]: [number 1]};",
"[keyword const] [def foo] [operator =] [string-2 `bar ${][variable async].[property a][string-2 }`];")
MT("bigint", "[number 1n] [operator +] [number 0x1afn] [operator +] [number 0o064n] [operator +] [number 0b100n];")
MT("async_comment",
"[keyword async] [comment /**/] [keyword function] [def foo]([def args]) { [keyword return] [atom true]; }");

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

@ -889,6 +889,15 @@ testCM("hiddenLinesSelectAll", function(cm) { // Issue #484
eqCursorPos(cm.getCursor(false), Pos(10, 4));
});
testCM("clickFold", function(cm) { // Issue #5392
cm.setValue("foo { bar }")
var widget = document.createElement("span")
widget.textContent = "<>"
cm.markText(Pos(0, 5), Pos(0, 10), {replacedWith: widget})
var after = cm.charCoords(Pos(0, 10))
var foundOn = cm.coordsChar({left: after.left - 1, top: after.top + 4})
is(foundOn.ch <= 5 || foundOn.ch >= 10, "Position is not inside the folded range")
})
testCM("everythingFolded", function(cm) {
addDoc(cm, 2, 2);

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

@ -918,13 +918,13 @@ class TwoByteString : public Variant<JSAtom*, const char16_t*, JS::ubi::EdgeName
public:
template<typename T>
MOZ_IMPLICIT TwoByteString(T&& rhs) : Base(Forward<T>(rhs)) { }
MOZ_IMPLICIT TwoByteString(T&& rhs) : Base(std::forward<T>(rhs)) { }
template<typename T>
TwoByteString& operator=(T&& rhs) {
MOZ_ASSERT(this != &rhs, "self-move disallowed");
this->~TwoByteString();
new (this) TwoByteString(Forward<T>(rhs));
new (this) TwoByteString(std::forward<T>(rhs));
return *this;
}

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

@ -13,7 +13,7 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/AsyncEventDispatcher.h" // For AsyncEventDispatcher
#include "mozilla/Maybe.h" // For Maybe
#include "mozilla/TypeTraits.h" // For Forward<>
#include "mozilla/TypeTraits.h" // For std::forward<>
#include "nsAnimationManager.h" // For CSSAnimation
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
#include "nsIDocument.h" // For nsIDocument

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

@ -24,7 +24,7 @@
#include "mozilla/ServoBindings.h" // Servo_GetProperties_Overriding_Animation
#include "mozilla/ServoStyleSet.h"
#include "mozilla/StyleAnimationValue.h"
#include "mozilla/TypeTraits.h" // For Forward<>
#include "mozilla/TypeTraits.h" // For std::forward<>
#include "nsContentUtils.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSPropertyIDSet.h"

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

@ -7,34 +7,11 @@
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "AccessCheck.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/MessageManagerBinding.h"
namespace mozilla {
namespace dom {
ChromeMessageBroadcaster::ChromeMessageBroadcaster(ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageListenerManager(nullptr, aParentManager,
aFlags |
MessageManagerFlags::MM_BROADCASTER |
MessageManagerFlags::MM_CHROME)
{
if (mIsProcessManager) {
mozilla::HoldJSObjects(this);
}
if (aParentManager) {
aParentManager->AddChildManager(this);
}
}
ChromeMessageBroadcaster::~ChromeMessageBroadcaster()
{
if (mIsProcessManager) {
mozilla::DropJSObjects(this);
}
}
JSObject*
ChromeMessageBroadcaster::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
@ -44,28 +21,5 @@ ChromeMessageBroadcaster::WrapObject(JSContext* aCx,
return ChromeMessageBroadcasterBinding::Wrap(aCx, this, aGivenProto);
}
void
ChromeMessageBroadcaster::ReleaseCachedProcesses()
{
ContentParent::ReleaseCachedProcesses();
}
void
ChromeMessageBroadcaster::AddChildManager(MessageListenerManager* aManager)
{
mChildManagers.AppendElement(aManager);
RefPtr<nsFrameMessageManager> kungfuDeathGrip = this;
RefPtr<nsFrameMessageManager> kungfuDeathGrip2 = aManager;
LoadPendingScripts(this, aManager);
}
void
ChromeMessageBroadcaster::RemoveChildManager(MessageListenerManager* aManager)
{
mChildManagers.RemoveElement(aManager);
}
} // namespace dom
} // namespace mozilla

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

@ -7,74 +7,31 @@
#ifndef mozilla_dom_ChromeMessageBroadcaster_h
#define mozilla_dom_ChromeMessageBroadcaster_h
#include "mozilla/dom/MessageListenerManager.h"
#include "mozilla/dom/MessageBroadcaster.h"
namespace mozilla {
namespace dom {
class ChromeMessageBroadcaster final : public MessageListenerManager
/**
* Implementation for the WebIDL ChromeMessageBroadcaster interface. Used for window and
* group message managers.
*/
class ChromeMessageBroadcaster final : public MessageBroadcaster
{
public:
explicit ChromeMessageBroadcaster(MessageManagerFlags aFlags)
: ChromeMessageBroadcaster(nullptr, aFlags)
{
MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
MessageManagerFlags::MM_PROCESSMANAGER |
MessageManagerFlags::MM_OWNSCALLBACK)));
}
explicit ChromeMessageBroadcaster(ChromeMessageBroadcaster* aParentManager)
explicit ChromeMessageBroadcaster(MessageBroadcaster* aParentManager)
: ChromeMessageBroadcaster(aParentManager, MessageManagerFlags::MM_NONE)
{}
static ChromeMessageBroadcaster* From(nsFrameMessageManager* aManager)
{
if (aManager->IsBroadcaster() && aManager->IsChrome()) {
return static_cast<ChromeMessageBroadcaster*>(aManager);
}
return nullptr;
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void BroadcastAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
JS::Handle<JS::Value> aObj,
JS::Handle<JSObject*> aObjects,
mozilla::ErrorResult& aError)
{
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, nullptr,
JS::UndefinedHandleValue, aError);
}
uint32_t ChildCount()
{
return mChildManagers.Length();
}
MessageListenerManager* GetChildAt(uint32_t aIndex)
{
return mChildManagers.SafeElementAt(aIndex);
}
void ReleaseCachedProcesses();
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
// GlobalProcessScriptLoader
using nsFrameMessageManager::GetInitialProcessData;
// FrameScriptLoader
void LoadFrameScript(const nsAString& aUrl, bool aAllowDelayedLoad,
bool aRunInGlobalScope, mozilla::ErrorResult& aError)
@ -92,13 +49,13 @@ public:
GetDelayedScripts(aCx, aScripts, aError);
}
void AddChildManager(MessageListenerManager* aManager);
void RemoveChildManager(MessageListenerManager* aManager);
private:
ChromeMessageBroadcaster(ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags);
virtual ~ChromeMessageBroadcaster();
ChromeMessageBroadcaster(MessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageBroadcaster(aParentManager,
aFlags |
MessageManagerFlags::MM_CHROME)
{}
};
} // namespace dom

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

@ -10,24 +10,6 @@
namespace mozilla {
namespace dom {
ChromeMessageSender::ChromeMessageSender(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageSender(aCallback, aParentManager, aFlags | MessageManagerFlags::MM_CHROME)
{
MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
MessageManagerFlags::MM_PROCESSMANAGER |
MessageManagerFlags::MM_OWNSCALLBACK)));
// This is a bit hackish. We attach to the parent, but only if we have a callback. We
// don't have a callback for the frame message manager, and for parent process message
// managers (except the parent in-process message manager). In those cases we wait until
// the child process is running (see MessageSender::InitWithCallback).
if (aParentManager && mCallback) {
aParentManager->AddChildManager(this);
}
}
JSObject*
ChromeMessageSender::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)

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

@ -12,35 +12,21 @@
namespace mozilla {
namespace dom {
class ChromeMessageBroadcaster;
class MessageBroadcaster;
class ChromeMessageSender final : public MessageSender
{
public:
ChromeMessageSender(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageManagerFlags aFlags=MessageManagerFlags::MM_NONE);
explicit ChromeMessageSender(MessageBroadcaster* aParentManager)
: MessageSender(nullptr, aParentManager, MessageManagerFlags::MM_CHROME)
{
// This is a bit hackish, we wait until the child process is running before attaching
// to the parent manager (see MessageSender::InitWithCallback).
}
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
// FrameScriptLoader
void LoadFrameScript(const nsAString& aUrl, bool aAllowDelayedLoad,
bool aRunInGlobalScope, mozilla::ErrorResult& aError)

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

@ -13,6 +13,7 @@
#include "nsIdentifierMapEntry.h"
class nsContentList;
class nsIDocument;
class nsINode;
namespace mozilla {
@ -20,6 +21,7 @@ class StyleSheet;
namespace dom {
class Element;
class StyleSheetList;
class ShadowRoot;

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

@ -0,0 +1,48 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/dom/MessageBroadcaster.h"
#include "mozilla/dom/ContentParent.h"
namespace mozilla {
namespace dom {
MessageBroadcaster::MessageBroadcaster(MessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageListenerManager(nullptr, aParentManager,
aFlags |
MessageManagerFlags::MM_BROADCASTER)
{
if (aParentManager) {
aParentManager->AddChildManager(this);
}
}
void
MessageBroadcaster::ReleaseCachedProcesses()
{
ContentParent::ReleaseCachedProcesses();
}
void
MessageBroadcaster::AddChildManager(MessageListenerManager* aManager)
{
mChildManagers.AppendElement(aManager);
RefPtr<nsFrameMessageManager> kungfuDeathGrip = this;
RefPtr<nsFrameMessageManager> kungfuDeathGrip2 = aManager;
LoadPendingScripts(this, aManager);
}
void
MessageBroadcaster::RemoveChildManager(MessageListenerManager* aManager)
{
mChildManagers.RemoveElement(aManager);
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_MessageBroadcaster_h
#define mozilla_dom_MessageBroadcaster_h
#include "mozilla/dom/MessageListenerManager.h"
namespace mozilla {
namespace dom {
/**
* Implementation for the WebIDL MessageBroadcaster interface. Base class for window and
* process broadcaster message managers.
*/
class MessageBroadcaster : public MessageListenerManager
{
public:
static MessageBroadcaster* From(MessageListenerManager* aManager)
{
if (aManager->IsBroadcaster()) {
return static_cast<MessageBroadcaster*>(aManager);
}
return nullptr;
}
void BroadcastAsyncMessage(JSContext* aCx, const nsAString& aMessageName,
JS::Handle<JS::Value> aObj,
JS::Handle<JSObject*> aObjects,
mozilla::ErrorResult& aError)
{
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, nullptr,
JS::UndefinedHandleValue, aError);
}
uint32_t ChildCount()
{
return mChildManagers.Length();
}
MessageListenerManager* GetChildAt(uint32_t aIndex)
{
return mChildManagers.SafeElementAt(aIndex);
}
void ReleaseCachedProcesses();
void AddChildManager(MessageListenerManager* aManager);
void RemoveChildManager(MessageListenerManager* aManager);
protected:
MessageBroadcaster(MessageBroadcaster* aParentManager, MessageManagerFlags aFlags);
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_MessageBroadcaster_h

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

@ -10,7 +10,7 @@ namespace mozilla {
namespace dom {
MessageListenerManager::MessageListenerManager(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageBroadcaster* aParentManager,
ipc::MessageManagerFlags aFlags)
: nsFrameMessageManager(aCallback, aFlags),
mParentManager(aParentManager)

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

@ -14,6 +14,12 @@
namespace mozilla {
namespace dom {
class MessageBroadcaster;
/**
* Implementation for the WebIDL MessageListenerManager interface. Base class for message
* managers that are exposed to script.
*/
class MessageListenerManager : public nsFrameMessageManager,
public nsWrapperCache
{
@ -22,12 +28,12 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(MessageListenerManager,
nsFrameMessageManager)
ChromeMessageBroadcaster* GetParentObject()
MessageBroadcaster* GetParentObject()
{
return mParentManager;
}
virtual ChromeMessageBroadcaster* GetParentManager() override
virtual MessageBroadcaster* GetParentManager() override
{
return mParentManager;
}
@ -40,11 +46,11 @@ public:
protected:
MessageListenerManager(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageBroadcaster* aParentManager,
MessageManagerFlags aFlags);
virtual ~MessageListenerManager();
RefPtr<ChromeMessageBroadcaster> mParentManager;
RefPtr<MessageBroadcaster> mParentManager;
};
} // namespace dom

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

@ -78,7 +78,7 @@ public:
mMessageManager->SendAsyncMessage(aCx, aMessageName, aObj, aObjects,
aPrincipal, aTransfers, aError);
}
already_AddRefed<ChromeMessageSender> GetProcessMessageManager(mozilla::ErrorResult& aError)
already_AddRefed<ProcessMessageManager> GetProcessMessageManager(mozilla::ErrorResult& aError)
{
if (!mMessageManager) {
aError.Throw(NS_ERROR_NULL_POINTER);

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

@ -12,6 +12,12 @@
namespace mozilla {
namespace dom {
class MessageBroadcaster;
/**
* Implementation for the WebIDL MessageSender interface. Base class for frame and child
* process message managers.
*/
class MessageSender : public MessageListenerManager
{
public:
@ -19,7 +25,7 @@ public:
protected:
MessageSender(ipc::MessageManagerCallback* aCallback,
ChromeMessageBroadcaster* aParentManager,
MessageBroadcaster* aParentManager,
MessageManagerFlags aFlags)
: MessageListenerManager(aCallback, aParentManager, aFlags)
{}

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

@ -20,8 +20,9 @@
*/
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/ChromeUtilsBinding.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/ErrorResult.h"
#include "nsID.h"
namespace mozilla {
namespace dom {

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

@ -7,6 +7,8 @@
#ifndef mozilla_dom_NameSpaceConstants_h__
#define mozilla_dom_NameSpaceConstants_h__
#include <stdint.h>
#define kNameSpaceID_Unknown -1
// 0 is special at C++, so use a static const int32_t for
// kNameSpaceID_None to keep if from being cast to pointers

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

@ -0,0 +1,38 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/dom/ParentProcessMessageManager.h"
#include "AccessCheck.h"
#include "mozilla/HoldDropJSObjects.h"
#include "mozilla/dom/MessageManagerBinding.h"
namespace mozilla {
namespace dom {
ParentProcessMessageManager::ParentProcessMessageManager()
: MessageBroadcaster(nullptr,
MessageManagerFlags::MM_CHROME |
MessageManagerFlags::MM_PROCESSMANAGER)
{
mozilla::HoldJSObjects(this);
}
ParentProcessMessageManager::~ParentProcessMessageManager()
{
mozilla::DropJSObjects(this);
}
JSObject*
ParentProcessMessageManager::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
MOZ_ASSERT(nsContentUtils::IsSystemCaller(aCx));
return ParentProcessMessageManagerBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,55 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_ParentProcessMessageManager_h
#define mozilla_dom_ParentProcessMessageManager_h
#include "mozilla/dom/MessageBroadcaster.h"
namespace mozilla {
namespace dom {
/**
* Implementation for the WebIDL ParentProcessMessageManager interface.
* ParentProcessMessageManager is used in a parent process to communicate with all the
* child processes.
*/
class ParentProcessMessageManager final : public MessageBroadcaster
{
public:
ParentProcessMessageManager();
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
// GlobalProcessScriptLoader
using nsFrameMessageManager::GetInitialProcessData;
private:
virtual ~ParentProcessMessageManager();
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ParentProcessMessageManager_h

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

@ -0,0 +1,41 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/MessageManagerBinding.h"
namespace mozilla {
namespace dom {
ProcessMessageManager::ProcessMessageManager(ipc::MessageManagerCallback* aCallback,
ParentProcessMessageManager* aParentManager,
MessageManagerFlags aFlags)
: MessageSender(aCallback, aParentManager,
aFlags | MessageManagerFlags::MM_CHROME |
MessageManagerFlags::MM_PROCESSMANAGER)
{
MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
MessageManagerFlags::MM_OWNSCALLBACK)));
// This is a bit hackish. We attach to the parent manager, but only if we have a
// callback (which is only for the in-process message manager). For other cases we wait
// until the child process is running (see MessageSender::InitWithCallback).
if (aParentManager && mCallback) {
aParentManager->AddChildManager(this);
}
}
JSObject*
ProcessMessageManager::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
MOZ_ASSERT(nsContentUtils::IsSystemCaller(aCx));
return ProcessMessageManagerBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,52 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_ProcessMessageManager_h
#define mozilla_dom_ProcessMessageManager_h
#include "mozilla/dom/MessageSender.h"
namespace mozilla {
namespace dom {
class ParentProcessMessageManager;
/**
* ProcessMessageManager is used in a parent process to communicate with a child process
* (or with the process itself in a single-process scenario).
*/
class ProcessMessageManager final : public MessageSender
{
public:
ProcessMessageManager(ipc::MessageManagerCallback* aCallback,
ParentProcessMessageManager* aParentManager,
MessageManagerFlags aFlags=MessageManagerFlags::MM_NONE);
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// ProcessScriptLoader
void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad,
mozilla::ErrorResult& aError)
{
LoadScript(aUrl, aAllowDelayedLoad, false, aError);
}
void RemoveDelayedProcessScript(const nsAString& aURL)
{
RemoveDelayedScript(aURL);
}
void GetDelayedProcessScripts(JSContext* aCx,
nsTArray<nsTArray<JS::Value>>& aScripts,
mozilla::ErrorResult& aError)
{
GetDelayedScripts(aCx, aScripts, aError);
}
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ProcessMessageManager_h

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

@ -18,6 +18,7 @@
#include "mozilla/ServoStyleRuleMap.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/dom/StyleSheetList.h"
using namespace mozilla;
using namespace mozilla::dom;

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

@ -7,6 +7,7 @@
#include "mozilla/dom/StyleSheetList.h"
#include "mozilla/dom/StyleSheetListBinding.h"
#include "nsINode.h"
namespace mozilla {
namespace dom {

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

@ -190,6 +190,7 @@ EXPORTS.mozilla.dom += [
'IntlUtils.h',
'Link.h',
'Location.h',
'MessageBroadcaster.h',
'MessageListenerManager.h',
'MessageManagerGlobal.h',
'MessageSender.h',
@ -199,8 +200,10 @@ EXPORTS.mozilla.dom += [
'NodeInfo.h',
'NodeInfoInlines.h',
'NodeIterator.h',
'ParentProcessMessageManager.h',
'Pose.h',
'ProcessGlobal.h',
'ProcessMessageManager.h',
'ResponsiveImageSelector.h',
'SameProcessMessageQueue.h',
'ScreenOrientation.h',
@ -271,6 +274,7 @@ UNIFIED_SOURCES += [
'IntlUtils.cpp',
'Link.cpp',
'Location.cpp',
'MessageBroadcaster.cpp',
'MessageListenerManager.cpp',
'MessageManagerGlobal.cpp',
'MessageSender.cpp',
@ -344,9 +348,11 @@ UNIFIED_SOURCES += [
'nsXHTMLContentSerializer.cpp',
'nsXMLContentSerializer.cpp',
'nsXMLNameSpaceMap.cpp',
'ParentProcessMessageManager.cpp',
'Pose.cpp',
'PostMessageEvent.cpp',
'ProcessGlobal.cpp',
'ProcessMessageManager.cpp',
'ResponsiveImageSelector.cpp',
'SameProcessMessageQueue.cpp',
'ScreenOrientation.cpp',

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

@ -30,7 +30,9 @@
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ParentProcessMessageManager.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TimeoutManager.h"
@ -86,7 +88,7 @@ nsCCUncollectableMarker::Init()
}
static void
MarkChildMessageManagers(ChromeMessageBroadcaster* aMM)
MarkChildMessageManagers(MessageBroadcaster* aMM)
{
aMM->MarkForCC();
@ -97,9 +99,8 @@ MarkChildMessageManagers(ChromeMessageBroadcaster* aMM)
continue;
}
RefPtr<ChromeMessageBroadcaster> strongNonLeafMM =
ChromeMessageBroadcaster::From(childMM);
ChromeMessageBroadcaster* nonLeafMM = strongNonLeafMM;
RefPtr<MessageBroadcaster> strongNonLeafMM = MessageBroadcaster::From(childMM);
MessageBroadcaster* nonLeafMM = strongNonLeafMM;
MessageListenerManager* tabMM = childMM;

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

@ -37,8 +37,10 @@
#include "mozilla/CheckedInt.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/dom/MessageBroadcaster.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/DOMException.h"
#include "mozilla/dom/DOMExceptionBinding.h"
@ -48,6 +50,7 @@
#include "mozilla/dom/Event.h"
#include "mozilla/dom/FileSystemSecurity.h"
#include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/FontTableURIProtocolHandler.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
@ -110,7 +113,6 @@
#include "nsGenericHTMLElement.h"
#include "nsGenericHTMLFrameElement.h"
#include "nsGkAtoms.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsHtml5Module.h"
#include "nsHtml5StringParser.h"
#include "nsHTMLDocument.h"
@ -2366,8 +2368,7 @@ nsContentUtils::IsCallerContentXBL()
// For remote XUL, we run XBL in the XUL scope. Given that we care about
// compat and not security for remote XUL, just always claim to be XBL.
if (!xpc::AllowContentXBLScope(realm)) {
DebugOnly<JSCompartment*> c = JS::GetCompartmentForRealm(realm);
MOZ_ASSERT(nsContentUtils::AllowXULXBLForPrincipal(xpc::GetCompartmentPrincipal(c)));
MOZ_ASSERT(nsContentUtils::AllowXULXBLForPrincipal(xpc::GetRealmPrincipal(realm)));
return true;
}
@ -7656,7 +7657,7 @@ nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost)
}
bool
nsContentUtils::CallOnAllRemoteChildren(ChromeMessageBroadcaster* aManager,
nsContentUtils::CallOnAllRemoteChildren(MessageBroadcaster* aManager,
CallOnRemoteChildFunction aCallback,
void* aArg)
{
@ -7667,7 +7668,7 @@ nsContentUtils::CallOnAllRemoteChildren(ChromeMessageBroadcaster* aManager,
continue;
}
RefPtr<ChromeMessageBroadcaster> nonLeafMM = ChromeMessageBroadcaster::From(childMM);
RefPtr<MessageBroadcaster> nonLeafMM = MessageBroadcaster::From(childMM);
if (nonLeafMM) {
if (CallOnAllRemoteChildren(nonLeafMM, aCallback, aArg)) {
return true;
@ -7697,7 +7698,7 @@ nsContentUtils::CallOnAllRemoteChildren(nsPIDOMWindowOuter* aWindow,
{
nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(aWindow);
if (window->IsChromeWindow()) {
RefPtr<ChromeMessageBroadcaster> windowMM = window->GetMessageManager();
RefPtr<MessageBroadcaster> windowMM = window->GetMessageManager();
if (windowMM) {
CallOnAllRemoteChildren(windowMM, aCallback, aArg);
}

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

@ -124,7 +124,6 @@ class EventListenerManager;
class HTMLEditor;
namespace dom {
class ChromeMessageBroadcaster;
struct CustomElementDefinition;
class DocumentFragment;
class Element;
@ -135,6 +134,7 @@ class IPCDataTransfer;
class IPCDataTransferItem;
struct LifecycleCallbackArgs;
struct LifecycleAdoptedCallbackArgs;
class MessageBroadcaster;
class NodeInfo;
class nsIContentChild;
class nsIContentParent;
@ -3305,7 +3305,7 @@ private:
mozilla::dom::AutocompleteInfo& aInfo,
bool aGrantAllValidValue = false);
static bool CallOnAllRemoteChildren(mozilla::dom::ChromeMessageBroadcaster* aManager,
static bool CallOnAllRemoteChildren(mozilla::dom::MessageBroadcaster* aManager,
CallOnRemoteChildFunction aCallback,
void* aArg);

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

@ -23,10 +23,7 @@
#include "nsThreadUtils.h"
using namespace mozilla;
using mozilla::dom::TreeOrderComparator;
using mozilla::dom::Animation;
using mozilla::dom::Element;
using namespace mozilla::dom;
AutoTArray<RefPtr<nsDOMMutationObserver>, 4>*
nsDOMMutationObserver::sScheduledMutationObservers = nullptr;

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

@ -127,7 +127,7 @@
#include "nsBindingManager.h"
#include "nsHTMLDocument.h"
#include "nsIRequest.h"
#include "nsHostObjectProtocolHandler.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "nsCharsetSource.h"
#include "nsIParser.h"
@ -229,7 +229,6 @@
#include "nsViewportInfo.h"
#include "mozilla/StaticPtr.h"
#include "nsITextControlElement.h"
#include "nsIDOMNSEditableElement.h"
#include "nsIEditor.h"
#include "nsIHttpChannelInternal.h"
#include "nsISecurityConsoleMessage.h"

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

@ -2947,7 +2947,7 @@ nsFrameLoader::EnsureMessageManager()
parentManager = nsFrameMessageManager::GetGlobalMessageManager();
}
mMessageManager = new ChromeMessageSender(nullptr, parentManager);
mMessageManager = new ChromeMessageSender(parentManager);
if (!IsRemoteFrame()) {
nsresult rv = MaybeCreateDocShell();
if (NS_FAILED(rv)) {
@ -3388,7 +3388,7 @@ nsFrameLoader::PopulateUserContextIdFromAttribute(OriginAttributes& aAttr)
return NS_OK;
}
ChromeMessageSender*
ProcessMessageManager*
nsFrameLoader::GetProcessMessageManager() const
{
return mRemoteBrowser ? mRemoteBrowser->Manager()->GetMessageManager()

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

@ -53,6 +53,7 @@ class ChromeMessageSender;
class ContentParent;
class MessageSender;
class PBrowserParent;
class ProcessMessageManager;
class Promise;
class TabParent;
class MutableTabContext;
@ -333,7 +334,7 @@ public:
// Properly retrieves documentSize of any subdocument type.
nsresult GetWindowDimensions(nsIntRect& aRect);
virtual mozilla::dom::ChromeMessageSender* GetProcessMessageManager() const override;
virtual mozilla::dom::ProcessMessageManager* GetProcessMessageManager() const override;
// public because a callback needs these.
RefPtr<mozilla::dom::ChromeMessageSender> mMessageManager;

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

@ -36,13 +36,14 @@
#include "mozilla/Telemetry.h"
#include "mozilla/dom/ChildProcessMessageManager.h"
#include "mozilla/dom/ChromeMessageBroadcaster.h"
#include "mozilla/dom/ChromeMessageSender.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/MessageManagerBinding.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ParentProcessMessageManager.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/ProcessMessageManager.h"
#include "mozilla/dom/ResolveSystemBinding.h"
#include "mozilla/dom/SameProcessMessageQueue.h"
#include "mozilla/dom/ScriptSettings.h"
@ -162,7 +163,7 @@ MessageManagerCallback::DoGetRemoteType(nsAString& aRemoteType,
ErrorResult& aError) const
{
aRemoteType.Truncate();
mozilla::dom::ChromeMessageSender* parent = GetProcessMessageManager();
mozilla::dom::ProcessMessageManager* parent = GetProcessMessageManager();
if (!parent) {
return;
}
@ -916,8 +917,7 @@ nsFrameMessageManager::Close()
if (!mClosed) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(NS_ISUPPORTS_CAST(nsIContentFrameMessageManager*, this),
"message-manager-close", nullptr);
obs->NotifyObservers(this, "message-manager-close", nullptr);
}
}
mClosed = true;
@ -934,8 +934,7 @@ nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
if (!mDisconnected) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(NS_ISUPPORTS_CAST(nsIContentFrameMessageManager*, this),
"message-manager-disconnect", nullptr);
obs->NotifyObservers(this, "message-manager-disconnect", nullptr);
}
}
@ -1000,10 +999,10 @@ nsFrameMessageManager::GetInitialProcessData(JSContext* aCx,
aInitialProcessData.set(init);
}
already_AddRefed<ChromeMessageSender>
already_AddRefed<ProcessMessageManager>
nsFrameMessageManager::GetProcessMessageManager(ErrorResult& aError)
{
RefPtr<ChromeMessageSender> pmm;
RefPtr<ProcessMessageManager> pmm;
if (mCallback) {
pmm = mCallback->GetProcessMessageManager();
}
@ -1442,7 +1441,7 @@ nsMessageManagerScriptExecutor::MarkScopesForCC()
NS_IMPL_ISUPPORTS(nsScriptCacheCleaner, nsIObserver)
ChildProcessMessageManager* nsFrameMessageManager::sChildProcessManager = nullptr;
ChromeMessageBroadcaster* nsFrameMessageManager::sParentProcessManager = nullptr;
ParentProcessMessageManager* nsFrameMessageManager::sParentProcessManager = nullptr;
nsFrameMessageManager* nsFrameMessageManager::sSameProcessParentManager = nullptr;
class nsAsyncMessageToSameProcessChild : public nsSameProcessAsyncMessageBase,
@ -1457,7 +1456,7 @@ public:
NS_IMETHOD Run() override
{
nsFrameMessageManager* ppm = nsFrameMessageManager::GetChildProcessManager();
ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm), nullptr, ppm);
ReceiveMessage(ppm, nullptr, ppm);
return NS_OK;
}
};
@ -1594,7 +1593,7 @@ public:
nsresult HandleMessage() override
{
nsFrameMessageManager* ppm = nsFrameMessageManager::sSameProcessParentManager;
ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm), nullptr, ppm);
ReceiveMessage(ppm, nullptr, ppm);
return NS_OK;
}
};
@ -1662,8 +1661,7 @@ NS_NewParentProcessMessageManager(nsISupports** aResult)
{
NS_ASSERTION(!nsFrameMessageManager::sParentProcessManager,
"Re-creating sParentProcessManager");
RefPtr<ChromeMessageBroadcaster> mm =
new ChromeMessageBroadcaster(MessageManagerFlags::MM_PROCESSMANAGER);
RefPtr<ParentProcessMessageManager> mm = new ParentProcessMessageManager();
nsFrameMessageManager::sParentProcessManager = mm;
nsFrameMessageManager::NewProcessMessageManager(false); // Create same process message manager.
mm.forget(aResult);
@ -1671,7 +1669,7 @@ NS_NewParentProcessMessageManager(nsISupports** aResult)
}
ChromeMessageSender*
ProcessMessageManager*
nsFrameMessageManager::NewProcessMessageManager(bool aIsRemote)
{
if (!nsFrameMessageManager::sParentProcessManager) {
@ -1681,18 +1679,16 @@ nsFrameMessageManager::NewProcessMessageManager(bool aIsRemote)
MOZ_ASSERT(nsFrameMessageManager::sParentProcessManager,
"parent process manager not created");
ChromeMessageSender* mm;
ProcessMessageManager* mm;
if (aIsRemote) {
// Callback is set in ContentParent::InitInternal so that the process has
// already started when we send pending scripts.
mm = new ChromeMessageSender(nullptr,
nsFrameMessageManager::sParentProcessManager,
MessageManagerFlags::MM_PROCESSMANAGER);
mm = new ProcessMessageManager(nullptr,
nsFrameMessageManager::sParentProcessManager);
} else {
mm = new ChromeMessageSender(new SameParentProcessMessageManagerCallback(),
nsFrameMessageManager::sParentProcessManager,
MessageManagerFlags::MM_PROCESSMANAGER |
MessageManagerFlags::MM_OWNSCALLBACK);
mm = new ProcessMessageManager(new SameParentProcessMessageManagerCallback(),
nsFrameMessageManager::sParentProcessManager,
MessageManagerFlags::MM_OWNSCALLBACK);
sSameProcessParentManager = mm;
}
return mm;

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

@ -43,12 +43,14 @@ class nsIContentParent;
class nsIContentChild;
class ChildProcessMessageManager;
class ChromeMessageBroadcaster;
class ChromeMessageSender;
class ClonedMessageData;
class MessageBroadcaster;
class MessageListener;
class MessageListenerManager;
class MessageManagerReporter;
template<typename T> class Optional;
class ParentProcessMessageManager;
class ProcessMessageManager;
namespace ipc {
@ -96,7 +98,7 @@ public:
return NS_OK;
}
virtual mozilla::dom::ChromeMessageSender* GetProcessMessageManager() const
virtual mozilla::dom::ProcessMessageManager* GetProcessMessageManager() const
{
return nullptr;
}
@ -202,7 +204,7 @@ public:
DispatchAsyncMessage(aCx, aMessageName, aObj, aObjects, aPrincipal, aTransfers,
aError);
}
already_AddRefed<mozilla::dom::ChromeMessageSender>
already_AddRefed<mozilla::dom::ProcessMessageManager>
GetProcessMessageManager(mozilla::ErrorResult& aError);
void GetRemoteType(nsAString& aRemoteType, mozilla::ErrorResult& aError) const;
@ -234,8 +236,7 @@ public:
NS_DECL_NSIMESSAGESENDER
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
static mozilla::dom::ChromeMessageSender*
NewProcessMessageManager(bool aIsRemote);
static mozilla::dom::ProcessMessageManager* NewProcessMessageManager(bool aIsRemote);
void ReceiveMessage(nsISupports* aTarget, nsFrameLoader* aTargetFrameLoader,
const nsAString& aMessage, bool aIsSync,
@ -269,7 +270,7 @@ public:
// GetGlobalMessageManager creates the global message manager if it hasn't been yet.
static already_AddRefed<mozilla::dom::ChromeMessageBroadcaster>
GetGlobalMessageManager();
static mozilla::dom::ChromeMessageBroadcaster* GetParentProcessManager()
static mozilla::dom::ParentProcessMessageManager* GetParentProcessManager()
{
return sParentProcessManager;
}
@ -289,7 +290,7 @@ public:
protected:
friend class MMListenerRemover;
virtual mozilla::dom::ChromeMessageBroadcaster* GetParentManager()
virtual mozilla::dom::MessageBroadcaster* GetParentManager()
{
return nullptr;
}
@ -343,7 +344,7 @@ protected:
void LoadPendingScripts(nsFrameMessageManager* aManager,
nsFrameMessageManager* aChildMM);
public:
static mozilla::dom::ChromeMessageBroadcaster* sParentProcessManager;
static mozilla::dom::ParentProcessMessageManager* sParentProcessManager;
static nsFrameMessageManager* sSameProcessParentManager;
static nsTArray<nsCOMPtr<nsIRunnable> >* sPendingSameProcessAsyncMessages;
private:

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

@ -1758,11 +1758,8 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
nsJSPrincipals::get(JS::GetRealmPrincipals(realm));
aDocument->NodePrincipal()->Equals(existing, &sameOrigin);
MOZ_ASSERT(sameOrigin);
JSCompartment* compartment = JS::GetCompartmentForRealm(realm);
MOZ_ASSERT_IF(aDocument == oldDoc,
xpc::GetCompartmentPrincipal(compartment) ==
aDocument->NodePrincipal());
xpc::GetRealmPrincipal(realm) == aDocument->NodePrincipal());
#endif
if (aDocument != oldDoc) {
JS::SetRealmPrincipals(realm,

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

@ -6,11 +6,11 @@
#include "nsIGlobalObject.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "mozilla/dom/ServiceWorker.h"
#include "mozilla/dom/ServiceWorkerRegistration.h"
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "nsHostObjectProtocolHandler.h"
using mozilla::MallocSizeOf;
using mozilla::Maybe;
@ -67,7 +67,7 @@ public:
MOZ_ASSERT(NS_IsMainThread());
for (uint32_t index = 0; index < mURIs.Length(); ++index) {
nsHostObjectProtocolHandler::RemoveDataEntry(mURIs[index]);
BlobURLProtocolHandler::RemoveDataEntry(mURIs[index]);
}
return NS_OK;
@ -90,14 +90,14 @@ nsIGlobalObject::UnlinkHostObjectURIs()
if (NS_IsMainThread()) {
for (uint32_t index = 0; index < mHostObjectURIs.Length(); ++index) {
nsHostObjectProtocolHandler::RemoveDataEntry(mHostObjectURIs[index]);
BlobURLProtocolHandler::RemoveDataEntry(mHostObjectURIs[index]);
}
mHostObjectURIs.Clear();
return;
}
// nsHostObjectProtocolHandler is main-thread only.
// BlobURLProtocolHandler is main-thread only.
RefPtr<UnlinkHostObjectURIsRunnable> runnable =
new UnlinkHostObjectURIsRunnable(mHostObjectURIs);
@ -123,7 +123,7 @@ nsIGlobalObject::TraverseHostObjectURIs(nsCycleCollectionTraversalCallback &aCb)
}
for (uint32_t index = 0; index < mHostObjectURIs.Length(); ++index) {
nsHostObjectProtocolHandler::Traverse(mHostObjectURIs[index], aCb);
BlobURLProtocolHandler::Traverse(mHostObjectURIs[index], aCb);
}
}

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

@ -1446,7 +1446,7 @@ GetNodeFromNodeOrString(const OwningNodeOrString& aNode,
* https://dom.spec.whatwg.org/#converting-nodes-into-a-node for |prepend()|,
* |append()|, |before()|, |after()|, and |replaceWith()| APIs.
*/
static already_AddRefed<nsINode>
MOZ_CAN_RUN_SCRIPT static already_AddRefed<nsINode>
ConvertNodesOrStringsIntoNode(const Sequence<OwningNodeOrString>& aNodes,
nsIDocument* aDocument,
ErrorResult& aRv)
@ -1529,8 +1529,8 @@ nsINode::Before(const Sequence<OwningNodeOrString>& aNodes,
nsCOMPtr<nsINode> viablePreviousSibling =
FindViablePreviousSibling(*this, aNodes);
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1552,8 +1552,8 @@ nsINode::After(const Sequence<OwningNodeOrString>& aNodes,
nsCOMPtr<nsINode> viableNextSibling = FindViableNextSibling(*this, aNodes);
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1572,8 +1572,8 @@ nsINode::ReplaceWith(const Sequence<OwningNodeOrString>& aNodes,
nsCOMPtr<nsINode> viableNextSibling = FindViableNextSibling(*this, aNodes);
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1628,8 +1628,8 @@ void
nsINode::Prepend(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv)
{
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1642,8 +1642,8 @@ void
nsINode::Append(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv)
{
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}

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

@ -1859,10 +1859,12 @@ public:
mozilla::dom::Element* GetPreviousElementSibling() const;
mozilla::dom::Element* GetNextElementSibling() const;
void Before(const Sequence<OwningNodeOrString>& aNodes, ErrorResult& aRv);
void After(const Sequence<OwningNodeOrString>& aNodes, ErrorResult& aRv);
void ReplaceWith(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void Before(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void After(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void ReplaceWith(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
/**
* Remove this node from its parent, if any.
*/
@ -1872,8 +1874,10 @@ public:
mozilla::dom::Element* GetFirstElementChild() const;
mozilla::dom::Element* GetLastElementChild() const;
void Prepend(const Sequence<OwningNodeOrString>& aNodes, ErrorResult& aRv);
void Append(const Sequence<OwningNodeOrString>& aNodes, ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void Prepend(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void Append(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv);
void GetBoxQuads(const BoxQuadOptions& aOptions,
nsTArray<RefPtr<DOMQuad> >& aResult,

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

@ -19,6 +19,7 @@
#include "nsCOMPtr.h"
#include "nsAtom.h"
#include "nsHashKeys.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
@ -26,6 +27,12 @@ class nsIContent;
class nsContentList;
class nsBaseContentList;
namespace mozilla {
namespace dom {
class Element;
}
}
/**
* Right now our identifier map entries contain information for 'name'
* and 'id' mappings of a given string. This is so that

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

@ -3157,7 +3157,7 @@ nsRange::GetClientRectsAndTexts(
nsresult
nsRange::GetUsedFontFaces(nsTArray<nsAutoPtr<InspectorFontFace>>& aResult,
uint32_t aMaxRanges)
uint32_t aMaxRanges, bool aSkipCollapsedWhitespace)
{
NS_ENSURE_TRUE(mStart.Container(), NS_ERROR_UNEXPECTED);
@ -3201,17 +3201,20 @@ nsRange::GetUsedFontFaces(nsTArray<nsAutoPtr<InspectorFontFace>>& aResult,
int32_t offset = startContainer == endContainer ?
mEnd.Offset() : content->GetText()->GetLength();
nsLayoutUtils::GetFontFacesForText(frame, mStart.Offset(), offset,
true, fontFaces, aMaxRanges);
true, fontFaces, aMaxRanges,
aSkipCollapsedWhitespace);
continue;
}
if (node == endContainer) {
nsLayoutUtils::GetFontFacesForText(frame, 0, mEnd.Offset(),
true, fontFaces, aMaxRanges);
true, fontFaces, aMaxRanges,
aSkipCollapsedWhitespace);
continue;
}
}
nsLayoutUtils::GetFontFacesForFrames(frame, fontFaces, aMaxRanges);
nsLayoutUtils::GetFontFacesForFrames(frame, fontFaces, aMaxRanges,
aSkipCollapsedWhitespace);
}
// Take ownership of the InspectorFontFaces in the table and move them into

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

@ -270,7 +270,8 @@ public:
// where each face was used).
nsresult GetUsedFontFaces(
nsTArray<nsAutoPtr<mozilla::dom::InspectorFontFace>>& aResult,
uint32_t aMaxRanges);
uint32_t aMaxRanges,
bool aSkipCollapsedWhitespace);
// nsIMutationObserver methods
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED

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

@ -178,7 +178,7 @@ public:
template<typename... Args>
InternalType& Construct(Args&&... aArgs)
{
mImpl.emplace(Forward<Args>(aArgs)...);
mImpl.emplace(std::forward<Args>(aArgs)...);
return *mImpl;
}

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

@ -683,10 +683,6 @@ DOMInterfaces = {
'headerFile': 'nsGeoPosition.h'
},
'PositionError': {
'headerFile': 'nsGeolocation.h'
},
'PromiseDebugging': {
'concrete': False,
},

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

@ -2869,10 +2869,10 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
Generate the CollectJSONAttributes method for an interface descriptor
"""
def __init__(self, descriptor, toJSONMethod):
args = [Argument('JSContext*', 'aCx'),
args = [Argument('JSContext*', 'cx'),
Argument('JS::Handle<JSObject*>', 'obj'),
Argument('%s*' % descriptor.nativeType, 'self'),
Argument('JS::Rooted<JSObject*>&', 'aResult')]
Argument('JS::Rooted<JSObject*>&', 'result')]
CGAbstractMethod.__init__(self, descriptor, 'CollectJSONAttributes',
'bool', args, canRunScript=True)
self.toJSONMethod = toJSONMethod
@ -2882,15 +2882,16 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
interface = self.descriptor.interface
toJSONCondition = PropertyDefiner.getControllingCondition(self.toJSONMethod,
self.descriptor)
needUnwrappedObj = False
for m in interface.members:
if m.isAttr() and not m.isStatic() and m.type.isJSONType():
getAndDefine = fill(
"""
JS::Rooted<JS::Value> temp(aCx);
if (!get_${name}(aCx, obj, self, JSJitGetterCallArgs(&temp))) {
JS::Rooted<JS::Value> temp(cx);
if (!get_${name}(cx, obj, self, JSJitGetterCallArgs(&temp))) {
return false;
}
if (!JS_DefineProperty(aCx, aResult, "${name}", temp, JSPROP_ENUMERATE)) {
if (!JS_DefineProperty(cx, result, "${name}", temp, JSPROP_ENUMERATE)) {
return false;
}
""",
@ -2901,12 +2902,13 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
# possibly be disabled, but other things might be.
condition = PropertyDefiner.getControllingCondition(m, self.descriptor)
if condition.hasDisablers() and condition != toJSONCondition:
needUnwrappedObj = True;
ret += fill(
"""
// This is unfortunately a linear scan through sAttributes, but we
// only do it for things which _might_ be disabled, which should
// help keep the performance problems down.
if (IsGetterEnabled(aCx, obj, (JSJitGetterOp)get_${name}, sAttributes)) {
if (IsGetterEnabled(cx, unwrappedObj, (JSJitGetterOp)get_${name}, sAttributes)) {
$*{getAndDefine}
}
""",
@ -2921,6 +2923,21 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
""",
getAndDefine=getAndDefine)
ret += 'return true;\n'
if needUnwrappedObj:
ret= fill(
"""
JS::Rooted<JSObject*> unwrappedObj(cx, js::CheckedUnwrap(obj));
if (!unwrappedObj) {
// How did that happen? We managed to get called with that
// object as "this"! Just give up on sanity.
return false;
}
$*{ret}
""",
ret=ret);
return ret

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

@ -8,6 +8,7 @@
#define mozilla_dom_DOMJSClass_h
#include "jsfriendapi.h"
#include "js/Wrapper.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/Likely.h"
@ -154,6 +155,7 @@ struct PrefableDisablers {
template<typename T>
struct Prefable {
inline bool isEnabled(JSContext* cx, JS::Handle<JSObject*> obj) const {
MOZ_ASSERT(!js::IsWrapper(obj));
if (MOZ_LIKELY(!disablers)) {
return true;
}

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

@ -78,7 +78,7 @@ inline bool
ThrowErrorMessage(JSContext* aCx, const ErrNum aErrorNumber, Ts&&... aArgs)
{
binding_detail::ThrowErrorMessage(aCx, static_cast<unsigned>(aErrorNumber),
mozilla::Forward<Ts>(aArgs)...);
std::forward<Ts>(aArgs)...);
return false;
}
@ -97,7 +97,7 @@ struct StringArrayAppender
return;
}
aArgs.AppendElement(aFirst);
Append(aArgs, aCount - 1, Forward<Ts>(aOtherArgs)...);
Append(aArgs, aCount - 1, std::forward<Ts>(aOtherArgs)...);
}
};
@ -293,14 +293,14 @@ public:
void ThrowTypeError(Ts&&... messageArgs)
{
ThrowErrorWithMessage<errorNumber>(NS_ERROR_INTERNAL_ERRORRESULT_TYPEERROR,
Forward<Ts>(messageArgs)...);
std::forward<Ts>(messageArgs)...);
}
template<dom::ErrNum errorNumber, typename... Ts>
void ThrowRangeError(Ts&&... messageArgs)
{
ThrowErrorWithMessage<errorNumber>(NS_ERROR_INTERNAL_ERRORRESULT_RANGEERROR,
Forward<Ts>(messageArgs)...);
std::forward<Ts>(messageArgs)...);
}
bool IsErrorWithMessage() const
@ -434,7 +434,7 @@ private:
nsTArray<nsString>& messageArgsArray = CreateErrorMessageHelper(errorNumber, errorType);
uint16_t argCount = dom::GetErrorArgCount(errorNumber);
dom::StringArrayAppender::Append(messageArgsArray, argCount,
Forward<Ts>(messageArgs)...);
std::forward<Ts>(messageArgs)...);
#ifdef DEBUG
mUnionState = HasMessage;
#endif // DEBUG

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

@ -5131,6 +5131,11 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
if not self.isToJSON():
raise WebIDLError("[Default] is only allowed on toJSON operations",
[attr.location, self.location])
if self.signatures()[0][0] != BuiltinTypes[IDLBuiltinType.Types.object]:
raise WebIDLError("The return type of the default toJSON "
"operation must be 'object'",
[attr.location, self.location]);
elif (identifier == "Throws" or
identifier == "CanOOM" or
identifier == "NewObject" or

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

@ -41,6 +41,48 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw, "Should not allow a toJSON method with arguments.")
parser = parser.reset()
threw = False
try:
parser.parse(
"""
interface Test {
long toJSON();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(not threw, "Should allow a toJSON method with 'long' as return type.")
parser = parser.reset()
threw = False
try:
parser.parse(
"""
interface Test {
[Default] object toJSON();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(not threw, "Should allow a default toJSON method with 'object' as return type.")
parser = parser.reset()
threw = False
try:
parser.parse(
"""
interface Test {
[Default] long toJSON();
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should not allow a default toJSON method with non-'object' as return type.")
parser = parser.reset()
threw = False
try:

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

@ -4,6 +4,7 @@
* 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 "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/TestFunctions.h"
#include "mozilla/dom/TestFunctionsBinding.h"
#include "nsStringBuffer.h"
@ -108,6 +109,37 @@ TestFunctions::ThrowToRejectPromise(GlobalObject& aGlobal, ErrorResult& aError)
return nullptr;
}
int32_t
TestFunctions::One() const
{
return 1;
}
int32_t
TestFunctions::Two() const
{
return 2;
}
bool
TestFunctions::ObjectFromAboutBlank(JSContext* aCx, JSObject* aObj)
{
// We purposefully don't use WindowOrNull here, because we want to
// demonstrate the incorrect behavior we get, not just fail some asserts.
RefPtr<nsGlobalWindowInner> win;
UNWRAP_OBJECT(Window, aObj, win);
if (!win) {
return false;
}
nsIDocument* doc = win->GetDoc();
if (!doc) {
return false;
}
return doc->GetDocumentURI()->GetSpecOrDefault().EqualsLiteral("about:blank");
}
bool
TestFunctions::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aWrapper)

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

@ -46,6 +46,11 @@ public:
ThrowToRejectPromise(GlobalObject& aGlobal,
ErrorResult& aError);
int32_t One() const;
int32_t Two() const;
static bool ObjectFromAboutBlank(JSContext* aCx, JSObject* aObj);
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aWrapper);
private:

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

@ -84,3 +84,5 @@ skip-if = debug == false
[test_stringBindings.html]
skip-if = debug == false
[test_jsimplemented_subclassing.html]
[test_toJSON.html]
skip-if = debug == false

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

@ -12,20 +12,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=827546
/** Test for Bug 827546 **/
var notEditable = document.createElement("div");
var notImage = document.createElement("div");
var thrown;
try {
thrown = false;
SpecialPowers.do_QueryInterface(notEditable, "nsIDOMNSEditableElement");
SpecialPowers.do_QueryInterface(notImage, "nsIImageLoadingContent");
} catch (e) {
thrown = true;
}
ok(thrown,
"QI to nsIDOMNSEditableElement on a non-editable element should fail");
"QI to nsIImageLoadingContent on a non-image element should fail");
var editable = document.createElement("input");
ok(SpecialPowers.do_QueryInterface(editable, "nsIDOMNSEditableElement"),
"Editable element needs to support QI to nsIDOMNSEditableElement");
var image = document.createElement("img");
ok(SpecialPowers.do_QueryInterface(image, "nsIImageLoadingContent"),
"Image element needs to support QI to nsIImageLoadingContent");
</script>
</head>

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

@ -0,0 +1,59 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1465602
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1465602</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1465602">Mozilla Bug 1465602</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe></iframe>
</div>
<pre id="test">
</pre>
<script type="application/javascript">
/** Test for Bug 1465602 **/
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
function go() {
var ourObj = new TestFunctions();
is(ourObj.one, 1, "Basic sanity check for our 'one'");
is(ourObj.two, undefined, "Basic sanity check for our 'two'");
var otherObj = new frames[0].TestFunctions();
is(otherObj.one, 1, "Basic sanity check for subframe 'one'");
is(otherObj.two, 2, "Basic sanity check for subframe 'two'");
var ourToJSON = ourObj.toJSON();
is(ourToJSON.one, 1, "We should have correct value for 'one'");
is(ourToJSON.two, undefined, "We should have correct value for 'two'");
ok(!Object.hasOwnProperty(ourToJSON, "two"),
"We should not have a property named 'two'");
var otherToJSON = otherObj.toJSON();
is(otherToJSON.one, 1, "Subframe should have correct value for 'one'");
is(otherToJSON.two, 2, "Subframe should have correct value for 'two'");
var mixedToJSON = ourObj.toJSON.call(otherObj);
is(mixedToJSON.one, 1, "First test should have correct value for 'one'");
is(mixedToJSON.two, 2, "First test should have correct value for 'two'");
mixedToJSON = otherObj.toJSON.call(ourObj);
is(mixedToJSON.one, 1, "Second test should have correct value for 'one'");
is(mixedToJSON.two, undefined,
"Second test should have correct value for 'two'");
SimpleTest.finish();
}
</script>
</body>
</html>

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

@ -675,18 +675,19 @@ WebGLContext::DrawElements_check(const char* const funcName, const GLsizei rawIn
////
// Index fetching
const auto& indexBuffer = mBoundVertexArray->mElementArrayBuffer;
if (!indexBuffer) {
ErrorInvalidOperation("%s: Index buffer not bound.", funcName);
return false;
}
MOZ_ASSERT(!indexBuffer->IsBoundForTF(), "This should be impossible.");
if (!indexCount || !instanceCount) {
*out_lastVert = Nothing();
return true;
}
const auto& indexBuffer = mBoundVertexArray->mElementArrayBuffer;
size_t availBytes = 0;
if (indexBuffer) {
MOZ_ASSERT(!indexBuffer->IsBoundForTF(), "This should be impossible.");
availBytes = indexBuffer->ByteLength();
}
const size_t availBytes = indexBuffer->ByteLength();
const auto availIndices = AvailGroups(availBytes, byteOffset, bytesPerIndex,
bytesPerIndex);
if (indexCount > availIndices) {

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

@ -44,7 +44,7 @@ fail-if = (os == 'android') || (os == 'linux') || (os == 'mac') || (os == 'win')
fail-if = (os == 'android')
[ensure-exts/test_WEBGL_depth_texture.html]
[ensure-exts/test_WEBGL_draw_buffers.html]
fail-if = (os == 'android') || (os == 'win' && os_version == '5.1')
fail-if = (os == 'android')
[ensure-exts/test_common.html]
@ -68,7 +68,6 @@ support-files = ../captureStream_common.js
[test_fb_param_crash.html]
[test_hidden_alpha.html]
[test_hidden_depth_stencil.html]
fail-if = (os == 'win' && os_version == '5.1')
[test_implicit_color_buffer_float.html]
[test_highp_fs.html]
[test_no_arr_points.html]

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

@ -65,7 +65,8 @@ namespace InspectorUtils {
// to access via its .ranges attribute.
[NewObject, Throws] sequence<InspectorFontFace> getUsedFontFaces(
Range range,
optional unsigned long maxRanges = 0);
optional unsigned long maxRanges = 0,
optional boolean skipCollapsedWhitespace = true);
sequence<DOMString> getCSSPseudoElementNames();
void addPseudoClassLock(Element element,
@ -134,6 +135,8 @@ interface InspectorFontFace {
readonly attribute DOMString CSSFamilyName; // a family name that could be used in CSS font-family
// (not necessarily the actual name that was used,
// due to aliases, generics, localized names, etc)
readonly attribute DOMString CSSGeneric; // CSS generic (serif, sans-serif, etc) that was mapped
// to this font, if any (frequently empty!)
[NewObject,Throws] sequence<InspectorVariationAxis> getVariationAxes();
[NewObject,Throws] sequence<InspectorVariationInstance> getVariationInstances();

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

@ -19,7 +19,7 @@ interface Principal;
*
* Message managers that always have exactly one "other side" are of
* type MessageSender. Parent-side message managers that have many
* "other sides" are of type ChromeMessageBroadcaster.
* "other sides" are of type MessageBroadcaster.
*
* Child-side message managers can send synchronous messages to their
* parent side, but not the other way around.
@ -94,13 +94,13 @@ interface Principal;
* ----------
*
* The global MMg and window MMw's are message broadcasters implementing
* ChromeMessageBroadcaster while the frame MMp's are simple message
* senders (MessageSender). Their counterparts in the content processes
* are message senders implementing ContentFrameMessageManager.
* MessageBroadcaster while the frame MMp's are simple message senders (MessageSender).
* Their counterparts in the content processes are message senders implementing
* ContentFrameMessageManager.
*
* MessageListenerManager
* / \
* MessageSender ChromeMessageBroadcaster
* MessageSender MessageBroadcaster
* |
* SyncMessageSender (content process/in-process only)
* |
@ -352,6 +352,10 @@ interface SyncMessageSender : MessageSender
optional Principal? principal = null);
};
/**
* ChildProcessMessageManager is used in a child process to communicate with the parent
* process.
*/
[ChromeOnly]
interface ChildProcessMessageManager : SyncMessageSender
{
@ -503,7 +507,7 @@ ContentProcessMessageManager implements MessageManagerGlobal;
* managers within its window.
*/
[ChromeOnly]
interface ChromeMessageBroadcaster : MessageListenerManager
interface MessageBroadcaster : MessageListenerManager
{
/**
* Like |sendAsyncMessage()|, but also broadcasts this message to
@ -534,12 +538,38 @@ interface ChromeMessageBroadcaster : MessageListenerManager
*/
void releaseCachedProcesses();
};
ChromeMessageBroadcaster implements GlobalProcessScriptLoader;
/**
* ChromeMessageBroadcaster is used for window and group message managers.
*/
[ChromeOnly]
interface ChromeMessageBroadcaster : MessageBroadcaster
{
};
ChromeMessageBroadcaster implements FrameScriptLoader;
/**
* ParentProcessMessageManager is used in a parent process to communicate with all the
* child processes.
*/
[ChromeOnly]
interface ParentProcessMessageManager : MessageBroadcaster
{
};
ParentProcessMessageManager implements GlobalProcessScriptLoader;
[ChromeOnly]
interface ChromeMessageSender : MessageSender
{
};
ChromeMessageSender implements ProcessScriptLoader;
ChromeMessageSender implements FrameScriptLoader;
/**
* ProcessMessageManager is used in a parent process to communicate with a child process
* (or with the process itself in a single-process scenario).
*/
[ChromeOnly]
interface ProcessMessageManager : MessageSender
{
};
ProcessMessageManager implements ProcessScriptLoader;

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

@ -50,7 +50,7 @@ ClientHandle::StartOp(const ClientOpConstructorArgs& aArgs,
MaybeExecute([aArgs, kungFuGrip, aRejectCallback,
resolve = std::move(aResolveCallback)] (ClientHandleChild* aActor) {
MOZ_RELEASE_ASSERT(aActor);
MOZ_DIAGNOSTIC_ASSERT(aActor);
ClientHandleOpChild* actor =
new ClientHandleOpChild(kungFuGrip, aArgs, std::move(resolve),
std::move(aRejectCallback));
@ -59,7 +59,7 @@ ClientHandle::StartOp(const ClientOpConstructorArgs& aArgs,
return;
}
}, [aRejectCallback] {
MOZ_RELEASE_ASSERT(aRejectCallback);
MOZ_DIAGNOSTIC_ASSERT(aRejectCallback);
aRejectCallback(NS_ERROR_DOM_INVALID_STATE_ERR);
});
}

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

@ -39,9 +39,9 @@ ClientHandleOpChild::ClientHandleOpChild(ClientHandle* aClientHandle,
, mResolveCallback(std::move(aResolveCallback))
, mRejectCallback(std::move(aRejectCallback))
{
MOZ_RELEASE_ASSERT(mClientHandle);
MOZ_RELEASE_ASSERT(mResolveCallback);
MOZ_RELEASE_ASSERT(mRejectCallback);
MOZ_DIAGNOSTIC_ASSERT(mClientHandle);
MOZ_DIAGNOSTIC_ASSERT(mResolveCallback);
MOZ_DIAGNOSTIC_ASSERT(mRejectCallback);
}
} // namespace dom

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

@ -28,12 +28,21 @@ using mozilla::ipc::PrincipalInfo;
namespace {
const uint32_t kBadThreadLocalIndex = -1;
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
const uint32_t kThreadLocalMagic1 = 0x8d57eea6;
const uint32_t kThreadLocalMagic2 = 0x59f375c9;
#endif
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
uint32_t sClientManagerThreadLocalMagic1 = kThreadLocalMagic1;
#endif
uint32_t sClientManagerThreadLocalIndex = kBadThreadLocalIndex;
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
uint32_t sClientManagerThreadLocalMagic2 = kThreadLocalMagic2;
uint32_t sClientManagerThreadLocalIndexDuplicate = kBadThreadLocalIndex;
#endif
} // anonymous namespace
@ -84,11 +93,11 @@ ClientManager::~ClientManager()
Shutdown();
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalMagic1 == kThreadLocalMagic1);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalMagic2 == kThreadLocalMagic2);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex != kBadThreadLocalIndex);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex == sClientManagerThreadLocalIndexDuplicate);
MOZ_RELEASE_ASSERT(this == PR_GetThreadPrivate(sClientManagerThreadLocalIndex));
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalMagic1 == kThreadLocalMagic1);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalMagic2 == kThreadLocalMagic2);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex != kBadThreadLocalIndex);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex == sClientManagerThreadLocalIndexDuplicate);
MOZ_DIAGNOSTIC_ASSERT(this == PR_GetThreadPrivate(sClientManagerThreadLocalIndex));
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
PRStatus status =
@ -194,10 +203,10 @@ ClientManager::StartOp(const ClientOpConstructorArgs& aArgs,
already_AddRefed<ClientManager>
ClientManager::GetOrCreateForCurrentThread()
{
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalMagic1 == kThreadLocalMagic1);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalMagic2 == kThreadLocalMagic2);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex != kBadThreadLocalIndex);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex == sClientManagerThreadLocalIndexDuplicate);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalMagic1 == kThreadLocalMagic1);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalMagic2 == kThreadLocalMagic2);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex != kBadThreadLocalIndex);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex == sClientManagerThreadLocalIndexDuplicate);
RefPtr<ClientManager> cm =
static_cast<ClientManager*>(PR_GetThreadPrivate(sClientManagerThreadLocalIndex));
@ -211,7 +220,7 @@ ClientManager::GetOrCreateForCurrentThread()
MOZ_DIAGNOSTIC_ASSERT(status == PR_SUCCESS);
}
MOZ_RELEASE_ASSERT(cm);
MOZ_DIAGNOSTIC_ASSERT(cm);
return cm.forget();
}
@ -229,10 +238,10 @@ ClientManager::Startup()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalMagic1 == kThreadLocalMagic1);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalMagic2 == kThreadLocalMagic2);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex == kBadThreadLocalIndex);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex == sClientManagerThreadLocalIndexDuplicate);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalMagic1 == kThreadLocalMagic1);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalMagic2 == kThreadLocalMagic2);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex == kBadThreadLocalIndex);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex == sClientManagerThreadLocalIndexDuplicate);
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
PRStatus status =
@ -240,8 +249,10 @@ ClientManager::Startup()
PR_NewThreadPrivateIndex(&sClientManagerThreadLocalIndex, nullptr);
MOZ_DIAGNOSTIC_ASSERT(status == PR_SUCCESS);
MOZ_RELEASE_ASSERT(sClientManagerThreadLocalIndex != kBadThreadLocalIndex);
MOZ_DIAGNOSTIC_ASSERT(sClientManagerThreadLocalIndex != kBadThreadLocalIndex);
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
sClientManagerThreadLocalIndexDuplicate = sClientManagerThreadLocalIndex;
#endif
ClientPrefsInit();
}

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

@ -20,7 +20,7 @@ ClientManagerOpParent::DoServiceOp(Method aMethod, Args&&... aArgs)
{
// Note, we need perfect forarding of the template type in order
// to allow already_AddRefed<> to be passed as an arg.
RefPtr<ClientOpPromise> p = (mService->*aMethod)(Forward<Args>(aArgs)...);
RefPtr<ClientOpPromise> p = (mService->*aMethod)(std::forward<Args>(aArgs)...);
// Capturing `this` is safe here because we disconnect the promise in
// ActorDestroy() which ensures neither lambda is called if the actor

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

@ -17,19 +17,25 @@ namespace dom {
template <typename ActorType>
class ClientThing
{
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
static const uint32_t kMagic1 = 0xC9FE2C9C;
static const uint32_t kMagic2 = 0x832072D4;
#endif
ActorType* mActor;
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
uint32_t mMagic1;
uint32_t mMagic2;
#endif
bool mShutdown;
protected:
ClientThing()
: mActor(nullptr)
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
, mMagic1(kMagic1)
, mMagic2(kMagic2)
#endif
, mShutdown(false)
{
}
@ -38,15 +44,17 @@ protected:
{
AssertIsValid();
ShutdownThing();
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
mMagic1 = 0;
mMagic2 = 0;
#endif
}
void
AssertIsValid() const
{
MOZ_RELEASE_ASSERT(mMagic1 == kMagic1);
MOZ_RELEASE_ASSERT(mMagic2 == kMagic2);
MOZ_DIAGNOSTIC_ASSERT(mMagic1 == kMagic1);
MOZ_DIAGNOSTIC_ASSERT(mMagic2 == kMagic2);
}
// Return the current actor.

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

@ -61,7 +61,7 @@ public:
{
nsTArray<nsString> params;
mozilla::dom::StringArrayAppender::Append(params, sizeof...(Params),
mozilla::Forward<Params>(aParams)...);
std::forward<Params>(aParams)...);
AddConsoleReport(aErrorFlags, aCategory, aPropertiesFile, aSourceFileURI,
aLineNumber, aColumnNumber, aMessageName, params);
}

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

@ -22,7 +22,6 @@
#include "nsContentPolicyUtils.h"
#include "nsDataHandler.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsNetUtil.h"
#include "nsPrintfCString.h"
#include "nsProxyRelease.h"
@ -30,6 +29,7 @@
#include "nsStringStream.h"
#include "nsHttpChannel.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/PerformanceStorage.h"
#include "mozilla/dom/WorkerCommon.h"

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

@ -4,6 +4,7 @@
* 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 "EmptyBlobImpl.h"
#include "MutableBlobStorage.h"
#include "MemoryBlobImpl.h"
#include "mozilla/CheckedInt.h"

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

@ -9,6 +9,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/Mutex.h"
#include "nsCOMPtr.h"
#include "prio.h"
class nsIEventTarget;

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

@ -6,6 +6,8 @@
#include "MutableBlobStreamListener.h"
#include "MutableBlobStorage.h"
#include "nsIInputStream.h"
#include "nsThreadUtils.h"
namespace mozilla {
namespace dom {

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

@ -4,7 +4,10 @@
* 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 "EmptyBlobImpl.h"
#include "mozilla/SlicedInputStream.h"
#include "StreamBlobImpl.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
#include "nsICloneableInputStream.h"

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