Merge autoland to mozilla-central. a=merge

This commit is contained in:
Mihai Alexandru Michis 2020-05-04 18:50:01 +03:00
commit 7af145646a
87 changed files with 725 additions and 278 deletions

2
.gitignore vendored
View File

@ -26,7 +26,7 @@ ID
# User files that may appear at the root
/.mozconfig*
/mozconfig
/mozconfig*
/configure
/old-configure
/config.cache

View File

@ -1713,7 +1713,7 @@ void HyperTextAccessible::SelectionRanges(
aRanges->SetCapacity(sel->RangeCount());
for (uint32_t idx = 0; idx < sel->RangeCount(); idx++) {
nsRange* DOMRange = sel->GetRangeAt(idx);
const nsRange* DOMRange = sel->GetRangeAt(idx);
HyperTextAccessible* startContainer =
nsAccUtils::GetTextContainer(DOMRange->GetStartContainer());
HyperTextAccessible* endContainer =
@ -2033,7 +2033,7 @@ void HyperTextAccessible::GetSpellTextAttr(
uint32_t startOffset = 0, endOffset = 0;
for (int32_t idx = 0; idx < rangeCount; idx++) {
nsRange* range = domSel->GetRangeAt(idx);
const nsRange* range = domSel->GetRangeAt(idx);
if (range->Collapsed()) continue;
// See if the point comes after the range in which case we must continue in
@ -2087,7 +2087,7 @@ void HyperTextAccessible::GetSpellTextAttr(
endOffset = DOMPointToOffset(startNode, startNodeOffset);
if (idx > 0) {
nsRange* prevRange = domSel->GetRangeAt(idx - 1);
const nsRange* prevRange = domSel->GetRangeAt(idx - 1);
startOffset = DOMPointToOffset(prevRange->GetEndContainer(),
prevRange->EndOffset());
}
@ -2107,7 +2107,7 @@ void HyperTextAccessible::GetSpellTextAttr(
// the point is not in a range, that we do not need to compute an end offset,
// and that we should use the end offset of the last range to compute the
// start offset of the text attribute range.
nsRange* prevRange = domSel->GetRangeAt(rangeCount - 1);
const nsRange* prevRange = domSel->GetRangeAt(rangeCount - 1);
startOffset =
DOMPointToOffset(prevRange->GetEndContainer(), prevRange->EndOffset());

View File

@ -36,7 +36,9 @@ this.DownloadsManager = class DownloadsManager {
}
formatDownload(download) {
let referrer = download.source.referrerInfo?.originalReferrer?.spec || null;
let { referrerInfo } = download.source;
let referrer = (referrerInfo && referrerInfo.originalReferrer) || null;
referrer = (referrer && referrer.spec) || null;
return {
hostname: new URL(download.source.url).hostname,
url: download.source.url,

View File

@ -60,6 +60,10 @@ support-files =
window_redirect.html
worker_blobify.js
!/toolkit/content/tests/browser/common/mockTransfer.js
# We don't want to run tests using BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN
# (5 - aka Dynamic First Party Isolation) yet.
prefs =
network.cookie.cookieBehavior=4
[browser_broadcastChannel.js]
[browser_cache.js]

View File

@ -58,6 +58,9 @@ support-files =
browser_1284886_suspend_tab.html
browser_1284886_suspend_tab_2.html
empty.html
# remove this after bug 1628486 is landed
prefs =
network.cookie.cookieBehavior=5
#NB: the following are disabled
# browser_464620_a.html

View File

@ -10,6 +10,17 @@ const URL =
"?" +
RAND;
const HAS_FIRST_PARTY_DOMAIN = [
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN,
].includes(Services.prefs.getIntPref("network.cookie.cookieBehavior"));
const OUTER_ORIGIN = "http://mochi.test:8888";
const INNER_ORIGIN = HAS_FIRST_PARTY_DOMAIN
? "http://example.com^firstPartyDomain=mochi.test"
: "http://example.com";
const SECURE_INNER_ORIGIN = HAS_FIRST_PARTY_DOMAIN
? "https://example.com^firstPartyDomain=mochi.test"
: "https://example.com";
const OUTER_VALUE = "outer-value-" + RAND;
const INNER_VALUE = "inner-value-" + RAND;
@ -27,12 +38,12 @@ add_task(async function session_storage() {
let { storage } = JSON.parse(ss.getTabState(tab));
is(
storage["http://example.com"].test,
storage[INNER_ORIGIN].test,
INNER_VALUE,
"sessionStorage data for example.com has been serialized correctly"
);
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
OUTER_VALUE,
"sessionStorage data for mochi.test has been serialized correctly"
);
@ -43,12 +54,12 @@ add_task(async function session_storage() {
({ storage } = JSON.parse(ss.getTabState(tab)));
is(
storage["http://example.com"].test,
storage[INNER_ORIGIN].test,
"modified1",
"sessionStorage data for example.com has been serialized correctly"
);
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
OUTER_VALUE,
"sessionStorage data for mochi.test has been serialized correctly"
);
@ -60,12 +71,12 @@ add_task(async function session_storage() {
({ storage } = JSON.parse(ss.getTabState(tab)));
is(
storage["http://example.com"].test,
storage[INNER_ORIGIN].test,
"modified2",
"sessionStorage data for example.com has been serialized correctly"
);
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
"modified",
"sessionStorage data for mochi.test has been serialized correctly"
);
@ -79,13 +90,14 @@ add_task(async function session_storage() {
await TabStateFlusher.flush(browser2);
({ storage } = JSON.parse(ss.getTabState(tab2)));
is(
storage["http://example.com"].test,
// TODO: bug 1634734
todo_is(
storage[INNER_ORIGIN].test,
"modified2",
"sessionStorage data for example.com has been duplicated correctly"
);
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
"modified",
"sessionStorage data for mochi.test has been duplicated correctly"
);
@ -96,13 +108,14 @@ add_task(async function session_storage() {
await TabStateFlusher.flush(browser2);
({ storage } = JSON.parse(ss.getTabState(tab2)));
is(
storage["http://example.com"].test,
// TODO: bug 1634734
todo_is(
storage[INNER_ORIGIN].test,
"modified2",
"sessionStorage data for example.com has been duplicated correctly"
);
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
"modified3",
"sessionStorage data for mochi.test has been duplicated correctly"
);
@ -114,11 +127,11 @@ add_task(async function session_storage() {
({ storage } = JSON.parse(ss.getTabState(tab2)));
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
"modified3",
"navigating retains correct storage data"
);
ok(!storage["http://example.com"], "storage data was discarded");
ok(!storage[INNER_ORIGIN], "storage data was discarded");
// Check that loading a new URL discards data.
BrowserTestUtils.loadURI(browser2, "about:mozilla");
@ -134,7 +147,7 @@ add_task(async function session_storage() {
await TabStateFlusher.flush(browser);
({ storage } = JSON.parse(ss.getTabState(tab)));
is(
storage["http://example.com"],
storage[INNER_ORIGIN],
undefined,
"sessionStorage data for example.com has been cleared correctly"
);
@ -172,11 +185,11 @@ add_task(async function purge_domain() {
let { storage } = JSON.parse(ss.getTabState(tab));
ok(
!storage["http://mochi.test:8888"],
!storage[OUTER_ORIGIN],
"sessionStorage data for mochi.test has been purged"
);
is(
storage["http://example.com"].test,
storage[INNER_ORIGIN].test,
INNER_VALUE,
"sessionStorage data for example.com has been preserved"
);
@ -199,12 +212,12 @@ add_task(async function respect_privacy_level() {
},
] = JSON.parse(ss.getClosedTabData(window));
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
OUTER_VALUE,
"http sessionStorage data has been saved"
);
is(
storage["https://example.com"].test,
storage[SECURE_INNER_ORIGIN].test,
INNER_VALUE,
"https sessionStorage data has been saved"
);
@ -222,12 +235,12 @@ add_task(async function respect_privacy_level() {
},
] = JSON.parse(ss.getClosedTabData(window));
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
OUTER_VALUE,
"http sessionStorage data has been saved"
);
ok(
!storage["https://example.com"],
!storage[SECURE_INNER_ORIGIN],
"https sessionStorage data has *not* been saved"
);
@ -267,12 +280,12 @@ add_task(async function respect_privacy_level() {
},
] = JSON.parse(ss.getClosedTabData(window));
is(
storage["http://mochi.test:8888"].test,
storage[OUTER_ORIGIN].test,
OUTER_VALUE,
"http sessionStorage data has been saved"
);
is(
storage["https://example.com"].test,
storage[SECURE_INNER_ORIGIN].test,
INNER_VALUE,
"https sessionStorage data has been saved"
);

View File

@ -498,7 +498,7 @@ TextPropertyEditor.prototype = {
baseURI: this.sheetHref,
unmatchedVariableClass: "ruleview-unmatched-variable",
matchedVariableClass: "ruleview-variable",
isVariableInUse: varName =>
getVariableValue: varName =>
this.rule.elementStyle.getVariable(varName, this.rule.pseudoElement),
};
const frag = outputParser.parseCssProperty(name, val, parserOptions);

View File

@ -10,7 +10,6 @@ DevToolsModules(
'json-panel.css',
'main.css',
'search-box.css',
'search.svg',
'text-panel.css',
'toolbar.css'
)

View File

@ -1,22 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a">
<stop offset="0" stop-color="#427dc2"/>
<stop offset="1" stop-color="#5e9fce"/>
</linearGradient>
<linearGradient id="b">
<stop offset="0" stop-color="#2f5d93"/>
<stop offset="1" stop-color="#3a87bd"/>
</linearGradient>
<filter id="c" width="1.239" height="1.241" x="-.12" y="-.12" color-interpolation-filters="sRGB">
<feGaussianBlur stdDeviation=".637"/>
</filter>
<linearGradient id="d" x1="4.094" x2="4.094" y1="13.423" y2="2.743" xlink:href="#a" gradientUnits="userSpaceOnUse"/>
<linearGradient id="e" x1="8.711" x2="8.711" y1="13.58" y2="2.566" xlink:href="#b" gradientUnits="userSpaceOnUse"/>
</defs>
<path fill="#fff" stroke="#fff" stroke-width="1.5" d="M10.14 1.656c-2.35 0-4.25 1.9-4.25 4.25 0 .752.19 1.45.532 2.063L1.61 12.78l1.562 1.564 4.78-4.78c.64.384 1.387.592 2.19.592 2.35 0 4.25-1.9 4.25-4.25s-1.9-4.25-4.25-4.25zm0 1.532c1.504 0 2.72 1.214 2.72 2.718s-1.216 2.72-2.72 2.72c-1.503 0-2.718-1.216-2.718-2.72 0-1.504 1.215-2.718 2.72-2.718z" stroke-linejoin="round" filter="url(#c)"/>
<path fill="url(#d)" stroke="url(#e)" stroke-width=".6" d="M10 2C7.79 2 6 3.79 6 6c0 .828.256 1.612.688 2.25l-4.875 4.875 1.062 1.063L7.75 9.31C8.388 9.745 9.172 10 10 10c2.21 0 4-1.79 4-4s-1.79-4-4-4zm0 1c1.657 0 3 1.343 3 3s-1.343 3-3 3-3-1.343-3-3 1.343-3 3-3z" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -208,7 +208,7 @@ OutputParser.prototype = {
} else if (
token.tokenType === "function" &&
token.text === "var" &&
options.isVariableInUse
options.getVariableValue
) {
sawVariable = true;
const { node } = this._parseVariable(token, text, tokenStream, options);
@ -220,7 +220,7 @@ OutputParser.prototype = {
if (
token.tokenType !== "function" ||
token.text !== "var" ||
!options.isVariableInUse
!options.getVariableValue
) {
functionData.push(text.substring(token.startOffset, token.endOffset));
}
@ -279,7 +279,7 @@ OutputParser.prototype = {
// Get the variable value if it is in use.
if (tokens && tokens.length === 1) {
varValue = options.isVariableInUse(tokens[0].text);
varValue = options.getVariableValue(tokens[0].text);
}
// Get the variable name.
@ -402,7 +402,7 @@ OutputParser.prototype = {
);
}
++parenDepth;
} else if (token.text === "var" && options.isVariableInUse) {
} else if (token.text === "var" && options.getVariableValue) {
const { node: variableNode, value } = this._parseVariable(
token,
text,
@ -1877,7 +1877,7 @@ OutputParser.prototype = {
* - fontFamilyClass: "" // The class to be used for font families.
* - baseURI: undefined // A string used to resolve
* // relative links.
* - isVariableInUse // A function taking a single
* - getVariableValue // A function taking a single
* // argument, the name of a variable.
* // This should return the variable's
* // value, if it is in use; or null.
@ -1906,7 +1906,7 @@ OutputParser.prototype = {
urlClass: "",
fontFamilyClass: "",
baseURI: undefined,
isVariableInUse: null,
getVariableValue: null,
unmatchedVariableClass: null,
};

View File

@ -575,7 +575,7 @@ function testParseVariable(doc, parser) {
};
const frag = parser.parseCssProperty("color", test.text, {
isVariableInUse: getValue,
getVariableValue: getValue,
unmatchedVariableClass: "unmatched-class",
});

View File

@ -1360,7 +1360,6 @@ nsSHistory::RemoveFromExpirationTracker(nsIBFCacheEntry* aBFEntry) {
}
mHistoryTracker->RemoveObject(entry);
return;
}
// Evicts all content viewers in all history objects. This is very

View File

@ -3146,6 +3146,16 @@ nsresult Document::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
WarnIfSandboxIneffective(docShell, mSandboxFlags, GetChannel());
}
// Set the opener policy for the top level content document.
nsCOMPtr<nsIHttpChannelInternal> httpChan = do_QueryInterface(mChannel);
nsILoadInfo::CrossOriginOpenerPolicy policy =
nsILoadInfo::OPENER_POLICY_UNSAFE_NONE;
if (IsTopLevelContentDocument() && httpChan &&
NS_SUCCEEDED(httpChan->GetCrossOriginOpenerPolicy(&policy)) && docShell &&
docShell->GetBrowsingContext()) {
docShell->GetBrowsingContext()->SetOpenerPolicy(policy);
}
// The CSP directives upgrade-insecure-requests as well as
// block-all-mixed-content not only apply to the toplevel document,
// but also to nested documents. The loadInfo of a subdocument

View File

@ -709,7 +709,7 @@ static bool IsInsideRuby(nsINode* aNode) {
static bool IsSelectionInsideRuby(Selection* aSelection) {
uint32_t rangeCount = aSelection->RangeCount();
for (auto i : IntegerRange(rangeCount)) {
nsRange* range = aSelection->GetRangeAt(i);
const nsRange* range = aSelection->GetRangeAt(i);
if (!IsInsideRuby(range->GetClosestCommonInclusiveAncestor())) {
return false;
}
@ -771,7 +771,7 @@ bool nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
// Retrieve the event target node from the start of the selection.
if (sel) {
nsRange* range = sel->GetRangeAt(0);
const nsRange* range = sel->GetRangeAt(0);
if (range) {
targetElement = GetElementOrNearestFlattenedTreeParentElement(
range->GetStartContainer());

View File

@ -245,7 +245,7 @@ class nsDocumentEncoder : public nsIDocumentEncoder {
nsINode* aFixupNode = nullptr);
// This serializes the content of aNode.
nsresult SerializeToStringIterative(nsINode* aNode);
nsresult SerializeRangeToString(nsRange* aRange);
nsresult SerializeRangeToString(const nsRange* aRange);
nsresult SerializeRangeNodes(const nsRange* aRange, nsINode* aNode,
int32_t aDepth);
nsresult SerializeRangeContextStart(const nsTArray<nsINode*>& aAncestorArray);
@ -428,7 +428,7 @@ nsresult nsDocumentEncoder::SerializeSelection() {
nsCOMPtr<nsINode> prevNode;
uint32_t firstRangeStartDepth = 0;
for (uint32_t i = 0; i < count; ++i) {
RefPtr<nsRange> range = selection->GetRangeAt(i);
RefPtr<const nsRange> range = selection->GetRangeAt(i);
// Bug 236546: newlines not added when copying table cells into clipboard
// Each selected cell shows up as a range containing a row with a single
@ -1031,7 +1031,7 @@ nsresult nsDocumentEncoder::SerializeRangeContextEnd() {
return rv;
}
nsresult nsDocumentEncoder::SerializeRangeToString(nsRange* aRange) {
nsresult nsDocumentEncoder::SerializeRangeToString(const nsRange* aRange) {
if (!aRange || aRange->Collapsed()) return NS_OK;
mClosestCommonInclusiveAncestorOfRange =

View File

@ -2838,7 +2838,7 @@ nsresult nsFocusManager::GetSelectionLocation(Document* aDocument,
uint32_t startOffset = 0;
if (domSelection) {
isCollapsed = domSelection->IsCollapsed();
RefPtr<nsRange> domRange = domSelection->GetRangeAt(0);
RefPtr<const nsRange> domRange = domSelection->GetRangeAt(0);
if (domRange) {
nsCOMPtr<nsINode> startNode = domRange->GetStartContainer();
nsCOMPtr<nsINode> endNode = domRange->GetEndContainer();

View File

@ -1561,10 +1561,7 @@ void nsGlobalWindowInner::InitDocumentDependentState(JSContext* aCx) {
// out of sync.
ClearDocumentDependentSlots(aCx);
// FIXME: Currently, devtools can crete a fallback webextension window global
// in the content process which does not have a corresponding BrowserChild
// actor. This means we have no actor to be our parent. (Bug 1498293)
if (!mWindowGlobalChild && (XRE_IsParentProcess() || mBrowserChild)) {
if (!mWindowGlobalChild) {
mWindowGlobalChild = WindowGlobalChild::Create(this);
}

View File

@ -2224,15 +2224,6 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
// in a fresh global object when shared memory objects aren't allowed
// (because COOP/COEP support isn't enabled, or because COOP/COEP don't
// act to isolate this page to a separate process).
//
// We set this value to |true| to replicate pre-existing behavior. In the
// future, bug 1624266 will assign the correct COOP/COEP-respecting value
// here. When that change is made, corresponding code for workers in
// WorkerPrivate.cpp must also be updated. (Ideally both paint and audio
// worklets -- bug 1630876 and bug 1630877 -- would be fixed at the same
// time, but fixing them has lower priorit because they're not shipping
// yet.)
bool aDefineSharedArrayBufferConstructor = true;
// Every script context we are initialized with must create a
// new global.
@ -2240,7 +2231,7 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
cx, newInnerWindow, aDocument->GetDocumentURI(),
aDocument->NodePrincipal(), &newInnerGlobal,
ComputeIsSecureContext(aDocument),
aDefineSharedArrayBufferConstructor);
newInnerWindow->IsSharedMemoryAllowed());
NS_ASSERTION(
NS_SUCCEEDED(rv) && newInnerGlobal &&
newInnerWindow->GetWrapperPreserveColor() == newInnerGlobal,

View File

@ -2488,7 +2488,7 @@ void nsRange::ToString(nsAString& aReturn, ErrorResult& aErr) {
void nsRange::Detach() {}
already_AddRefed<DocumentFragment> nsRange::CreateContextualFragment(
const nsAString& aFragment, ErrorResult& aRv) {
const nsAString& aFragment, ErrorResult& aRv) const {
if (!mIsPositioned) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;

View File

@ -206,7 +206,7 @@ class nsRange final : public mozilla::dom::AbstractRange,
const mozilla::dom::GlobalObject& global, mozilla::ErrorResult& aRv);
already_AddRefed<mozilla::dom::DocumentFragment> CreateContextualFragment(
const nsAString& aString, ErrorResult& aError);
const nsAString& aString, ErrorResult& aError) const;
already_AddRefed<mozilla::dom::DocumentFragment> CloneContents(
ErrorResult& aErr);
int16_t CompareBoundaryPoints(uint16_t aHow, nsRange& aOther,

View File

@ -225,3 +225,34 @@ TEST(PlainTextSerializer, Simple)
ASSERT_TRUE(test.EqualsLiteral("basespanbody"))
<< "Wrong html to text serialization";
}
TEST(PlainTextSerializer, OneHundredAndOneOL)
{
nsAutoString test;
test.AppendLiteral(
"<html>"
"<body>"
"<ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><"
"ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><"
"ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><"
"ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><"
"ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><"
"ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol><ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></ol></"
"ol></ol><li>X</li></ol>"
"</body>"
"</html>");
ConvertBufToPlainText(test, nsIDocumentEncoder::OutputFormatted,
kDefaultWrapColumn);
nsAutoString expected;
expected.AppendLiteral(" 1. X" NS_LINEBREAK);
ASSERT_EQ(test, expected);
}

View File

@ -271,7 +271,7 @@ nsresult ContentEventHandler::InitRootContent(Selection* aNormalSelection) {
return NS_OK;
}
RefPtr<nsRange> range(aNormalSelection->GetRangeAt(0));
RefPtr<const nsRange> range(aNormalSelection->GetRangeAt(0));
if (NS_WARN_IF(!range)) {
return NS_ERROR_UNEXPECTED;
}

View File

@ -5187,7 +5187,7 @@ nsresult EventStateManager::HandleMiddleClickPaste(
// The selection may have been modified during reflow. Therefore, we
// should adjust event target to pass IsAcceptableInputEvent().
nsRange* range = selection->GetRangeAt(0);
const nsRange* range = selection->GetRangeAt(0);
if (!range) {
return NS_OK;
}

View File

@ -267,7 +267,7 @@ bool IMEContentObserver::InitWithEditor(nsPresContext* aPresContext,
return false;
}
if (nsRange* selRange = mSelection->GetRangeAt(0)) {
if (const nsRange* selRange = mSelection->GetRangeAt(0)) {
if (NS_WARN_IF(!selRange->GetStartContainer())) {
return false;
}

View File

@ -680,7 +680,7 @@ RawRangeBoundary TextComposition::GetStartRef() const {
return RawRangeBoundary();
}
nsRange* firstRange = nullptr;
const nsRange* firstRange = nullptr;
static const SelectionType kIMESelectionTypes[] = {
SelectionType::eIMERawClause, SelectionType::eIMESelectedRawClause,
SelectionType::eIMEConvertedClause, SelectionType::eIMESelectedClause};
@ -691,7 +691,7 @@ RawRangeBoundary TextComposition::GetStartRef() const {
continue;
}
for (uint32_t i = 0; i < selection->RangeCount(); i++) {
nsRange* range = selection->GetRangeAt(i);
const nsRange* range = selection->GetRangeAt(i);
if (NS_WARN_IF(!range) || NS_WARN_IF(!range->GetStartContainer())) {
continue;
}
@ -737,7 +737,7 @@ RawRangeBoundary TextComposition::GetEndRef() const {
return RawRangeBoundary();
}
nsRange* lastRange = nullptr;
const nsRange* lastRange = nullptr;
static const SelectionType kIMESelectionTypes[] = {
SelectionType::eIMERawClause, SelectionType::eIMESelectedRawClause,
SelectionType::eIMEConvertedClause, SelectionType::eIMESelectedClause};
@ -748,7 +748,7 @@ RawRangeBoundary TextComposition::GetEndRef() const {
continue;
}
for (uint32_t i = 0; i < selection->RangeCount(); i++) {
nsRange* range = selection->GetRangeAt(i);
const nsRange* range = selection->GetRangeAt(i);
if (NS_WARN_IF(!range) || NS_WARN_IF(!range->GetEndContainer())) {
continue;
}

View File

@ -75,9 +75,10 @@ already_AddRefed<WindowGlobalChild> WindowGlobalChild::Create(
// Initalize our WindowGlobalChild object.
RefPtr<dom::BrowsingContext> bc = docshell->GetBrowsingContext();
// When creating a new window global child we also need to look at the
// channel's Cross-Origin-Opener-Policy and set it on the browsing context
// so it's available in the parent process.
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
// Opener policy is set when we start to load a document. Here, we ensure we
// have set the correct Opener policy so that it will be available in the
// parent process through window global child.
nsCOMPtr<nsIChannel> chan = aWindow->GetDocument()->GetChannel();
nsCOMPtr<nsILoadInfo> loadInfo = chan ? chan->LoadInfo() : nullptr;
nsCOMPtr<nsIHttpChannelInternal> httpChan = do_QueryInterface(chan);
@ -86,8 +87,9 @@ already_AddRefed<WindowGlobalChild> WindowGlobalChild::Create(
loadInfo->GetExternalContentPolicyType() ==
nsIContentPolicy::TYPE_DOCUMENT &&
NS_SUCCEEDED(httpChan->GetCrossOriginOpenerPolicy(&policy))) {
bc->SetOpenerPolicy(policy);
MOZ_DIAGNOSTIC_ASSERT(policy == bc->GetOpenerPolicy());
}
#endif
WindowGlobalInit init(principal,
aWindow->GetDocumentContentBlockingAllowListPrincipal(),

View File

@ -957,6 +957,12 @@ long AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
mBuffer.BufferFilled();
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
// Prevent returning NaN to the OS mixer, and propagating NaN into the reverse
// stream of the AEC.
NaNToZeroInPlace(aOutputBuffer, aFrames * mOutputChannelCount);
#endif
// Callback any observers for the AEC speaker data. Note that one
// (maybe) of these will be full-duplex, the others will get their input
// data off separate cubeb callbacks. Take care with how stuff is

View File

@ -364,6 +364,20 @@ float AudioBufferSumOfSquares(const float* aInput, uint32_t aLength) {
return sum;
}
void NaNToZeroInPlace(float* aSamples, size_t aCount) {
#ifdef USE_SSE2
if (mozilla::supports_sse2()) {
NaNToZeroInPlace_SSE(aSamples, aCount);
return;
}
#endif
for (size_t i = 0; i < aCount; i++) {
if (aSamples[i] != aSamples[i]) {
aSamples[i] = 0.0;
}
}
}
AudioNodeEngine::AudioNodeEngine(dom::AudioNode* aNode)
: mNode(aNode),
mNodeType(aNode ? aNode->NodeType() : nullptr),

View File

@ -239,6 +239,11 @@ void AudioBlockPanStereoToStereo(const float aInputL[WEBAUDIO_BLOCK_SIZE],
float aOutputL[WEBAUDIO_BLOCK_SIZE],
float aOutputR[WEBAUDIO_BLOCK_SIZE]);
/**
* Replace NaN by zeros in aSamples.
*/
void NaNToZeroInPlace(float* aSamples, size_t aCount);
/**
* Return the sum of squares of all of the samples in the input.
*/

View File

@ -310,4 +310,54 @@ float AudioBufferSumOfSquares_SSE(const float* aInput, uint32_t aLength) {
return out[0] + out[1] + out[2] + out[3];
}
void NaNToZeroInPlace_SSE(float* aSamples, size_t aCount) {
__m128 vin0, vin1, vin2, vin3;
__m128 vmask0, vmask1, vmask2, vmask3;
__m128 vout0, vout1, vout2, vout3;
float* samplesAligned16 = ALIGNED16(aSamples);
size_t leadingElementsScalar =
std::min(static_cast<size_t>(samplesAligned16 - aSamples), aCount);
size_t remainingElements = aCount - leadingElementsScalar;
size_t vectoredEnd = aCount - remainingElements % 16;
MOZ_ASSERT(!((vectoredEnd - leadingElementsScalar) % 16));
size_t i = 0;
for (; i < leadingElementsScalar; i++) {
if (aSamples[i] != aSamples[i]) {
aSamples[i] = 0.0;
}
}
ASSERT_ALIGNED16(&aSamples[i]);
for (; i < vectoredEnd; i += 16) {
vin0 = _mm_load_ps(&aSamples[i + 0]);
vin1 = _mm_load_ps(&aSamples[i + 4]);
vin2 = _mm_load_ps(&aSamples[i + 8]);
vin3 = _mm_load_ps(&aSamples[i + 12]);
vmask0 = _mm_cmpord_ps(vin0, vin0);
vmask1 = _mm_cmpord_ps(vin1, vin1);
vmask2 = _mm_cmpord_ps(vin2, vin2);
vmask3 = _mm_cmpord_ps(vin3, vin3);
vout0 = _mm_and_ps(vin0, vmask0);
vout1 = _mm_and_ps(vin1, vmask1);
vout2 = _mm_and_ps(vin2, vmask2);
vout3 = _mm_and_ps(vin3, vmask3);
_mm_store_ps(&aSamples[i + 0], vout0);
_mm_store_ps(&aSamples[i + 4], vout1);
_mm_store_ps(&aSamples[i + 8], vout2);
_mm_store_ps(&aSamples[i + 12], vout3);
}
for (; i < aCount; i++) {
if (aSamples[i] != aSamples[i]) {
aSamples[i] = 0.0;
}
}
}
} // namespace mozilla

View File

@ -30,4 +30,6 @@ float AudioBufferSumOfSquares_SSE(const float* aInput, uint32_t aLength);
void BufferComplexMultiply_SSE(const float* aInput, const float* aScale,
float* aOutput, uint32_t aSize);
void NaNToZeroInPlace_SSE(float* aSamples, size_t aCount);
} // namespace mozilla

View File

@ -45,12 +45,9 @@ bool AudioWorkletGlobalScope::WrapGlobalObject(
// The SharedArrayBuffer global constructor property should not be present in
// a fresh global object when shared memory objects aren't allowed (because
// COOP/COEP support isn't enabled, or because COOP/COEP don't act to isolate
// this worklet to a separate process). However, it's not presently clear how
// to do this, so for now assign a backwards-compatible value. Bug 1630877
// will fix this.
bool defineSharedArrayBufferConstructor = true;
// this worklet to a separate process).
options.creationOptions().setDefineSharedArrayBufferConstructor(
defineSharedArrayBufferConstructor);
IsSharedMemoryAllowed());
JS::AutoHoldPrincipals principals(aCx, new WorkletPrincipals(mImpl));
return AudioWorkletGlobalScope_Binding::Wrap(

View File

@ -59,7 +59,11 @@ var ecmaGlobals = [
"Reflect",
"RegExp",
"Set",
{ name: "SharedArrayBuffer", earlyBetaOrEarlier: true },
{
name: "SharedArrayBuffer",
earlyBetaOrEarlier: true,
crossOriginIsolated: true,
},
"String",
"Symbol",
"SyntaxError",
@ -269,6 +273,7 @@ function createInterfaceMap({
isAndroid,
isInsecureContext,
isFennec,
isCrossOriginIsolated,
}) {
var interfaceMap = {};
@ -291,6 +296,7 @@ function createInterfaceMap({
entry.fennec === !isFennec ||
entry.release === !isRelease ||
entry.earlyBetaOrEarlier === !isEarlyBetaOrEarlier ||
entry.crossOriginIsolated === !isCrossOriginIsolated ||
entry.disabled
) {
interfaceMap[entry.name] = false;

View File

@ -45,6 +45,7 @@ const isFennec =
SpecialPowers.Cc["@mozilla.org/android/bridge;1"].getService(
SpecialPowers.Ci.nsIAndroidBridge
).isFennec;
const isCrossOriginIsolated = window.crossOriginIsolated;
// IMPORTANT: Do not change this list without review from
// a JavaScript Engine peer!
@ -90,6 +91,7 @@ var ecmaGlobals = [
name: "SharedArrayBuffer",
insecureContext: true,
earlyBetaOrEarlier: true,
crossOriginIsolated: true,
},
{ name: "String", insecureContext: true },
{ name: "Symbol", insecureContext: true },
@ -1447,6 +1449,7 @@ function createInterfaceMap() {
// only in secure contexts.
(isInsecureContext && !entry.insecureContext) ||
entry.earlyBetaOrEarlier === !isEarlyBetaOrEarlier ||
entry.crossOriginIsolated === !isCrossOriginIsolated ||
entry.disabled
) {
interfaceMap[entry.name] = false;

View File

@ -2234,12 +2234,7 @@ WorkerPrivate::WorkerPrivate(
// in a fresh global object when shared memory objects aren't allowed
// (because COOP/COEP support isn't enabled, or because COOP/COEP don't
// act to isolate this worker to a separate process).
//
// Normal pages haven't yet been made to respect COOP/COEP in this regard
// yet -- they just always add the property. This should be changed to
// |IsSharedMemoryAllowed()| when bug 1624266 fixes this for normal pages.
bool defineSharedArrayBufferConstructor = true;
const bool defineSharedArrayBufferConstructor = IsSharedMemoryAllowed();
chromeCreationOptions.setDefineSharedArrayBufferConstructor(
defineSharedArrayBufferConstructor);
contentCreationOptions.setDefineSharedArrayBufferConstructor(

View File

@ -71,6 +71,7 @@ var ecmaGlobals = [
name: "SharedArrayBuffer",
insecureContext: true,
earlyBetaOrEarlier: true,
crossOringinIsolated: true,
},
{ name: "String", insecureContext: true },
{ name: "Symbol", insecureContext: true },
@ -300,6 +301,7 @@ function createInterfaceMap({
isAndroid,
isInsecureContext,
isFennec,
isCrossOringinIsolated,
}) {
var interfaceMap = {};
@ -324,6 +326,7 @@ function createInterfaceMap({
// only in secure contexts.
(isInsecureContext && !entry.insecureContext) ||
entry.earlyBetaOrEarlier === !isEarlyBetaOrEarlier ||
entry.crossOringinIsolated === !isCrossOringinIsolated ||
entry.disabled
) {
interfaceMap[entry.name] = false;

View File

@ -53,6 +53,7 @@ function workerTestExec(script) {
SpecialPowers.Cc["@mozilla.org/android/bridge;1"].getService(
SpecialPowers.Ci.nsIAndroidBridge
).isFennec;
const isCrossOriginIsolated = window.crossOriginIsolated;
const result = {
isNightly,
@ -65,6 +66,7 @@ function workerTestExec(script) {
isLinux,
isInsecureContext,
isFennec,
isCrossOriginIsolated,
};
worker.postMessage({

View File

@ -25,7 +25,7 @@ namespace mozilla {
using namespace dom;
DeleteRangeTransaction::DeleteRangeTransaction(EditorBase& aEditorBase,
nsRange& aRangeToDelete)
const nsRange& aRangeToDelete)
: mEditorBase(&aEditorBase), mRangeToDelete(aRangeToDelete.CloneRange()) {}
NS_IMPL_CYCLE_COLLECTION_INHERITED(DeleteRangeTransaction,

View File

@ -27,7 +27,8 @@ class RangeUpdater;
*/
class DeleteRangeTransaction final : public EditAggregateTransaction {
protected:
DeleteRangeTransaction(EditorBase& aEditorBase, nsRange& aRangeToDelete);
DeleteRangeTransaction(EditorBase& aEditorBase,
const nsRange& aRangeToDelete);
public:
/**
@ -37,7 +38,7 @@ class DeleteRangeTransaction final : public EditAggregateTransaction {
* @param aRangeToDelete The range to delete.
*/
static already_AddRefed<DeleteRangeTransaction> Create(
EditorBase& aEditorBase, nsRange& aRangeToDelete) {
EditorBase& aEditorBase, const nsRange& aRangeToDelete) {
RefPtr<DeleteRangeTransaction> transaction =
new DeleteRangeTransaction(aEditorBase, aRangeToDelete);
return transaction.forget();

View File

@ -3474,7 +3474,7 @@ EditorBase::CreateTransactionForDeleteSelection(
EditAggregateTransaction::Create();
for (uint32_t rangeIdx = 0; rangeIdx < SelectionRefPtr()->RangeCount();
++rangeIdx) {
nsRange* range = SelectionRefPtr()->GetRangeAt(rangeIdx);
const nsRange* range = SelectionRefPtr()->GetRangeAt(rangeIdx);
if (NS_WARN_IF(!range)) {
return nullptr;
}
@ -3521,7 +3521,7 @@ EditorBase::CreateTransactionForDeleteSelection(
// are not implemented
already_AddRefed<EditTransactionBase>
EditorBase::CreateTransactionForCollapsedRange(
nsRange& aCollapsedRange,
const nsRange& aCollapsedRange,
HowToHandleCollapsedRange aHowToHandleCollapsedRange) {
MOZ_ASSERT(aCollapsedRange.Collapsed());
MOZ_ASSERT(
@ -4525,7 +4525,7 @@ nsresult EditorBase::InitializeSelection(nsINode& aFocusEventTargetNode) {
if (mComposition && mComposition->IsMovingToNewTextNode()) {
// We need to look for the new text node from current selection.
// XXX If selection is changed during reframe, this doesn't work well!
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -5195,7 +5195,7 @@ bool EditorBase::IsSelectionRangeContainerNotContent() const {
MOZ_ASSERT(IsEditActionDataAvailable());
for (uint32_t i = 0; i < SelectionRefPtr()->RangeCount(); i++) {
nsRange* range = SelectionRefPtr()->GetRangeAt(i);
const nsRange* range = SelectionRefPtr()->GetRangeAt(i);
MOZ_ASSERT(range);
if (!range || !range->GetStartContainer() ||
!range->GetStartContainer()->IsContent() || !range->GetEndContainer() ||
@ -5580,7 +5580,7 @@ nsresult EditorBase::AutoEditActionDataSetter::MaybeDispatchBeforeInputEvent() {
if (uint32_t rangeCount = textEditor->SelectionRefPtr()->RangeCount()) {
mTargetRanges.SetCapacity(rangeCount);
for (uint32_t i = 0; i < rangeCount; i++) {
nsRange* range = textEditor->SelectionRefPtr()->GetRangeAt(i);
const nsRange* range = textEditor->SelectionRefPtr()->GetRangeAt(i);
if (NS_WARN_IF(!range) || NS_WARN_IF(!range->IsPositioned())) {
continue;
}

View File

@ -2258,7 +2258,7 @@ class EditorBase : public nsIEditor,
* DeleteTextTransaction.
*/
already_AddRefed<EditTransactionBase> CreateTransactionForCollapsedRange(
nsRange& aCollapsedRange,
const nsRange& aCollapsedRange,
HowToHandleCollapsedRange aHowToHandleCollapsedRange);
private:

View File

@ -1031,7 +1031,7 @@ bool EditorEventListener::CanInsertAtDropPosition(DragEvent* aDragEvent) {
uint32_t rangeCount = selection->RangeCount();
IgnoredErrorResult ignoredError;
for (uint32_t i = 0; i < rangeCount; i++) {
RefPtr<nsRange> range = selection->GetRangeAt(i);
RefPtr<const nsRange> range = selection->GetRangeAt(i);
if (!range) {
// Don't bail yet, iterate through them all
continue;

View File

@ -268,7 +268,7 @@ void HTMLEditor::OnStartToHandleTopLevelEditSubAction(
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
if (nsRange* range = SelectionRefPtr()->GetRangeAt(0)) {
if (const nsRange* range = SelectionRefPtr()->GetRangeAt(0)) {
TopLevelEditSubActionDataRef().mSelectedRange->StoreRange(*range);
}
}
@ -692,7 +692,7 @@ EditActionResult HTMLEditor::CanHandleHTMLEditSubAction() const {
return EditActionCanceled();
}
nsRange* range = SelectionRefPtr()->GetRangeAt(0);
const nsRange* range = SelectionRefPtr()->GetRangeAt(0);
nsINode* selStartNode = range->GetStartContainer();
if (NS_WARN_IF(!selStartNode)) {
return EditActionResult(NS_ERROR_FAILURE);
@ -892,7 +892,7 @@ AlignStateAtSelection::AlignStateAtSelection(HTMLEditor& aHTMLEditor,
OwningNonNull<Element> bodyOrDocumentElement = *aHTMLEditor.GetRoot();
EditorRawDOMPoint atBodyOrDocumentElement(bodyOrDocumentElement);
nsRange* firstRange = aHTMLEditor.SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = aHTMLEditor.SelectionRefPtr()->GetRangeAt(0);
mFoundSelectionRanges = !!firstRange;
if (!mFoundSelectionRanges) {
NS_WARNING("There was no selection range");
@ -1292,7 +1292,7 @@ nsresult HTMLEditor::EnsureCaretNotAfterPaddingBRElement() {
// If we are after a padding `<br>` element for empty last line in the same
// block, then move selection to be before it
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -1429,7 +1429,7 @@ EditActionResult HTMLEditor::HandleInsertText(
return EditActionHandled(NS_ERROR_FAILURE);
}
RefPtr<nsRange> firstRange = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionHandled(NS_ERROR_FAILURE);
}
@ -1807,7 +1807,7 @@ EditActionResult HTMLEditor::InsertParagraphSeparatorAsSubAction() {
}
// Smart splitting rules
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionIgnored(NS_ERROR_FAILURE);
}
@ -2663,7 +2663,7 @@ EditActionResult HTMLEditor::HandleDeleteCollapsedSelectionAtTextNode(
}
}
} else {
RefPtr<nsRange> range = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> range = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!range) ||
NS_WARN_IF(range->GetStartContainer() !=
aPointToDelete.GetContainer()) ||
@ -3147,7 +3147,7 @@ EditActionResult HTMLEditor::HandleDeleteNonCollapsedSelection(
// Else we have a non-collapsed selection. First adjust the selection.
// XXX Why do we extend selection only when there is only one range?
if (SelectionRefPtr()->RangeCount() == 1) {
if (nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0)) {
if (const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0)) {
RefPtr<StaticRange> extendedRange =
GetRangeExtendedToIncludeInvisibleNodes(*firstRange);
if (!extendedRange) {
@ -3173,7 +3173,7 @@ EditActionResult HTMLEditor::HandleDeleteNonCollapsedSelection(
// Remember that we did a ranged delete for the benefit of AfterEditInner().
TopLevelEditSubActionDataRef().mDidDeleteNonCollapsedRange = true;
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionResult(NS_ERROR_FAILURE);
}
@ -4677,7 +4677,7 @@ EditActionResult HTMLEditor::ChangeSelectedHardLinesToList(
}
}
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionResult(NS_ERROR_FAILURE);
}
@ -5220,7 +5220,7 @@ nsresult HTMLEditor::FormatBlockContainerWithTransaction(nsAtom& blockType) {
// empty block.
// XXX Isn't this odd if there are only non-editable visible nodes?
if (IsEmptyOneHardLine(arrayOfContents)) {
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -5383,7 +5383,7 @@ nsresult HTMLEditor::MaybeInsertPaddingBRElementForEmptyLastLineAtSelection() {
return NS_OK;
}
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -5658,7 +5658,7 @@ nsresult HTMLEditor::HandleCSSIndentAtSelectionInternal() {
// XXX Isn't this odd if there are only non-editable visible nodes?
if (IsEmptyOneHardLine(arrayOfContents)) {
// get selection location
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -5875,7 +5875,7 @@ nsresult HTMLEditor::HandleHTMLIndentAtSelectionInternal() {
// empty block.
// XXX Isn't this odd if there are only non-editable visible nodes?
if (IsEmptyOneHardLine(arrayOfContents)) {
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -6161,7 +6161,7 @@ EditActionResult HTMLEditor::HandleOutdentAtSelection() {
// Push selection past end of left element of last split indented element.
if (outdentResult.GetLeftContent()) {
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionHandled();
}
@ -6190,7 +6190,7 @@ EditActionResult HTMLEditor::HandleOutdentAtSelection() {
// And pull selection before beginning of right element of last split
// indented element.
if (outdentResult.GetRightContent()) {
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionHandled();
}
@ -6727,7 +6727,8 @@ CreateElementResult HTMLEditor::ChangeListElementType(Element& aListElement,
return CreateElementResult(std::move(listElement));
}
nsresult HTMLEditor::CreateStyleForInsertText(AbstractRange& aAbstractRange) {
nsresult HTMLEditor::CreateStyleForInsertText(
const AbstractRange& aAbstractRange) {
MOZ_ASSERT(IsEditActionDataAvailable());
MOZ_ASSERT(aAbstractRange.IsPositioned());
MOZ_ASSERT(mTypeInState);
@ -7004,7 +7005,7 @@ nsresult HTMLEditor::AlignContentsAtSelection(const nsAString& aAlignType) {
// node because of the fact that arrayOfContents can be empty? We
// should probably revisit this issue. - kin
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -7045,7 +7046,7 @@ EditActionResult HTMLEditor::AlignContentsAtSelectionWithEmptyDivElement(
MOZ_ASSERT(IsTopLevelEditSubActionDataAvailable());
MOZ_ASSERT(!IsSelectionRangeContainerNotContent());
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionResult(NS_ERROR_FAILURE);
}
@ -7753,7 +7754,7 @@ nsresult HTMLEditor::MaybeExtendSelectionToHardLineEdgesForBlockEditAction() {
return NS_OK;
}
RefPtr<nsRange> range = SelectionRefPtr()->GetRangeAt(0);
const RefPtr<nsRange> range = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!range)) {
return NS_ERROR_FAILURE;
}
@ -8082,7 +8083,7 @@ void HTMLEditor::GetSelectionRangesExtendedToIncludeAdjuscentWhiteSpaces(
aOutArrayOfRanges.SetCapacity(SelectionRefPtr()->RangeCount());
for (uint32_t i = 0; i < SelectionRefPtr()->RangeCount(); i++) {
nsRange* selectionRange = SelectionRefPtr()->GetRangeAt(i);
const nsRange* selectionRange = SelectionRefPtr()->GetRangeAt(i);
MOZ_ASSERT(selectionRange);
RefPtr<nsRange> extendedRange =
@ -10354,7 +10355,7 @@ void HTMLEditor::SetSelectionInterlinePosition() {
MOZ_ASSERT(SelectionRefPtr()->IsCollapsed());
// Get the (collapsed) selection location
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return;
}
@ -10807,7 +10808,7 @@ bool HTMLEditor::StartOrEndOfSelectionRangesIsIn(nsIContent& aContent) const {
MOZ_ASSERT(IsEditActionDataAvailable());
for (uint32_t i = 0; i < SelectionRefPtr()->RangeCount(); ++i) {
nsRange* range = SelectionRefPtr()->GetRangeAt(i);
const nsRange* range = SelectionRefPtr()->GetRangeAt(i);
nsINode* startContainer = range->GetStartContainer();
if (startContainer) {
if (&aContent == startContainer) {
@ -11568,7 +11569,7 @@ nsresult HTMLEditor::MoveSelectedContentsToDivElementToMakeItAbsolutePosition(
// empty block.
// XXX Isn't this odd if there are only non-editable visible nodes?
if (IsEmptyOneHardLine(arrayOfContents)) {
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}

View File

@ -486,7 +486,7 @@ void HTMLEditor::InitializeSelectionAncestorLimit(nsIContent& aAncestorLimit) {
if (SelectionRefPtr()->RangeCount() == 1 &&
SelectionRefPtr()->IsCollapsed()) {
Element* editingHost = GetActiveEditingHost();
nsRange* range = SelectionRefPtr()->GetRangeAt(0);
const nsRange* range = SelectionRefPtr()->GetRangeAt(0);
if (range->GetStartContainer() == editingHost && !range->StartOffset()) {
// JS or user operation has already collapsed selection at start of
// the editing host. So, we don't need to try to change selection
@ -526,7 +526,7 @@ nsresult HTMLEditor::MaybeCollapseSelectionAtFirstEditableNode(
// start of the editing host, we shouldn't reset selection. E.g., window
// is activated when the editor had focus before inactivated.
if (aIgnoreIfSelectionInEditingHost && SelectionRefPtr()->RangeCount() == 1) {
nsRange* range = SelectionRefPtr()->GetRangeAt(0);
const nsRange* range = SelectionRefPtr()->GetRangeAt(0);
if (!range->Collapsed() ||
range->GetStartContainer() != editingHost.get() ||
range->StartOffset()) {
@ -1225,7 +1225,7 @@ nsresult HTMLEditor::ReplaceHeadContentsWithSourceWithTransaction(
AutoPlaceholderBatch treatAsOneTransaction(*this);
// Get the first range in the selection, for context:
RefPtr<nsRange> range = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> range = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!range)) {
return NS_ERROR_FAILURE;
}
@ -1472,7 +1472,7 @@ NS_IMETHODIMP HTMLEditor::RebuildDocumentFromSource(
bodyTag.AssignLiteral("<div ");
bodyTag.Append(Substring(endbody, endclosebody));
RefPtr<nsRange> range = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> range = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!range)) {
return NS_ERROR_FAILURE;
}
@ -2014,7 +2014,7 @@ nsresult HTMLEditor::GetCSSBackgroundColorState(bool* aMixed,
// the default background color is transparent
aOutColor.AssignLiteral("transparent");
RefPtr<nsRange> firstRange = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return NS_ERROR_FAILURE;
}
@ -4214,7 +4214,7 @@ void HTMLEditor::DoSplitNode(const EditorDOMPoint& aStartOfRightNode,
}
for (uint32_t j = 0; j < range.mSelection->RangeCount(); ++j) {
RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
RefPtr<const nsRange> r = range.mSelection->GetRangeAt(j);
MOZ_ASSERT(r->IsPositioned());
// XXX Looks like that SavedRange should have mStart and mEnd which
// are RangeBoundary. Then, we can avoid to compute offset here.
@ -4501,7 +4501,7 @@ nsresult HTMLEditor::DoJoinNodes(nsIContent& aContentToKeep,
}
for (uint32_t j = 0; j < range.mSelection->RangeCount(); ++j) {
RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
const RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
MOZ_ASSERT(r->IsPositioned());
range.mStartContainer = r->GetStartContainer();
range.mStartOffset = r->StartOffset();
@ -5660,7 +5660,7 @@ Element* HTMLEditor::GetSelectionContainerElement() const {
MOZ_ASSERT(rangeCount, "If 0, Selection::IsCollapsed() should return true");
if (rangeCount == 1) {
nsRange* range = SelectionRefPtr()->GetRangeAt(0);
const nsRange* range = SelectionRefPtr()->GetRangeAt(0);
const RangeBoundary& startRef = range->StartRef();
const RangeBoundary& endRef = range->EndRef();
@ -5687,7 +5687,7 @@ Element* HTMLEditor::GetSelectionContainerElement() const {
}
} else {
for (uint32_t i = 0; i < rangeCount; i++) {
nsRange* range = SelectionRefPtr()->GetRangeAt(i);
const nsRange* range = SelectionRefPtr()->GetRangeAt(i);
nsINode* startContainer = range->GetStartContainer();
if (!focusNode) {
focusNode = startContainer;

View File

@ -1281,7 +1281,7 @@ class HTMLEditor final : public TextEditor,
* should be inserted.
*/
[[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult
CreateStyleForInsertText(dom::AbstractRange& aAbstractRange);
CreateStyleForInsertText(const dom::AbstractRange& aAbstractRange);
/**
* GetMostAncestorMailCiteElement() returns most-ancestor mail cite element.

View File

@ -131,7 +131,7 @@ nsresult HTMLEditor::LoadHTML(const nsAString& aInputString) {
}
// Get the first range in the selection, for context:
RefPtr<nsRange> range = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> range = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!range)) {
return NS_ERROR_FAILURE;
}

View File

@ -319,7 +319,7 @@ nsresult HTMLEditorEventListener::MouseDown(MouseEvent* aMouseEvent) {
uint32_t rangeCount = selection->RangeCount();
for (uint32_t i = 0; i < rangeCount; i++) {
RefPtr<nsRange> range = selection->GetRangeAt(i);
RefPtr<const nsRange> range = selection->GetRangeAt(i);
if (!range) {
// Don't bail yet, iterate through them all
continue;

View File

@ -2101,7 +2101,7 @@ nsresult HTMLEditor::RelativeFontChange(FontSize aDir) {
if (NS_WARN_IF(!SelectionRefPtr()->RangeCount())) {
return NS_OK;
}
RefPtr<nsRange> firstRange = SelectionRefPtr()->GetRangeAt(0);
RefPtr<const nsRange> firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange) ||
NS_WARN_IF(!firstRange->GetStartContainer())) {
return NS_OK;

View File

@ -3922,7 +3922,7 @@ already_AddRefed<Element> HTMLEditor::GetFirstSelectedTableCellElement(
MOZ_ASSERT(!aRv.Failed());
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
// XXX Why don't we treat "not found" in this case?
aRv.Throw(NS_ERROR_FAILURE);
@ -4001,7 +4001,7 @@ already_AddRefed<Element> HTMLEditor::GetNextSelectedTableCellElement(
MOZ_ASSERT(mSelectedCellIndex > 0);
for (; mSelectedCellIndex < SelectionRefPtr()->RangeCount();
mSelectedCellIndex++) {
nsRange* range = SelectionRefPtr()->GetRangeAt(mSelectedCellIndex);
const nsRange* range = SelectionRefPtr()->GetRangeAt(mSelectedCellIndex);
if (NS_WARN_IF(!range)) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;

View File

@ -57,7 +57,7 @@ void SelectionState::SaveSelection(Selection& aSelection) {
// now store the selection ranges
for (int32_t i = 0; i < rangeCount; i++) {
nsRange* range = aSelection.GetRangeAt(i);
const nsRange* range = aSelection.GetRangeAt(i);
if (NS_WARN_IF(!range)) {
continue;
}
@ -559,7 +559,7 @@ NS_IMPL_CYCLE_COLLECTION(RangeItem, mStartContainer, mEndContainer)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(RangeItem, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(RangeItem, Release)
void RangeItem::StoreRange(nsRange& aRange) {
void RangeItem::StoreRange(const nsRange& aRange) {
mStartContainer = aRange.GetStartContainer();
mStartOffset = aRange.StartOffset();
mEndContainer = aRange.GetEndContainer();

View File

@ -35,7 +35,7 @@ struct RangeItem final {
~RangeItem() = default;
public:
void StoreRange(nsRange& aRange);
void StoreRange(const nsRange& aRange);
void StoreRange(const EditorRawDOMPoint& aStartPoint,
const EditorRawDOMPoint& aEndPoint) {
MOZ_ASSERT(aStartPoint.IsSet());

View File

@ -226,7 +226,7 @@ EditActionResult TextEditor::InsertLineFeedCharacterAtSelection() {
}
// get the (collapsed) selection location
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionIgnored(NS_ERROR_FAILURE);
}
@ -523,7 +523,7 @@ EditActionResult TextEditor::HandleInsertText(
}
// get the (collapsed) selection location
nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
const nsRange* firstRange = SelectionRefPtr()->GetRangeAt(0);
if (NS_WARN_IF(!firstRange)) {
return EditActionHandled(NS_ERROR_FAILURE);
}

View File

@ -257,7 +257,7 @@ nsresult TextEditor::OnDrop(DragEvent* aDropEvent) {
sourceNode->IsEditable() && srcdoc == document) {
uint32_t rangeCount = SelectionRefPtr()->RangeCount();
for (uint32_t j = 0; j < rangeCount; j++) {
nsRange* range = SelectionRefPtr()->GetRangeAt(j);
const nsRange* range = SelectionRefPtr()->GetRangeAt(j);
if (NS_WARN_IF(!range)) {
// don't bail yet, iterate through them all
continue;

View File

@ -363,7 +363,7 @@ EditorSpellCheck::InitSpellChecker(nsIEditor* aEditor,
}
if (selection->RangeCount()) {
RefPtr<nsRange> range = selection->GetRangeAt(0);
RefPtr<const nsRange> range = selection->GetRangeAt(0);
NS_ENSURE_STATE(range);
if (!range->Collapsed()) {

View File

@ -401,7 +401,7 @@ nsresult TextServicesDocument::LastSelectedBlock(
return NS_ERROR_FAILURE;
}
RefPtr<nsRange> range;
RefPtr<const nsRange> range;
nsCOMPtr<nsINode> parent;
if (selection->IsCollapsed()) {
@ -1876,7 +1876,7 @@ nsresult TextServicesDocument::GetCollapsedSelection(
int32_t eStartOffset = eStart->mNodeOffset;
int32_t eEndOffset = eEnd->mNodeOffset + eEnd->mLength;
RefPtr<nsRange> range = selection->GetRangeAt(0);
RefPtr<const nsRange> range = selection->GetRangeAt(0);
NS_ENSURE_STATE(range);
nsCOMPtr<nsINode> parent = range->GetStartContainer();
@ -2044,7 +2044,7 @@ nsresult TextServicesDocument::GetCollapsedSelection(
nsresult TextServicesDocument::GetUncollapsedSelection(
BlockSelectionStatus* aSelStatus, int32_t* aSelOffset,
int32_t* aSelLength) {
RefPtr<nsRange> range;
RefPtr<const nsRange> range;
OffsetEntry* entry;
RefPtr<Selection> selection =

View File

@ -769,7 +769,10 @@ static bool FoldAndOrCoalesce(JSContext* cx, ParseNode** nodePtr) {
// its element.
if (node->count() == 1) {
ParseNode* first = node->head();
ReplaceNode(nodePtr, first);
if (!TryReplaceNode(nodePtr, first)) {
;
return false;
}
}
return true;

View File

@ -459,6 +459,239 @@ skip script test262/built-ins/FinalizationRegistry/prototype/cleanupSome/cleanup
skip script test262/built-ins/FinalizationRegistry/prototype/cleanupSome/reentrancy.js
skip script test262/built-ins/FinalizationRegistry/prototype/unregister/unregister-cleaned-up-cell.js
# Depends upon the SharedArrayBuffer constructor being defined as a global
# property -- and right now, it's only defined for cross-site-isolated pages
# that request it using COOP/COEP.
fails-if(!xulRuntime.shell) script test262/built-ins/ArrayBuffer/prototype/byteLength/this-is-sharedarraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/ArrayBuffer/prototype/slice/this-is-sharedarraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/add/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/and/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/validate-arraytype-before-expectedValue-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/validate-arraytype-before-replacementValue-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/compareExchange/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/exchange/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/load/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/or/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/expected-return-value-negative-zero.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/store/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/sub/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/bigint/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/bigint/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/validate-arraytype-before-index-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/validate-arraytype-before-value-coercion.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/bad-range.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/expected-return-value.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/good-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/Atomics/xor/non-views.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/buffer-does-not-have-arraybuffer-data-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/buffer-reference-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/byteoffset-is-negative-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/custom-proto-access-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/custom-proto-if-not-object-fallbacks-to-default-prototype-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/custom-proto-if-object-is-used-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/defined-bytelength-and-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/defined-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/defined-byteoffset-undefined-bytelength-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/excessive-bytelength-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/excessive-byteoffset-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/instance-extensibility-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/negative-bytelength-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/negative-byteoffset-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/newtarget-undefined-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/buffer/return-buffer-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/buffer/this-has-no-dataview-internal-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/byteLength/return-bytelength-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/byteLength/this-has-no-dataview-internal-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/byteOffset/return-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/byteOffset/this-has-no-dataview-internal-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/index-is-out-of-range-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/negative-byteoffset-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/return-abrupt-from-tonumber-byteoffset-symbol-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/return-value-clean-arraybuffer-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/return-values-custom-offset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/return-values-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/this-has-no-dataview-internal-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/to-boolean-littleendian-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/prototype/getInt32/toindex-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/proto-from-ctor-realm-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/return-abrupt-tonumber-bytelength-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/return-abrupt-tonumber-bytelength-symbol-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/return-abrupt-tonumber-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/return-abrupt-tonumber-byteoffset-symbol-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/return-instance-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/toindex-bytelength-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/DataView/toindex-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/invoked-as-accessor.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/invoked-as-func.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/name.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/prop-desc.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/return-bytelength.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/this-has-no-typedarrayname-internal.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/this-is-arraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/byteLength/this-is-not-object.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-arraybuffer-object.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/context-is-not-object.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/descriptor.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-absent.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/end-default-if-undefined.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/end-exceeds-length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/extensible.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/name.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/negative-end.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/negative-start.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/nonconstructor.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/number-conversion.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-not-object.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-constructor-is-undefined.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-constructor.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-not-object.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-null.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-is-undefined.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-larger-arraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-not-arraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-same-arraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species-returns-smaller-arraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/species.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-absent.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/start-default-if-undefined.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-end.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/start-exceeds-length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/this-is-arraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-end.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/slice/tointeger-conversion-start.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/Symbol.toStringTag.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype/constructor.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/allocation-limit.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/data-allocation-after-object-creation.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/init-zero.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/length-is-absent.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/length-is-too-large-throws.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/negative-length-throws.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/newtarget-prototype-is-not-object.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/proto-from-ctor-realm.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/prototype-from-newtarget.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/return-abrupt-from-length-symbol.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/return-abrupt-from-length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/toindex-length.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/undefined-newtarget-throws.js
fails-if(!xulRuntime.shell) script test262/built-ins/SharedArrayBuffer/zero-length.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/excessive-length-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/excessive-offset-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/invoked-with-undefined-newtarget-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/is-referenced-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/length-access-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/length-is-symbol-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/new-instance-extensibility-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/proto-from-ctor-realm-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/returns-new-instance-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/toindex-bytelength-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/toindex-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/typedarray-backed-by-sharedarraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/use-custom-proto-if-object-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-negative-zero-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-is-symbol-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/byteoffset-to-number-throws-sab.j
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/custom-proto-access-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-and-offset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-length-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-negative-length-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/defined-offset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-length-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/excessive-offset-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/invoked-with-undefined-newtarget-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/is-referenced-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-access-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/length-is-symbol-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/new-instance-extensibility-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/proto-from-ctor-realm-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/returns-new-instance-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-bytelength-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/toindex-byteoffset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-custom-proto-if-object-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/use-default-proto-if-custom-proto-is-not-object-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/bufferbyteoffset-throws-from-modulo-element-size-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-is-negative-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-is-negative-zero-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-is-symbol-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-throws-from-modulo-element-size-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-to-number-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/custom-proto-access-throws-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/defined-length-and-offset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/defined-length-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/defined-negative-length-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/ctors/buffer-arg/defined-offset-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/internals/Get/BigInt/indexed-value-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArrayConstructors/internals/Get/indexed-value-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-other-type-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-diff-buffer-same-type-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/BigInt/typedarray-arg-set-values-same-buffer-same-type-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-conversions-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-other-type-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-diff-buffer-same-type-sab.js
fails-if(!xulRuntime.shell) script test262/built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-same-type-sab.js
###########################################################
# Tests disabled due to issues in test262 importer script #

View File

@ -190,6 +190,26 @@ shouldThrowReferenceError('`${G}`?.r');
// NOT an optional chain
shouldBe(false?.4:5, 5);
// Special case: binary operators that follow a binary expression
shouldThrowReferenceError('(0 || 1 << x)?.$');
shouldThrowReferenceError('(0 || 1 >> x)?.$');
shouldThrowReferenceError('(0 || 1 >>> x)?.$');
shouldThrowReferenceError('(0 || 1 + x)?.$');
shouldThrowReferenceError('(0 || 1 - x)?.$');
shouldThrowReferenceError('(0 || 1 % x)?.$');
shouldThrowReferenceError('(0 || 1 / x)?.$');
shouldThrowReferenceError('(0 || 1 == x)?.$');
shouldThrowReferenceError('(0 || 1 != x)?.$');
shouldThrowReferenceError('(0 || 1 !== x)?.$');
shouldThrowReferenceError('(0 || 1 === x)?.$');
shouldThrowReferenceError('(0 || 1 <= x)?.$');
shouldThrowReferenceError('(0 || 1 >= x)?.$');
shouldThrowReferenceError('(0 || 1 ** x)?.$');
shouldThrowReferenceError('(0 || 1 | x)?.$');
shouldThrowReferenceError('(0 || 1 & x)?.$');
shouldThrowReferenceError('(0 || 1 instanceof x)?.$');
shouldThrowReferenceError('(0 || "foo" in x)?.$');
function testSideEffectCountFunction() {
let count = 0;
let a = {

View File

@ -1043,7 +1043,7 @@ nsIFrame* AccessibleCaretManager::GetFrameForFirstRangeStartOrLastRangeEnd(
MOZ_ASSERT(GetCaretMode() == CaretMode::Selection);
MOZ_ASSERT(aOutOffset, "aOutOffset shouldn't be nullptr!");
nsRange* range = nullptr;
const nsRange* range = nullptr;
RefPtr<nsINode> startNode;
RefPtr<nsINode> endNode;
int32_t nodeOffset = 0;

View File

@ -2048,7 +2048,7 @@ nsFrameSelection::CreateRangeExtendedToSomewhere(
if (!selection || selection->RangeCount() != 1) {
return Err(NS_ERROR_FAILURE);
}
RefPtr<nsRange> firstRange = selection->GetRangeAt(0);
RefPtr<const nsRange> firstRange = selection->GetRangeAt(0);
if (!firstRange || !firstRange->IsPositioned()) {
return Err(NS_ERROR_FAILURE);
}
@ -2144,7 +2144,7 @@ nsresult nsFrameSelection::ClearNormalSelection() {
return err.StealNSResult();
}
static nsIContent* GetFirstSelectedContent(nsRange* aRange) {
static nsIContent* GetFirstSelectedContent(const nsRange* aRange) {
if (!aRange) {
return nullptr;
}

View File

@ -131,8 +131,8 @@ static void CachePrintSelectionRanges(const Document& aSourceDoc,
auto* printRanges = new nsTArray<RefPtr<nsRange>>(rangeCount);
for (size_t i = 0; i < rangeCount; ++i) {
nsRange* range = sourceDocIsStatic ? origRanges->ElementAt(i).get()
: origSelection->GetRangeAt(i);
const nsRange* range = sourceDocIsStatic ? origRanges->ElementAt(i).get()
: origSelection->GetRangeAt(i);
nsINode* startContainer = range->GetStartContainer();
nsINode* endContainer = range->GetEndContainer();

View File

@ -26,12 +26,9 @@ bool PaintWorkletGlobalScope::WrapGlobalObject(
// The SharedArrayBuffer global constructor property should not be present in
// a fresh global object when shared memory objects aren't allowed (because
// COOP/COEP support isn't enabled, or because COOP/COEP don't act to isolate
// this worker to a separate process). However, it's not presently clear how
// to do this, so for now assign a backwards-compatible value. Bug 1630876
// will fix this.
bool defineSharedArrayBufferConstructor = true;
// this worker to a separate process).
options.creationOptions().setDefineSharedArrayBufferConstructor(
defineSharedArrayBufferConstructor);
IsSharedMemoryAllowed());
JS::AutoHoldPrincipals principals(aCx, new WorkletPrincipals(mImpl));
return PaintWorkletGlobalScope_Binding::Wrap(

View File

@ -1093,13 +1093,17 @@ void HttpChannelChild::OnStopRequest(
#ifdef MOZ_GECKO_PROFILER
if (profiler_can_accept_markers()) {
nsAutoCString contentType;
if (mResponseHead) {
mResponseHead->ContentType(contentType);
}
int32_t priority = PRIORITY_NORMAL;
GetPriority(&priority);
profiler_add_network_marker(
mURI, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), mTransferSize, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, nullptr,
std::move(mSource));
std::move(mSource), Some(nsDependentCString(contentType.get())));
}
#endif
@ -1674,11 +1678,19 @@ void HttpChannelChild::Redirect1Begin(
nsCOMPtr<nsIURI> uri = DeserializeURI(newOriginalURI);
ResourceTimingStructArgsToTimingsStruct(timing, mTransactionTimings);
PROFILER_ADD_NETWORK_MARKER(mURI, mPriority, mChannelId,
NetworkLoadType::LOAD_REDIRECT,
mLastStatusReported, TimeStamp::Now(), 0,
kCacheUnknown, mLoadInfo->GetInnerWindowID(),
&mTransactionTimings, uri, std::move(mSource));
#ifdef MOZ_GECKO_PROFILER
if (profiler_can_accept_markers()) {
nsAutoCString contentType;
responseHead.ContentType(contentType);
profiler_add_network_marker(
mURI, mPriority, mChannelId, NetworkLoadType::LOAD_REDIRECT,
mLastStatusReported, TimeStamp::Now(), 0, kCacheUnknown,
mLoadInfo->GetInnerWindowID(), &mTransactionTimings, uri,
std::move(mSource), Some(nsDependentCString(contentType.get())));
}
#endif
if (!securityInfoSerialization.IsEmpty()) {
rv = NS_DeserializeObject(securityInfoSerialization,

View File

@ -6021,11 +6021,17 @@ nsresult nsHttpChannel::ContinueProcessRedirectionAfterFallback(nsresult rv) {
timings = mTransaction->Timings();
}
nsAutoCString contentType;
if (mResponseHead) {
mResponseHead->ContentType(contentType);
}
profiler_add_network_marker(
mURI, priority, mChannelId, NetworkLoadType::LOAD_REDIRECT,
mLastStatusReported, TimeStamp::Now(), mLogicalOffset,
mCacheDisposition, mLoadInfo->GetInnerWindowID(), &timings,
mRedirectURI, std::move(mSource));
mRedirectURI, std::move(mSource),
Some(nsDependentCString(contentType.get())));
}
#endif
@ -8337,11 +8343,17 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
GetURI(getter_AddRefs(uri));
int32_t priority = PRIORITY_NORMAL;
GetPriority(&priority);
nsAutoCString contentType;
if (mResponseHead) {
mResponseHead->ContentType(contentType);
}
profiler_add_network_marker(
uri, priority, mChannelId, NetworkLoadType::LOAD_STOP,
mLastStatusReported, TimeStamp::Now(), mLogicalOffset,
mCacheDisposition, mLoadInfo->GetInnerWindowID(), &mTransactionTimings,
nullptr, std::move(mSource));
nullptr, std::move(mSource),
Some(nsDependentCString(contentType.get())));
}
#endif

View File

@ -98,7 +98,7 @@ int64_t nsHttpResponseHead::ContentLength() {
return mContentLength;
}
void nsHttpResponseHead::ContentType(nsACString& aContentType) {
void nsHttpResponseHead::ContentType(nsACString& aContentType) const {
RecursiveMutexAutoLock monitor(mRecursiveMutex);
aContentType = mContentType;
}

View File

@ -65,7 +65,7 @@ class nsHttpResponseHead {
uint16_t Status() const;
void StatusText(nsACString& aStatusText);
int64_t ContentLength();
void ContentType(nsACString& aContentType);
void ContentType(nsACString& aContentType) const;
void ContentCharset(nsACString& aContentCharset);
bool Public();
bool Private();

View File

@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzjHSobdeiQ3JHP/cCIOp
WaX9y12rL5mIo9OR9bpqEZdD0yXJJJeZA887Mv8slqsM+qObMUpKvfEE6zyYPIZJ
ANib31neI5BBYHhfhf2f5EnkilSYlmU3Gx+uRsmsdt58PpYe124tOAGgca/8bUy3
eb6kUUTwvMI0oWQuPkGUaoHVQyj/bBMTrIkyF3UbfFtiX/SfOPvIoabNUe+pQHUe
pqC2+RxzDGj+shTq/hYhtXlptFzsEEb2+0foLy0MY8C30dP2QqbM2iavvr/P8OcS
Gm3H0TQcRzIEBzvPcIjiZi1nQj/r/3TlYRNCjuYT/HsNLXrB/U5Tc990jjAUJxdH
0wIDAQAB
-----END PUBLIC KEY-----

View File

@ -0,0 +1,14 @@
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA8Y6AS+xwKoXZl0X5qOKr
0I00xC4UN+IMjA1LIQoZ2GBkiqQF3q8v2nWTFE0+47+3NtP0l8tvsQY+LSYR4Fek
v2Vx4m/CAMKmWzW6Vtlj80y6rQ04V19l41bZXvCIBW5fm9sAvPgc7CngkcLySNqk
8vf57cUEpOmbsjSOCmK0j8hh03I1eWogpbAVEchSm1xN2sUJaVTvz5j8BfE6Vm0i
nN7V0zF+AOxzvntZIpfUqMZbHRiMkGn4l9rjia1Rz0qUc9RNCJkNocyKtQ2N2wnN
FjHpmK9x2V71cS1JQGhgLegrswPCAWY1lTmiLk9LweqGoVL0rqR4LCkb0VCaeSRe
6bUEYcU1ZQedE80zGKB3AfoC5br1shYY0xjmyRSCQ8m8WE60HzXhL8wczKrn5yoJ
iF6BxFwcYsvrWBPgIYVZLcqjODfR/M62o8yIfTC7yBcIdycJ0sWhB47dHAFxv1kc
wv8Ik9ftvDyupE8kwcl58fNOXz93j7IxMry/ey27NyYpESPOUNcjT8TP26FdGebg
4iJx0/LaYmaNUdchfBBlaYqGdH6ZGK0OeVxzHstGuG0gebm/igYcpaFxiQzvWijX
MIAU56s4g+yj7pSzT5/s9r8Gv+YhsNHKm4hnwLZaITV0lLMT5h/OZGseQTPMBnAR
hK3CIfcqG0I23hdwI29ZuUMCAwEAAQ==
-----END PUBLIC KEY-----

View File

@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4j/IS3gWbyVVnWn4ZRnC
Fuzb6VAaHa0I+4E504ekhVAhbKlSfBstkLbXajdjUVAJpn02zWnOaTl5KAdpDpIp
SkdA4mK20ej3/Ij7gIt8IwaX+ArXL8mP84pxDn5BgaNADm3206Z6YQzc/TDYu529
qkDFmLqNUVRJAhPO+qqhKHIcVGh8HUHXN6XV1qOFip+UU0M474jAGgurVmAv8Rh7
VvM0v5KmB6V6WHwM5gwjg2yRY/o+xYIsNeSes9rpp+MOs/RnUA6LI4WZGY4YahvX
VclIXBDgbWPYtojexIJkmYj8JIIRsh3eCsrRRe14fq7cBurp3CxBYMlDHf0RUoaq
hQIDAQAB
-----END PUBLIC KEY-----

View File

@ -1,9 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvH4r94FpQ0gvr1hhTfV9
NUeWPJ5CN6TZRq7v/Dc4nkJ1J4IP1B3UEii34tcNKpy1nKupiZuTT6T1zQYT+z5x
3UkDF9qQboQ8RNb/BEz/cN3on/LTEnZ7YSraRL11M6cEB8mvmJxddCEquwqccRbs
Usp8WUB7uRv1w6Anley7N9F/LE1iLPwJasZypRnzWb3aYsJy0cMFOYy+OXVdpktn
qYqlNIjnt84u4Nil6UXnBbIJNUVOCY8wOFClNvVpubjPkWK1gtdWy3x/hJU5RpAO
K9cnHxq4M/I4SUWTWO3r7yweQiHG4Jyoc7sP1jkwjBkSG93sDEycfwOdOoZft3wN
sQIDAQAB
-----END PUBLIC KEY-----

View File

@ -53,6 +53,5 @@ fi
python3.8 /home/worker/bin/funsize.py \
--artifacts-dir "$ARTIFACTS_DIR" \
--task-definition /home/worker/task.json \
--sha1-signing-cert "/home/worker/keys/${SIGNING_CERT}_sha1.pubkey" \
--sha384-signing-cert "/home/worker/keys/${SIGNING_CERT}_sha384.pubkey" \
--signing-cert "/home/worker/keys/${SIGNING_CERT}.pubkey" \
$EXTRA_PARAMS

View File

@ -51,13 +51,13 @@ BCJ_OPTIONS = {
}
def verify_signature(mar, certs):
def verify_signature(mar, cert):
log.info("Checking %s signature", mar)
with open(mar, "rb") as mar_fh:
m = MarReader(mar_fh)
if not m.verify(verify_key=certs.get(m.signature_type)):
if not m.verify(verify_key=cert):
raise ValueError(
"MAR Signature invalid: %s against %s", mar, certs.get(m.signature_type)
"MAR Signature invalid: %s (%s) against %s", mar, m.signature_type, cert
)
@ -65,10 +65,7 @@ def process_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("--artifacts-dir", required=True)
parser.add_argument(
"--sha1-signing-cert", type=argparse.FileType("rb"), required=True
)
parser.add_argument(
"--sha384-signing-cert", type=argparse.FileType("rb"), required=True
"--signing-cert", type=argparse.FileType("rb"), required=True
)
parser.add_argument("--task-definition", required=True, type=argparse.FileType("r"))
parser.add_argument(
@ -234,7 +231,7 @@ def extract_download_urls(partials_config, mar_type):
async def download_and_verify_mars(
partials_config, allowed_url_prefixes, signing_certs
partials_config, allowed_url_prefixes, signing_cert
):
"""Download, check signature, channel ID and unpack MAR files."""
# Separate these categories so we can opt to perform checks on only 'to' downloads.
@ -257,7 +254,7 @@ async def download_and_verify_mars(
if not os.getenv("MOZ_DISABLE_MAR_CERT_VERIFICATION") and not url.startswith(
QUEUE_PREFIX
):
verify_signature(downloads[url]["download_path"], signing_certs)
verify_signature(downloads[url]["download_path"], signing_cert)
# Only validate the target channel ID, as we update from beta->release
if url in to_urls:
@ -393,7 +390,7 @@ async def manage_partial(
return mar_data
async def async_main(args, signing_certs):
async def async_main(args, signing_cert):
tasks = []
allowed_url_prefixes = list(ALLOWED_URL_PREFIXES)
@ -403,7 +400,7 @@ async def async_main(args, signing_certs):
task = json.load(args.task_definition)
downloads = await download_and_verify_mars(
task["extra"]["funsize"]["partials"], allowed_url_prefixes, signing_certs
task["extra"]["funsize"]["partials"], allowed_url_prefixes, signing_cert
)
tools_dir = Path(tempfile.mkdtemp())
@ -449,20 +446,15 @@ def main():
logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s")
log.setLevel(args.log_level)
signing_certs = {
"sha1": args.sha1_signing_cert.read(),
"sha384": args.sha384_signing_cert.read(),
}
assert get_keysize(signing_certs["sha1"]) == 2048
assert get_keysize(signing_certs["sha384"]) == 4096
signing_cert = args.signing_cert.read()
assert get_keysize(signing_cert) == 4096
artifacts_dir = Path(args.artifacts_dir)
if not artifacts_dir.exists():
artifacts_dir.mkdir()
loop = asyncio.get_event_loop()
manifest = loop.run_until_complete(async_main(args, signing_certs))
manifest = loop.run_until_complete(async_main(args, signing_cert))
loop.close()
manifest_file = artifacts_dir / "manifest.json"

View File

@ -39,9 +39,11 @@ def _generate_task_output_files(job, filenames, locale=None):
def identify_desired_signing_keys(project):
if project in ["mozilla-beta", "mozilla-release", "mozilla-esr68", "mozilla-esr78"]:
if project in ["mozilla-beta", "mozilla-release"] or project.startswith("mozilla-esr"):
return "release"
return "nightly"
elif project == "mozilla-central":
return "nightly"
return "dep1"
@transforms.add

View File

@ -1,19 +0,0 @@
[no-coop-coep.https.any.serviceworker.html]
[SharedArrayBuffer constructor does not exist without COOP+COEP]
expected: FAIL
[no-coop-coep.https.any.sharedworker.html]
[SharedArrayBuffer constructor does not exist without COOP+COEP]
expected: FAIL
[no-coop-coep.https.any.html]
[SharedArrayBuffer constructor does not exist without COOP+COEP]
expected: FAIL
[no-coop-coep.https.any.worker.html]
[SharedArrayBuffer constructor does not exist without COOP+COEP]
expected: FAIL

View File

@ -444,7 +444,7 @@ nsresult nsWebBrowserFind::GetSearchLimits(nsRange* aSearchRange,
// There are four possible range endpoints we might use:
// DocumentStart, SelectionStart, SelectionEnd, DocumentEnd.
RefPtr<nsRange> range;
RefPtr<const nsRange> range;
nsCOMPtr<nsINode> node;
uint32_t offset;

View File

@ -612,16 +612,23 @@ bool ContentSessionStore::AppendSessionStorageChange(StorageEvent* aEvent) {
return false;
}
nsAutoString origin;
aEvent->GetUrl(origin);
nsCOMPtr<nsIURI> newUri;
nsresult rv =
NS_NewURI(getter_AddRefs(newUri), NS_ConvertUTF16toUTF8(origin));
RefPtr<Storage> changingStorage = aEvent->GetStorageArea();
if (!changingStorage) {
return false;
}
nsCOMPtr<nsIPrincipal> storagePrincipal = changingStorage->StoragePrincipal();
if (!storagePrincipal) {
return false;
}
nsAutoCString origin;
nsresult rv = storagePrincipal->GetOrigin(origin);
if (NS_FAILED(rv)) {
return false;
}
newUri->GetPrePath(*mOrigins.AppendElement());
mOrigins.AppendElement(origin);
aEvent->GetKey(*mKeys.AppendElement());
aEvent->GetNewValue(*mValues.AppendElement());
mStorageStatus = STORAGECHANGE;

View File

@ -1097,13 +1097,13 @@ static void ReadAllEntriesFromStorage(nsPIDOMWindowOuter* aWindow,
return;
}
nsCOMPtr<nsIPrincipal> storagePrincipal = doc->EffectiveStoragePrincipal();
nsCOMPtr<nsIPrincipal> storagePrincipal = doc->IntrinsicStoragePrincipal();
if (!storagePrincipal) {
return;
}
nsAutoCString origin;
nsresult rv = principal->GetOrigin(origin);
nsresult rv = storagePrincipal->GetOrigin(origin);
if (NS_FAILED(rv) || aOrigins.Contains(origin)) {
// Don't read a host twice.
return;
@ -1217,6 +1217,11 @@ void SessionStoreUtils::RestoreSessionStorage(
if (!browsingContext) {
return;
}
nsCOMPtr<nsIPrincipal> storagePrincipal =
BasePrincipal::CreateContentPrincipal(
NS_ConvertUTF16toUTF8(entry.mKey));
const RefPtr<SessionStorageManager> storageManager =
browsingContext->GetSessionStorageManager();
if (!storageManager) {
@ -1229,8 +1234,9 @@ void SessionStoreUtils::RestoreSessionStorage(
// followup bug to bug 600307.
// Null window because the current window doesn't match the principal yet
// and loads about:blank.
storageManager->CreateStorage(nullptr, principal, principal, EmptyString(),
false, getter_AddRefs(storage));
storageManager->CreateStorage(nullptr, principal, storagePrincipal,
EmptyString(), false,
getter_AddRefs(storage));
if (!storage) {
continue;
}

View File

@ -776,7 +776,7 @@ nsresult nsTypeAheadFind::GetSearchContainers(
// Consider current selection as null if
// it's not in the currently focused document
RefPtr<nsRange> currentSelectionRange;
RefPtr<const nsRange> currentSelectionRange;
RefPtr<PresShell> selectionPresShell = GetPresShell();
if (aSelectionController && selectionPresShell &&
selectionPresShell == presShell) {
@ -1058,7 +1058,7 @@ nsresult nsTypeAheadFind::FindInternal(uint32_t aMode,
mStartFindRange = nullptr;
if (selection) {
RefPtr<nsRange> startFindRange = selection->GetRangeAt(0);
RefPtr<const nsRange> startFindRange = selection->GetRangeAt(0);
if (startFindRange) {
mStartFindRange = startFindRange->CloneRange();
}

View File

@ -568,7 +568,7 @@ NetworkMarkerPayload::TagAndSerializationBytes() const {
return CommonPropsTagAndSerializationBytes() +
ProfileBufferEntryWriter::SumBytes(mID, mURI, mRedirectURI, mType,
mPri, mCount, mTimings,
mCacheDisposition);
mCacheDisposition, mContentType);
}
void NetworkMarkerPayload::SerializeTagAndPayload(
@ -583,6 +583,7 @@ void NetworkMarkerPayload::SerializeTagAndPayload(
aEntryWriter.WriteObject(mCount);
aEntryWriter.WriteObject(mTimings);
aEntryWriter.WriteObject(mCacheDisposition);
aEntryWriter.WriteObject(mContentType);
}
// static
@ -598,9 +599,10 @@ UniquePtr<ProfilerMarkerPayload> NetworkMarkerPayload::Deserialize(
auto count = aEntryReader.ReadObject<int64_t>();
auto timings = aEntryReader.ReadObject<net::TimingStruct>();
auto cacheDisposition = aEntryReader.ReadObject<net::CacheDisposition>();
auto contentType = aEntryReader.ReadObject<Maybe<nsAutoCString>>();
return UniquePtr<ProfilerMarkerPayload>(new NetworkMarkerPayload(
std::move(props), id, std::move(uri), std::move(redirectURI), type, pri,
count, timings, cacheDisposition));
count, timings, cacheDisposition, std::move(contentType)));
}
static const char* GetNetworkState(NetworkLoadType aType) {
@ -656,6 +658,13 @@ void NetworkMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
if (mRedirectURI) {
aWriter.StringProperty("RedirectURI", mRedirectURI.get());
}
if (mContentType.isSome()) {
aWriter.StringProperty("contentType", mContentType.value().get());
} else {
aWriter.NullProperty("contentType");
}
if (mType != NetworkLoadType::LOAD_START) {
WriteTime(aWriter, aProcessStartTime, mTimings.domainLookupStart,
"domainLookupStart");

View File

@ -4908,7 +4908,8 @@ void profiler_add_network_marker(
mozilla::TimeStamp aStart, mozilla::TimeStamp aEnd, int64_t aCount,
mozilla::net::CacheDisposition aCacheDisposition, uint64_t aInnerWindowID,
const mozilla::net::TimingStruct* aTimings, nsIURI* aRedirectURI,
UniqueProfilerBacktrace aSource) {
UniqueProfilerBacktrace aSource,
const Maybe<nsDependentCString>& aContentType) {
if (!profiler_can_accept_markers()) {
return;
}
@ -4932,7 +4933,7 @@ void profiler_add_network_marker(
PromiseFlatCString(spec).get(), aType, aStart, aEnd,
aPriority, aCount, aCacheDisposition, aInnerWindowID,
aTimings, PromiseFlatCString(redirect_spec).get(),
std::move(aSource)));
std::move(aSource), aContentType));
}
void profiler_add_marker_for_thread(int aThreadId,

View File

@ -847,7 +847,9 @@ void profiler_add_network_marker(
mozilla::TimeStamp aStart, mozilla::TimeStamp aEnd, int64_t aCount,
mozilla::net::CacheDisposition aCacheDisposition, uint64_t aInnerWindowID,
const mozilla::net::TimingStruct* aTimings = nullptr,
nsIURI* aRedirectURI = nullptr, UniqueProfilerBacktrace aSource = nullptr);
nsIURI* aRedirectURI = nullptr, UniqueProfilerBacktrace aSource = nullptr,
const mozilla::Maybe<nsDependentCString>& aContentType =
mozilla::Nothing());
enum TracingKind {
TRACING_EVENT,

View File

@ -401,7 +401,9 @@ class NetworkMarkerPayload : public ProfilerMarkerPayload {
uint64_t aInnerWindowID,
const mozilla::net::TimingStruct* aTimings = nullptr,
const char* aRedirectURI = nullptr,
UniqueProfilerBacktrace aSource = nullptr)
UniqueProfilerBacktrace aSource = nullptr,
const mozilla::Maybe<nsDependentCString>& aContentType =
mozilla::Nothing())
: ProfilerMarkerPayload(aStartTime, aEndTime,
mozilla::Some(aInnerWindowID),
std::move(aSource)),
@ -413,7 +415,8 @@ class NetworkMarkerPayload : public ProfilerMarkerPayload {
mType(aType),
mPri(aPri),
mCount(aCount),
mCacheDisposition(aCacheDisposition) {
mCacheDisposition(aCacheDisposition),
mContentType(aContentType) {
if (aTimings) {
mTimings = *aTimings;
}
@ -427,7 +430,8 @@ class NetworkMarkerPayload : public ProfilerMarkerPayload {
mozilla::UniqueFreePtr<char>&& aRedirectURI,
NetworkLoadType aType, int32_t aPri, int64_t aCount,
mozilla::net::TimingStruct aTimings,
mozilla::net::CacheDisposition aCacheDisposition)
mozilla::net::CacheDisposition aCacheDisposition,
mozilla::Maybe<nsAutoCString>&& aContentType)
: ProfilerMarkerPayload(std::move(aCommonProps)),
mID(aID),
mURI(std::move(aURI)),
@ -436,7 +440,8 @@ class NetworkMarkerPayload : public ProfilerMarkerPayload {
mPri(aPri),
mCount(aCount),
mTimings(aTimings),
mCacheDisposition(aCacheDisposition) {}
mCacheDisposition(aCacheDisposition),
mContentType(std::move(aContentType)) {}
int64_t mID;
mozilla::UniqueFreePtr<char> mURI;
@ -446,6 +451,10 @@ class NetworkMarkerPayload : public ProfilerMarkerPayload {
int64_t mCount;
mozilla::net::TimingStruct mTimings;
mozilla::net::CacheDisposition mCacheDisposition;
// Content type is usually short, so we use nsAutoCString to reduce
// heap usage; the bigger object size is acceptable here because
// markers are short-lived on-stack objects.
mozilla::Maybe<nsAutoCString> mContentType;
};
class ScreenshotPayload : public ProfilerMarkerPayload {

View File

@ -23,6 +23,7 @@
#include "mozilla/BlocksRingBuffer.h"
#include "mozilla/ProfileBufferEntrySerializationGeckoExtensions.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/net/HttpBaseChannel.h"
#include "nsIThread.h"
#include "nsThreadUtils.h"
@ -720,6 +721,22 @@ TEST(GeckoProfiler, Markers)
OTHER, NativeAllocationMarkerPayload,
(ts1, 9876543210, 1234, 5678, nullptr));
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"NetworkMarkerPayload start marker", OTHER, NetworkMarkerPayload,
(1, "http://mozilla.org/", NetworkLoadType::LOAD_START, ts1, ts2, 34, 56,
net::kCacheHit, 78));
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"NetworkMarkerPayload stop marker", OTHER, NetworkMarkerPayload,
(12, "http://mozilla.org/", NetworkLoadType::LOAD_STOP, ts1, ts2, 34, 56,
net::kCacheUnresolved, 78, nullptr, nullptr, nullptr,
Some(nsDependentCString(NS_LITERAL_CSTRING("text/html").get()))));
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"NetworkMarkerPayload redirect marker", OTHER, NetworkMarkerPayload,
(123, "http://mozilla.org/", NetworkLoadType::LOAD_REDIRECT, ts1, ts2, 34,
56, net::kCacheUnresolved, 78, nullptr, "http://example.com/"));
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"PrefMarkerPayload marker", OTHER, PrefMarkerPayload,
("preference name", mozilla::Nothing(), mozilla::Nothing(),
@ -803,6 +820,9 @@ TEST(GeckoProfiler, Markers)
S_LogMarkerPayload,
S_LongTaskMarkerPayload,
S_NativeAllocationMarkerPayload,
S_NetworkMarkerPayload_start,
S_NetworkMarkerPayload_stop,
S_NetworkMarkerPayload_redirect,
S_PrefMarkerPayload,
S_ScreenshotPayload,
S_TextMarkerPayload1,
@ -1150,6 +1170,43 @@ TEST(GeckoProfiler, Markers)
EXPECT_EQ_JSON(payload["memoryAddress"], Int64, 1234);
EXPECT_EQ_JSON(payload["threadId"], Int64, 5678);
} else if (nameString == "NetworkMarkerPayload start marker") {
EXPECT_EQ(state, S_NetworkMarkerPayload_start);
state = State(S_NetworkMarkerPayload_start + 1);
EXPECT_EQ(typeString, "Network");
EXPECT_EQ_JSON(payload["id"], Int64, 1);
EXPECT_EQ_JSON(payload["URI"], String, "http://mozilla.org/");
EXPECT_EQ_JSON(payload["pri"], Int64, 34);
EXPECT_EQ_JSON(payload["count"], Int64, 56);
EXPECT_EQ_JSON(payload["cache"], String, "Hit");
EXPECT_EQ_JSON(payload["RedirectURI"], String, "");
EXPECT_TRUE(payload["contentType"].isNull());
} else if (nameString == "NetworkMarkerPayload stop marker") {
EXPECT_EQ(state, S_NetworkMarkerPayload_stop);
state = State(S_NetworkMarkerPayload_stop + 1);
EXPECT_EQ(typeString, "Network");
EXPECT_EQ_JSON(payload["id"], Int64, 12);
EXPECT_EQ_JSON(payload["URI"], String, "http://mozilla.org/");
EXPECT_EQ_JSON(payload["pri"], Int64, 34);
EXPECT_EQ_JSON(payload["count"], Int64, 56);
EXPECT_EQ_JSON(payload["cache"], String, "Unresolved");
EXPECT_EQ_JSON(payload["RedirectURI"], String, "");
EXPECT_EQ_JSON(payload["contentType"], String, "text/html");
} else if (nameString == "NetworkMarkerPayload redirect marker") {
EXPECT_EQ(state, S_NetworkMarkerPayload_redirect);
state = State(S_NetworkMarkerPayload_redirect + 1);
EXPECT_EQ(typeString, "Network");
EXPECT_EQ_JSON(payload["id"], Int64, 123);
EXPECT_EQ_JSON(payload["URI"], String, "http://mozilla.org/");
EXPECT_EQ_JSON(payload["pri"], Int64, 34);
EXPECT_EQ_JSON(payload["count"], Int64, 56);
EXPECT_EQ_JSON(payload["cache"], String, "Unresolved");
EXPECT_EQ_JSON(payload["RedirectURI"], String,
"http://example.com/");
EXPECT_TRUE(payload["contentType"].isNull());
} else if (nameString == "PrefMarkerPayload marker") {
EXPECT_EQ(state, S_PrefMarkerPayload);
state = State(S_PrefMarkerPayload + 1);

View File

@ -13,6 +13,8 @@ if (CONFIG['OS_TARGET'] in ('Android', 'Linux') and
]
LOCAL_INCLUDES += [
'/netwerk/base',
'/netwerk/protocol/http',
'/toolkit/components/jsoncpp/include',
'/tools/profiler/core',
'/tools/profiler/gecko',

View File

@ -6,6 +6,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/TextUtils.h"
#include "mozilla/UniquePtrExtensions.h"
#include "mozilla/Utf8.h"
@ -88,7 +89,8 @@ bool StartsWithDiskDesignatorAndBackslash(const nsAString& aAbsolutePath) {
// UNC path: ^\\\\.*
// A single backslash: ^\\.*
// A disk designator with a backslash: ^[A-Za-z]:\\.*
return aAbsolutePath.Length() >= 3 && aAbsolutePath.CharAt(1) == L':' &&
return aAbsolutePath.Length() >= 3 && IsAsciiAlpha(aAbsolutePath.CharAt(0)) &&
aAbsolutePath.CharAt(1) == L':' &&
aAbsolutePath.CharAt(2) == kPathSeparator;
}