merge mozilla-central to autoland. r=merge a=merge on a CLOSED TREE

--HG--
extra : amend_source : f79fd44b444bf498831f7fae0a34a23c430b8a41
This commit is contained in:
Sebastian Hengst 2017-10-08 20:57:14 +02:00
commit 005f263340
53 changed files with 2596 additions and 2371 deletions

View File

@ -51,11 +51,12 @@
children differently)
-->
<xul:box>
<xul:hbox class="searchbar-search-button-container">
<xul:image class="searchbar-search-button"
anonid="searchbar-search-button"
xbl:inherits="addengines"
tooltiptext="&searchIcon.tooltip;"/>
<xul:hbox class="searchbar-search-button"
anonid="searchbar-search-button"
xbl:inherits="addengines"
tooltiptext="&searchIcon.tooltip;">
<xul:image class="searchbar-search-icon"/>
<xul:image class="searchbar-search-icon-overlay"/>
</xul:hbox>
</xul:box>
<xul:hbox class="search-go-container">

View File

@ -13,10 +13,6 @@
margin-inline-start: -1px;
}
.search-go-container {
-moz-box-align: center;
}
menuitem[cmd="cmd_clearhistory"] {
list-style-image: url("moz-icon://stock/gtk-clear?size=menu");
}
@ -25,50 +21,6 @@ menuitem[cmd="cmd_clearhistory"][disabled] {
list-style-image: url("moz-icon://stock/gtk-clear?size=menu&state=disabled");
}
.searchbar-search-button-container {
-moz-box-align: center;
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator.png");
-moz-image-region: rect(0, 20px, 20px, 0);
margin-top: 1px;
margin-bottom: 1px;
margin-inline-start: 2px;
width: 20px;
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 60px, 20px, 40px);
}
@media (min-resolution: 1.1dppx) {
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator@2x.png");
-moz-image-region: rect(0, 40px, 40px, 0);
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add@2x.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 80px, 40px, 40px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 120px, 40px, 80px);
}
}
.search-panel-current-engine {
-moz-box-align: center;
}

View File

@ -17,50 +17,6 @@
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.svg");
}
.search-go-container,
.searchbar-search-button-container {
-moz-box-align: center;
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator.png");
-moz-image-region: rect(0, 20px, 20px, 0);
margin-inline-start: 3px;
margin-inline-end: 1px;
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 60px, 20px, 40px);
}
@media (min-resolution: 2dppx) {
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator@2x.png");
width: 20px;
-moz-image-region: rect(0, 40px, 40px, 0);
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add@2x.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 80px, 40px, 40px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 120px, 40px, 80px);
}
}
.search-panel-current-engine {
border-radius: 4px 4px 0 0;
}

View File

@ -55,6 +55,7 @@
skin/classic/browser/identity-icon.svg (../shared/identity-block/identity-icon.svg)
skin/classic/browser/identity-icon-notice.svg (../shared/identity-block/identity-icon-notice.svg)
skin/classic/browser/info.svg (../shared/info.svg)
skin/classic/browser/searchReset.css (../shared/searchReset.css)
skin/classic/browser/illustrations/error-session-restore.svg (../shared/illustrations/error-session-restore.svg)
@ -180,17 +181,14 @@
skin/classic/browser/zoom-out.svg (../shared/icons/zoom-out.svg)
skin/classic/browser/search-indicator.png (../shared/search/search-indicator.png)
skin/classic/browser/search-indicator@2x.png (../shared/search/search-indicator@2x.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/search-engine-placeholder@2x.png (../shared/search/search-engine-placeholder@2x.png)
skin/classic/browser/searchReset.css (../shared/searchReset.css)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/badge-add-engine@2x.png (../shared/search/badge-add-engine@2x.png)
skin/classic/browser/search-indicator-badge-add.png (../shared/search/search-indicator-badge-add.png)
skin/classic/browser/search-indicator-badge-add@2x.png (../shared/search/search-indicator-badge-add@2x.png)
skin/classic/browser/search-indicator-magnifying-glass.svg (../shared/search/search-indicator-magnifying-glass.svg)
skin/classic/browser/search-arrow-go.svg (../shared/search/search-arrow-go.svg)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/search-engine-placeholder@2x.png (../shared/search/search-engine-placeholder@2x.png)
skin/classic/browser/search-indicator-badge-add.svg (../shared/search/search-indicator-badge-add.svg)
skin/classic/browser/search-indicator-magnifying-glass.svg (../shared/search/search-indicator-magnifying-glass.svg)
skin/classic/browser/tabbrowser/loading.svg (../shared/tabbrowser/loading.svg)
skin/classic/browser/tabbrowser/loading-burst.svg (../shared/tabbrowser/loading-burst.svg)
skin/classic/browser/tabbrowser/crashed.svg (../shared/tabbrowser/crashed.svg)
@ -202,6 +200,7 @@
skin/classic/browser/tabbrowser/tab-audio-blocked.svg (../shared/tabbrowser/tab-audio-blocked.svg)
skin/classic/browser/tabbrowser/tab-audio-small.svg (../shared/tabbrowser/tab-audio-small.svg)
skin/classic/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
skin/classic/browser/toolbarbutton-dropdown-arrow.png (../shared/toolbarbutton-dropdown-arrow.png)
skin/classic/browser/translating-16.png (../shared/translation/translating-16.png)
skin/classic/browser/translating-16@2x.png (../shared/translation/translating-16@2x.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 B

View File

@ -0,0 +1,8 @@
<!-- 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="11" height="11" viewBox="0 0 11 11">
<circle fill="#fff" cx="5.5" cy="5.5" r="5.5"/>
<circle fill="#12bc00" class="cls-2" cx="5.5" cy="5.5" r="4.5"/>
<path fill="#fff" d="M7.5 6H6v1.5a.5.5 0 0 1-1 0V6H3.5a.5.5 0 0 1 0-1H5V3.5a.5.5 0 0 1 1 0V5h1.5a.5.5 0 0 1 0 1z"/>
</svg>

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

View File

@ -364,3 +364,49 @@
#urlbar-zoom-button > .toolbarbutton-icon {
display: none;
}
/* Search bar */
.searchbar-search-button {
-moz-box-align: center;
fill: currentColor;
}
.searchbar-search-icon {
list-style-image: url(chrome://browser/skin/search-glass.svg);
-moz-context-properties: fill, fill-opacity;
pointer-events: none;
margin-inline-start: 8px;
margin-inline-end: 6px;
fill-opacity: .4;
}
.searchbar-search-button:hover > .searchbar-search-icon {
fill-opacity: .6;
}
.searchbar-search-button:hover:active > .searchbar-search-icon {
fill-opacity: .8;
}
.searchbar-search-icon-overlay {
pointer-events: none;
}
.searchbar-search-button[addengines=true] > .searchbar-search-icon-overlay {
list-style-image: url(chrome://browser/skin/search-indicator-badge-add.svg);
margin-inline-start: -15px;
margin-inline-end: 4px;
margin-top: -10px;
width: 11px;
height: 11px;
}
.searchbar-search-button:hover:not([addengines=true]) > .searchbar-search-icon-overlay {
list-style-image: url(chrome://global/skin/icons/arrow-dropdown-12.svg);
-moz-context-properties: fill;
margin-inline-start: -8px;
margin-inline-end: 2px;
width: 6px;
height: 6px;
}

View File

@ -13,51 +13,6 @@
margin-inline-start: -1px;
}
.search-go-container,
.searchbar-search-button-container {
-moz-box-align: center;
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator.png");
-moz-image-region: rect(0, 20px, 20px, 0);
margin-top: 1px;
margin-bottom: 1px;
margin-inline-start: 4px;
width: 20px;
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 60px, 20px, 40px);
}
@media (min-resolution: 1.1dppx) {
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator@2x.png");
-moz-image-region: rect(0, 40px, 40px, 0);
}
.searchbar-search-button[addengines="true"] {
list-style-image: url("chrome://browser/skin/search-indicator-badge-add@2x.png");
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 80px, 40px, 40px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 120px, 40px, 80px);
}
}
.search-panel-current-engine {
-moz-box-align: center;
}

View File

@ -1666,17 +1666,18 @@ WebSocketImpl::Init(JSContext* aCx,
nsCOMPtr<nsPIDOMWindowInner> innerWindow;
while (true) {
if (principal && !principal->GetIsNullPrincipal()) {
break;
if (principal) {
bool isNullPrincipal = true;
isNullPrincipal = principal->GetIsNullPrincipal();
if (isNullPrincipal || nsContentUtils::IsSystemPrincipal(principal)) {
break;
}
}
if (!innerWindow) {
innerWindow = do_QueryInterface(globalObject);
if (!innerWindow) {
// If we are in a XPConnect sandbox or in a JS component,
// innerWindow will be null. There is nothing on top of this to be
// considered.
break;
if (NS_WARN_IF(!innerWindow)) {
return NS_ERROR_DOM_SECURITY_ERR;
}
}

View File

@ -1,62 +0,0 @@
<html><body>
<iframe id="frame" sandbox="allow-scripts allow-popups"></iframe>
<script type="application/javascript;version=1.8">
onmessage = function(e) {
parent.postMessage(e.data, '*');
}
var ifr = document.getElementById('frame');
if (location.search == '?nested') {
var url = new URL(location);
url.search = "";
ifr.src = url.href;
} else if (location.search == '?popup') {
var url = new URL(location);
url.search = "?opener";
ifr.srcdoc = "<html><script>" +
"window.open('" + url.href + "', 'foobar');" +
"onmessage = function(e) { " +
" parent.postMessage(e.data, '*'); " +
"}" +
"</scr" + "ipt></html>";
} else if (location.search == '?opener') {
try{
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
socket.onerror = function(e) {
opener.postMessage('WS onerror', '*');
};
socket.onopen = function(event) {
opener.postMessage('WS onopen', '*');
};
} catch(e) {
if (e.name == 'SecurityError') {
opener.postMessage('WS Throws!', '*');
} else {
opener.postMessage('WS Throws something else!', '*');
}
}
} else {
ifr.srcdoc = `
<html><script>
try{
var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
socket.onerror = function(e) {
parent.postMessage('WS onerror', '*');
};
socket.onopen = function(event) {
parent.postMessage('WS onopen', '*');
};
} catch(e) {
if (e.name == 'SecurityError') {
parent.postMessage('WS Throws!', '*');
} else {
parent.postMessage('WS Throws something else!', '*');
}
}
</scr`+`ipt>
</html>`;
}
</script>
</body></html>

View File

@ -805,9 +805,6 @@ skip-if = toolkit == 'android'
skip-if = toolkit == 'android'
[test_websocket_permessage_deflate.html]
skip-if = toolkit == 'android'
[test_webSocket_sandbox.html]
skip-if = toolkit == 'android'
support-files = iframe_webSocket_sandbox.html
[test_websocket1.html]
skip-if = toolkit == 'android'
[test_websocket2.html]

View File

@ -1,34 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Bug 1252751</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="container"></div>
<iframe id="frame"></iframe>
<script type="application/javascript;version=1.8">
var urls = [ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html",
"https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?nested",
"https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?popup" ];
onmessage = function(e) {
is(e.data, "WS Throws!", "ws://URI cannot be used by a https iframe");
runTest();
}
function runTest() {
if (!urls.length) {
SimpleTest.finish();
return;
}
document.getElementById("frame").src = urls.shift();
}
SimpleTest.waitForExplicitFinish();
runTest();
</script>
</body>
</html>

View File

@ -725,6 +725,13 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// into UpdateCursor().
GenerateDragGesture(aPresContext, mouseEvent);
UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
UpdateLastRefPointOfMouseEvent(mouseEvent);
if (sIsPointerLocked) {
ResetPointerToWindowCenterWhilePointerLocked(mouseEvent);
}
UpdateLastPointerPosition(mouseEvent);
GenerateMouseEnterExit(mouseEvent);
// Flush pending layout changes, so that later mouse move events
// will go to the right nodes.
@ -4266,6 +4273,83 @@ EventStateManager::GeneratePointerEnterExit(EventMessage aMessage,
GenerateMouseEnterExit(&pointerEvent);
}
/* static */ void
EventStateManager::UpdateLastRefPointOfMouseEvent(WidgetMouseEvent* aMouseEvent)
{
if (aMouseEvent->mMessage != eMouseMove) {
return;
}
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
// Movement is calculated in UIEvent::GetMovementPoint() as:
// previous_mousemove_mRefPoint - current_mousemove_mRefPoint.
if (sIsPointerLocked && aMouseEvent->mWidget) {
// The pointer is locked. If the pointer is not located at the center of
// the window, dispatch a synthetic mousemove to return the pointer there.
// Doing this between "real" pointer moves gives the impression that the
// (locked) pointer can continue moving and won't stop at the screen
// boundary. We cancel the synthetic event so that we don't end up
// dispatching the centering move event to content.
aMouseEvent->mLastRefPoint =
GetWindowClientRectCenter(aMouseEvent->mWidget);
} else if (sLastRefPoint == kInvalidRefPoint) {
// We don't have a valid previous mousemove mRefPoint. This is either
// the first move we've encountered, or the mouse has just re-entered
// the application window. We should report (0,0) movement for this
// case, so make the current and previous mRefPoints the same.
aMouseEvent->mLastRefPoint = aMouseEvent->mRefPoint;
} else {
aMouseEvent->mLastRefPoint = sLastRefPoint;
}
}
/* static */ void
EventStateManager::ResetPointerToWindowCenterWhilePointerLocked(
WidgetMouseEvent* aMouseEvent)
{
MOZ_ASSERT(sIsPointerLocked);
if (aMouseEvent->mMessage != eMouseMove || !aMouseEvent->mWidget) {
return;
}
// The pointer is locked. If the pointer is not located at the center of
// the window, dispatch a synthetic mousemove to return the pointer there.
// Doing this between "real" pointer moves gives the impression that the
// (locked) pointer can continue moving and won't stop at the screen
// boundary. We cancel the synthetic event so that we don't end up
// dispatching the centering move event to content.
LayoutDeviceIntPoint center =
GetWindowClientRectCenter(aMouseEvent->mWidget);
if (aMouseEvent->mRefPoint != center) {
// Mouse move doesn't finish at the center of the window. Dispatch a
// synthetic native mouse event to move the pointer back to the center
// of the window, to faciliate more movement. But first, record that
// we've dispatched a synthetic mouse movement, so we can cancel it
// in the other branch here.
sSynthCenteringPoint = center;
aMouseEvent->mWidget->SynthesizeNativeMouseMove(
center + aMouseEvent->mWidget->WidgetToScreenOffset(), nullptr);
} else if (aMouseEvent->mRefPoint == sSynthCenteringPoint) {
// This is the "synthetic native" event we dispatched to re-center the
// pointer. Cancel it so we don't expose the centering move to content.
aMouseEvent->StopPropagation();
// Clear sSynthCenteringPoint so we don't cancel other events
// targeted at the center.
sSynthCenteringPoint = kInvalidRefPoint;
}
}
/* static */ void
EventStateManager::UpdateLastPointerPosition(WidgetMouseEvent* aMouseEvent)
{
if (aMouseEvent->mMessage != eMouseMove) {
return;
}
sLastRefPoint = aMouseEvent->mRefPoint;
}
void
EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
{
@ -4278,51 +4362,6 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
switch(aMouseEvent->mMessage) {
case eMouseMove:
{
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
// Movement is calculated in UIEvent::GetMovementPoint() as:
// previous_mousemove_mRefPoint - current_mousemove_mRefPoint.
if (sIsPointerLocked && aMouseEvent->mWidget) {
// The pointer is locked. If the pointer is not located at the center of
// the window, dispatch a synthetic mousemove to return the pointer there.
// Doing this between "real" pointer moves gives the impression that the
// (locked) pointer can continue moving and won't stop at the screen
// boundary. We cancel the synthetic event so that we don't end up
// dispatching the centering move event to content.
LayoutDeviceIntPoint center =
GetWindowClientRectCenter(aMouseEvent->mWidget);
aMouseEvent->mLastRefPoint = center;
if (aMouseEvent->mRefPoint != center) {
// Mouse move doesn't finish at the center of the window. Dispatch a
// synthetic native mouse event to move the pointer back to the center
// of the window, to faciliate more movement. But first, record that
// we've dispatched a synthetic mouse movement, so we can cancel it
// in the other branch here.
sSynthCenteringPoint = center;
aMouseEvent->mWidget->SynthesizeNativeMouseMove(
center + aMouseEvent->mWidget->WidgetToScreenOffset(), nullptr);
} else if (aMouseEvent->mRefPoint == sSynthCenteringPoint) {
// This is the "synthetic native" event we dispatched to re-center the
// pointer. Cancel it so we don't expose the centering move to content.
aMouseEvent->StopPropagation();
// Clear sSynthCenteringPoint so we don't cancel other events
// targeted at the center.
sSynthCenteringPoint = kInvalidRefPoint;
}
} else if (sLastRefPoint == kInvalidRefPoint) {
// We don't have a valid previous mousemove mRefPoint. This is either
// the first move we've encountered, or the mouse has just re-entered
// the application window. We should report (0,0) movement for this
// case, so make the current and previous mRefPoints the same.
aMouseEvent->mLastRefPoint = aMouseEvent->mRefPoint;
} else {
aMouseEvent->mLastRefPoint = sLastRefPoint;
}
// Update the last known mRefPoint with the current mRefPoint.
sLastRefPoint = aMouseEvent->mRefPoint;
}
MOZ_FALLTHROUGH;
case ePointerMove:
case ePointerDown:
case ePointerGotCapture:

View File

@ -973,6 +973,20 @@ private:
RefPtr<OverOutElementsWrapper>& aChunk,
nsIContent* aClosure);
/**
* Update the attribute mLastRefPoint of the mouse event. It should be
* the center of the window while the pointer is locked.
* the same value as mRefPoint while there is no known last ref point.
* the same value as the last known mRefPoint.
*/
static void UpdateLastRefPointOfMouseEvent(WidgetMouseEvent* aMouseEvent);
static void ResetPointerToWindowCenterWhilePointerLocked(
WidgetMouseEvent* aMouseEvent);
// Update the last known ref point to the current event's mRefPoint.
static void UpdateLastPointerPosition(WidgetMouseEvent* aMouseEvent);
int32_t mLockCursor;
bool mLastFrameConsumedSetCursor;

View File

@ -0,0 +1,5 @@
function f(expected) {
eval("for (var i = 0; i < 30; i++) assertEq(new.target, expected)");
}
new f(f);
f(undefined);

View File

@ -530,7 +530,7 @@ BaselineCacheIRCompiler::emitCallScriptedGetterResult()
Register obj = allocator.useRegister(masm, reader.objOperandId());
Address getterAddr(stubAddress(reader.stubOffset()));
AutoScratchRegisterExcluding code(allocator, masm, ArgumentsRectifierReg);
AutoScratchRegister code(allocator, masm);
AutoScratchRegister callee(allocator, masm);
AutoScratchRegister scratch(allocator, masm);
@ -571,12 +571,9 @@ BaselineCacheIRCompiler::emitCallScriptedGetterResult()
masm.branch32(Assembler::Equal, callee, Imm32(0), &noUnderflow);
{
// Call the arguments rectifier.
MOZ_ASSERT(ArgumentsRectifierReg != code);
JitCode* argumentsRectifier = cx_->runtime()->jitRuntime()->getArgumentsRectifier();
masm.movePtr(ImmGCPtr(argumentsRectifier), code);
masm.loadPtr(Address(code, JitCode::offsetOfCode()), code);
masm.movePtr(ImmWord(0), ArgumentsRectifierReg);
}
masm.bind(&noUnderflow);
@ -1630,7 +1627,7 @@ BaselineCacheIRCompiler::emitCallNativeSetter()
bool
BaselineCacheIRCompiler::emitCallScriptedSetter()
{
AutoScratchRegisterExcluding scratch1(allocator, masm, ArgumentsRectifierReg);
AutoScratchRegister scratch1(allocator, masm);
AutoScratchRegister scratch2(allocator, masm);
Register obj = allocator.useRegister(masm, reader.objOperandId());
@ -1685,12 +1682,9 @@ BaselineCacheIRCompiler::emitCallScriptedSetter()
masm.branch32(Assembler::BelowOrEqual, scratch2, Imm32(1), &noUnderflow);
{
// Call the arguments rectifier.
MOZ_ASSERT(ArgumentsRectifierReg != scratch1);
JitCode* argumentsRectifier = cx_->runtime()->jitRuntime()->getArgumentsRectifier();
masm.movePtr(ImmGCPtr(argumentsRectifier), scratch1);
masm.loadPtr(Address(scratch1, JitCode::offsetOfCode()), scratch1);
masm.movePtr(ImmWord(1), ArgumentsRectifierReg);
}
masm.bind(&noUnderflow);

View File

@ -3057,10 +3057,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
bool canUseTailCallReg = regs.has(ICTailCallReg);
Register argcReg = R0.scratchReg();
MOZ_ASSERT(argcReg != ArgumentsRectifierReg);
regs.take(argcReg);
regs.take(ArgumentsRectifierReg);
regs.takeUnchecked(ICTailCallReg);
if (isSpread_)
@ -3169,7 +3166,6 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
MOZ_ASSERT(JSReturnOperand == R0);
regs = availableGeneralRegs(0);
regs.take(R0);
regs.take(ArgumentsRectifierReg);
argcReg = regs.takeAny();
// Restore saved argc so we can use it to calculate the address to save
@ -3252,15 +3248,11 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler& masm)
masm.branch32(Assembler::AboveOrEqual, argcReg, callee, &noUnderflow);
{
// Call the arguments rectifier.
MOZ_ASSERT(ArgumentsRectifierReg != code);
MOZ_ASSERT(ArgumentsRectifierReg != argcReg);
JitCode* argumentsRectifier =
cx->runtime()->jitRuntime()->getArgumentsRectifier();
masm.movePtr(ImmGCPtr(argumentsRectifier), code);
masm.loadPtr(Address(code, JitCode::offsetOfCode()), code);
masm.movePtr(argcReg, ArgumentsRectifierReg);
}
masm.bind(&noUnderflow);
@ -3681,7 +3673,6 @@ ICCall_ScriptedApplyArray::Compiler::generateStubCode(MacroAssembler& masm)
Register argcReg = R0.scratchReg();
regs.take(argcReg);
regs.takeUnchecked(ICTailCallReg);
regs.takeUnchecked(ArgumentsRectifierReg);
//
// Validate inputs
@ -3749,15 +3740,11 @@ ICCall_ScriptedApplyArray::Compiler::generateStubCode(MacroAssembler& masm)
masm.branch32(Assembler::AboveOrEqual, argcReg, scratch, &noUnderflow);
{
// Call the arguments rectifier.
MOZ_ASSERT(ArgumentsRectifierReg != target);
MOZ_ASSERT(ArgumentsRectifierReg != argcReg);
JitCode* argumentsRectifier =
cx->runtime()->jitRuntime()->getArgumentsRectifier();
masm.movePtr(ImmGCPtr(argumentsRectifier), target);
masm.loadPtr(Address(target, JitCode::offsetOfCode()), target);
masm.movePtr(argcReg, ArgumentsRectifierReg);
}
masm.bind(&noUnderflow);
regs.add(argcReg);
@ -3785,7 +3772,6 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler& masm)
Register argcReg = R0.scratchReg();
regs.take(argcReg);
regs.takeUnchecked(ICTailCallReg);
regs.takeUnchecked(ArgumentsRectifierReg);
//
// Validate inputs
@ -3847,15 +3833,11 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler& masm)
masm.branch32(Assembler::AboveOrEqual, argcReg, scratch, &noUnderflow);
{
// Call the arguments rectifier.
MOZ_ASSERT(ArgumentsRectifierReg != target);
MOZ_ASSERT(ArgumentsRectifierReg != argcReg);
JitCode* argumentsRectifier =
cx->runtime()->jitRuntime()->getArgumentsRectifier();
masm.movePtr(ImmGCPtr(argumentsRectifier), target);
masm.loadPtr(Address(target, JitCode::offsetOfCode()), target);
masm.movePtr(argcReg, ArgumentsRectifierReg);
}
masm.bind(&noUnderflow);
regs.add(argcReg);
@ -3882,10 +3864,7 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler& masm)
bool canUseTailCallReg = regs.has(ICTailCallReg);
Register argcReg = R0.scratchReg();
MOZ_ASSERT(argcReg != ArgumentsRectifierReg);
regs.take(argcReg);
regs.take(ArgumentsRectifierReg);
regs.takeUnchecked(ICTailCallReg);
// Load the callee in R1.
@ -3978,15 +3957,11 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler& masm)
masm.branch32(Assembler::AboveOrEqual, argcReg, callee, &noUnderflow);
{
// Call the arguments rectifier.
MOZ_ASSERT(ArgumentsRectifierReg != code);
MOZ_ASSERT(ArgumentsRectifierReg != argcReg);
JitCode* argumentsRectifier =
cx->runtime()->jitRuntime()->getArgumentsRectifier();
masm.movePtr(ImmGCPtr(argumentsRectifier), code);
masm.loadPtr(Address(code, JitCode::offsetOfCode()), code);
masm.movePtr(argcReg, ArgumentsRectifierReg);
}
masm.bind(&noUnderflow);

View File

@ -222,11 +222,12 @@ jit::EnterBaselineAtBranch(JSContext* cx, InterpreterFrame* fp, jsbytecode* pc)
data.jitcode += MacroAssembler::ToggledCallSize(data.jitcode);
}
// Note: keep this in sync with SetEnterJitData.
data.osrFrame = fp;
data.osrNumStackValues = fp->script()->nfixed() + cx->interpreterRegs().stackDepth();
AutoValueVector vals(cx);
RootedValue thisv(cx);
RootedValue newTarget(cx);
if (fp->isFunctionFrame()) {
data.constructing = fp->isConstructing();
@ -236,28 +237,18 @@ jit::EnterBaselineAtBranch(JSContext* cx, InterpreterFrame* fp, jsbytecode* pc)
data.envChain = nullptr;
data.calleeToken = CalleeToToken(&fp->callee(), data.constructing);
} else {
thisv.setUndefined();
data.constructing = false;
data.numActualArgs = 0;
data.maxArgc = 1;
data.maxArgv = thisv.address();
data.maxArgc = 0;
data.maxArgv = nullptr;
data.envChain = fp->environmentChain();
data.calleeToken = CalleeToToken(fp->script());
if (fp->isEvalFrame()) {
if (!vals.reserve(2))
return JitExec_Aborted;
vals.infallibleAppend(thisv);
if (fp->script()->isDirectEvalInFunction())
vals.infallibleAppend(fp->newTarget());
else
vals.infallibleAppend(NullValue());
data.maxArgc = 2;
data.maxArgv = vals.begin();
newTarget = fp->newTarget();
data.maxArgc = 1;
data.maxArgv = newTarget.address();
}
}

View File

@ -464,37 +464,6 @@ class MOZ_RAII AutoScratchRegister
operator Register() const { return reg_; }
};
// Like AutoScratchRegister, but lets the caller specify a register that should
// not be allocated here.
class MOZ_RAII AutoScratchRegisterExcluding
{
CacheRegisterAllocator& alloc_;
Register reg_;
public:
AutoScratchRegisterExcluding(CacheRegisterAllocator& alloc, MacroAssembler& masm,
Register excluding)
: alloc_(alloc)
{
MOZ_ASSERT(excluding != InvalidReg);
reg_ = alloc.allocateRegister(masm);
if (reg_ == excluding) {
// We need a different register, so try again.
reg_ = alloc.allocateRegister(masm);
MOZ_ASSERT(reg_ != excluding);
alloc_.releaseRegister(excluding);
}
MOZ_ASSERT(alloc_.currentOpRegs_.has(reg_));
}
~AutoScratchRegisterExcluding() {
alloc_.releaseRegister(reg_);
}
operator Register() const { return reg_; }
};
// The FailurePath class stores everything we need to generate a failure path
// at the end of the IC code. The failure path restores the input registers, if
// needed, and jumps to the next stub.

View File

@ -4241,10 +4241,8 @@ CodeGenerator::visitCallGeneric(LCallGeneric* call)
// Argument fixed needed. Load the ArgumentsRectifier.
masm.bind(&thunk);
{
MOZ_ASSERT(ArgumentsRectifierReg != objreg);
masm.movePtr(ImmGCPtr(argumentsRectifier), objreg); // Necessary for GC marking.
masm.loadPtr(Address(objreg, JitCode::offsetOfCode()), objreg);
masm.move32(Imm32(call->numActualArgs()), ArgumentsRectifierReg);
}
// Finally call the function in objreg.
@ -4674,10 +4672,8 @@ CodeGenerator::emitApplyGeneric(T* apply)
// Hardcode the address of the argumentsRectifier code.
JitCode* argumentsRectifier = gen->jitRuntime()->getArgumentsRectifier();
MOZ_ASSERT(ArgumentsRectifierReg != objreg);
masm.movePtr(ImmGCPtr(argumentsRectifier), objreg); // Necessary for GC marking.
masm.loadPtr(Address(objreg, JitCode::offsetOfCode()), objreg);
masm.movePtr(argcreg, ArgumentsRectifierReg);
}
masm.bind(&rejoin);

View File

@ -2803,6 +2803,8 @@ jit::SetEnterJitData(JSContext* cx, EnterJitData& data, RunState& state,
{
data.osrFrame = nullptr;
// Note: keep this in sync with EnterBaselineAtBranch.
if (state.isInvoke()) {
const CallArgs& args = state.asInvoke()->args();
unsigned numFormals = state.script()->functionNonDelazifying()->nargs();
@ -2813,7 +2815,7 @@ jit::SetEnterJitData(JSContext* cx, EnterJitData& data, RunState& state,
data.calleeToken = CalleeToToken(&args.callee().as<JSFunction>(), data.constructing);
if (data.numActualArgs >= numFormals) {
data.maxArgv = args.base() + 1;
data.maxArgv = args.array() - 1; // -1 to include |this|
} else {
MOZ_ASSERT(vals.empty());
unsigned numPushedArgs = Max(args.length(), numFormals);

View File

@ -500,9 +500,6 @@ LIRGenerator::lowerCallArguments(MCall* call)
void
LIRGenerator::visitCall(MCall* call)
{
MOZ_ASSERT(CallTempReg0 != CallTempReg1);
MOZ_ASSERT(CallTempReg0 != ArgumentsRectifierReg);
MOZ_ASSERT(CallTempReg1 != ArgumentsRectifierReg);
MOZ_ASSERT(call->getFunction()->type() == MIRType::Object);
// In case of oom, skip the rest of the allocations.
@ -548,7 +545,7 @@ LIRGenerator::visitCall(MCall* call)
} else {
// Call anything, using the most generic code.
lir = new(alloc()) LCallGeneric(useFixedAtStart(call->getFunction(), CallTempReg0),
tempFixed(ArgumentsRectifierReg),
tempFixed(CallTempReg1),
tempFixed(CallTempReg2));
}
defineReturn(lir, call);
@ -560,10 +557,6 @@ LIRGenerator::visitApplyArgs(MApplyArgs* apply)
{
MOZ_ASSERT(apply->getFunction()->type() == MIRType::Object);
// Assert if we cannot build a rectifier frame.
MOZ_ASSERT(CallTempReg0 != ArgumentsRectifierReg);
MOZ_ASSERT(CallTempReg1 != ArgumentsRectifierReg);
// Assert if the return value is already erased.
MOZ_ASSERT(CallTempReg2 != JSReturnReg_Type);
MOZ_ASSERT(CallTempReg2 != JSReturnReg_Data);
@ -589,10 +582,6 @@ LIRGenerator::visitApplyArray(MApplyArray* apply)
{
MOZ_ASSERT(apply->getFunction()->type() == MIRType::Object);
// Assert if we cannot build a rectifier frame.
MOZ_ASSERT(CallTempReg0 != ArgumentsRectifierReg);
MOZ_ASSERT(CallTempReg1 != ArgumentsRectifierReg);
// Assert if the return value is already erased.
MOZ_ASSERT(CallTempReg2 != JSReturnReg_Type);
MOZ_ASSERT(CallTempReg2 != JSReturnReg_Data);

View File

@ -61,7 +61,6 @@ struct SecondScratchRegisterScope : public AutoRegisterScope
};
static constexpr Register OsrFrameReg = r3;
static constexpr Register ArgumentsRectifierReg = r8;
static constexpr Register CallTempReg0 = r5;
static constexpr Register CallTempReg1 = r6;
static constexpr Register CallTempReg2 = r7;

View File

@ -476,12 +476,9 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
MacroAssembler masm(cx);
masm.pushReturnAddress();
// ArgumentsRectifierReg contains the |nargs| pushed onto the current frame.
// Including |this|, there are (|nargs| + 1) arguments to copy.
MOZ_ASSERT(ArgumentsRectifierReg == r8);
// Copy number of actual arguments into r0.
// Copy number of actual arguments into r0 and r8.
masm.ma_ldr(DTRAddr(sp, DtrOffImm(RectifierFrameLayout::offsetOfNumActualArgs())), r0);
masm.mov(r0, r8);
// Load the number of |undefined|s to push into r6.
masm.ma_ldr(DTRAddr(sp, DtrOffImm(RectifierFrameLayout::offsetOfCalleeToken())), r1);

View File

@ -43,7 +43,6 @@ static constexpr Register InvalidReg { Registers::invalid_reg };
static constexpr FloatRegister InvalidFloatReg = { FloatRegisters::invalid_fpreg, FloatRegisters::Single };
static constexpr Register OsrFrameReg { Registers::x3 };
static constexpr Register ArgumentsRectifierReg { Registers::x8 };
static constexpr Register CallTempReg0 { Registers::x9 };
static constexpr Register CallTempReg1 { Registers::x10 };
static constexpr Register CallTempReg2 { Registers::x11 };

View File

@ -344,8 +344,10 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
masm.And(x4, x1, Operand(CalleeToken_FunctionConstructing));
masm.Add(x7, x6, x4);
// Copy the number of actual arguments into r8.
masm.mov(r0, r8);
// Calculate the position that our arguments are at before sp gets modified.
MOZ_ASSERT(ArgumentsRectifierReg == r8, "x8 used for argc in Arguments Rectifier");
masm.Add(x3, masm.GetStackPointer64(), Operand(x8, vixl::LSL, 3));
masm.Add(x3, x3, Operand(sizeof(RectifierFrameLayout)));

View File

@ -80,7 +80,6 @@ struct SecondScratchRegisterScope : public AutoRegisterScope
// Use arg reg from EnterJIT function as OsrFrameReg.
static constexpr Register OsrFrameReg = a3;
static constexpr Register ArgumentsRectifierReg = s3;
static constexpr Register CallTempReg0 = t0;
static constexpr Register CallTempReg1 = t1;
static constexpr Register CallTempReg2 = t2;
@ -733,7 +732,8 @@ PatchJump(CodeLocationJump& jump_, CodeLocationLabel label,
void
PatchBackedge(CodeLocationJump& jump_, CodeLocationLabel label, JitZoneGroup::BackedgeTarget target);
typedef js::jit::AssemblerBuffer<1024, Instruction> MIPSBuffer;
static constexpr int32_t SliceSize = 1024;
typedef js::jit::AssemblerBuffer<SliceSize, Instruction> MIPSBuffer;
class MIPSBufferWithExecutableCopy : public MIPSBuffer
{
@ -751,6 +751,11 @@ class MIPSBufferWithExecutableCopy : public MIPSBuffer
bool appendRawCode(const uint8_t* code, size_t numBytes) {
if (this->oom())
return false;
while (numBytes > SliceSize) {
this->putBytes(SliceSize, code);
numBytes -= SliceSize;
code += SliceSize;
}
this->putBytes(numBytes, code);
return !this->oom();
}

View File

@ -1551,7 +1551,7 @@ MacroAssembler::Pop(const ValueOperand& val)
void
MacroAssembler::PopStackPtr()
{
asMasm().ma_load(StackPointer, Address(StackPointer, 0), SizeWord);
loadPtr(Address(StackPointer, 0), StackPointer);
framePushed_ -= sizeof(intptr_t);
}

View File

@ -728,18 +728,16 @@ template <class L>
void
MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Register boundsCheckLimit, L label)
{
MOZ_CRASH("NYI - patching is no longer available");
// BufferOffset bo = ma_BoundsCheck(ScratchRegister);
// append(wasm::BoundsCheck(bo.getOffset()));
// ma_b(index, ScratchRegister, label, cond);
ma_b(index, boundsCheckLimit, label, cond);
}
template <class L>
void
MacroAssembler::wasmBoundsCheck(Condition cond, Register index, Address boundsCheckLimit, L label)
{
MOZ_CRASH("NYI - patching is no longer available");
SecondScratchRegisterScope scratch2(*this);
load32(boundsCheckLimit,SecondScratchReg);
ma_b(index, SecondScratchReg, label, cond);
}
//}}} check_macroassembler_style

View File

@ -26,7 +26,6 @@ static constexpr FloatRegister ScratchSimd128Reg = { FloatRegisters::invalid_reg
static constexpr FloatRegister InvalidFloatReg = { FloatRegisters::invalid_reg };
static constexpr Register OsrFrameReg { Registers::invalid_reg };
static constexpr Register ArgumentsRectifierReg { Registers::invalid_reg };
static constexpr Register PreBarrierReg { Registers::invalid_reg };
static constexpr Register CallTempReg0 { Registers::invalid_reg };
static constexpr Register CallTempReg1 { Registers::invalid_reg };

View File

@ -92,7 +92,6 @@ static constexpr FloatRegister ScratchDoubleReg = FloatRegister(X86Encoding::xmm
static constexpr FloatRegister ScratchSimd128Reg = xmm15;
// Avoid rbp, which is the FramePointer, which is unavailable in some modes.
static constexpr Register ArgumentsRectifierReg = r8;
static constexpr Register CallTempReg0 = rax;
static constexpr Register CallTempReg1 = rdi;
static constexpr Register CallTempReg2 = rbx;

View File

@ -411,13 +411,9 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
MacroAssembler masm(cx);
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- rsp
// '--- #r8 ---'
// ArgumentsRectifierReg contains the |nargs| pushed onto the current frame.
// Including |this|, there are (|nargs| + 1) arguments to copy.
MOZ_ASSERT(ArgumentsRectifierReg == r8);
// Add |this|, in the counter of known arguments.
masm.loadPtr(Address(rsp, RectifierFrameLayout::offsetOfNumActualArgs()), r8);
masm.addl(Imm32(1), r8);
// Load |nformals| into %rcx.
@ -461,8 +457,9 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
// [undef] [undef] [undef] [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]]
// '------- #rcx --------' '------ #r8 -------'
// Copy the number of actual arguments
masm.loadPtr(Address(rsp, RectifierFrameLayout::offsetOfNumActualArgs()), rdx);
// Copy the number of actual arguments into rdx. Use lea to subtract 1 for
// |this|.
masm.lea(Operand(r8, -1), rdx);
masm.moveValue(UndefinedValue(), ValueOperand(r10));

View File

@ -53,7 +53,6 @@ static constexpr FloatRegister ScratchDoubleReg = FloatRegister(X86Encoding::xmm
static constexpr FloatRegister ScratchSimd128Reg = FloatRegister(X86Encoding::xmm7, FloatRegisters::Simd128);
// Avoid ebp, which is the FramePointer, which is unavailable in some modes.
static constexpr Register ArgumentsRectifierReg = esi;
static constexpr Register CallTempReg0 = edi;
static constexpr Register CallTempReg1 = eax;
static constexpr Register CallTempReg2 = ebx;

View File

@ -402,11 +402,9 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
MacroAssembler masm(cx);
// Caller:
// [arg2] [arg1] [this] [[argc] [callee] [descr] [raddr]] <- esp
// '-- #esi ---'
// ArgumentsRectifierReg contains the |nargs| pushed onto the current frame.
// Including |this|, there are (|nargs| + 1) arguments to copy.
MOZ_ASSERT(ArgumentsRectifierReg == esi);
// Load argc.
masm.loadPtr(Address(esp, RectifierFrameLayout::offsetOfNumActualArgs()), esi);
// Load the number of |undefined|s to push into %ecx.
masm.loadPtr(Address(esp, RectifierFrameLayout::offsetOfCalleeToken()), eax);
@ -439,8 +437,8 @@ JitRuntime::generateArgumentsRectifier(JSContext* cx, void** returnAddrOut)
masm.andl(Imm32(~(JitStackValueAlignment - 1)), ecx);
masm.subl(esi, ecx);
// Copy the number of actual arguments.
masm.loadPtr(Address(esp, RectifierFrameLayout::offsetOfNumActualArgs()), edx);
// Copy the number of actual arguments into edx.
masm.mov(esi, edx);
masm.moveValue(UndefinedValue(), ValueOperand(ebx, edi));

View File

@ -416,13 +416,18 @@ ScriptPreloader::InitCache(const nsAString& basePath)
return Ok();
}
// Grab the compilation scope before initializing the URLPreloader, since
// it's not safe to run component loader code during its critical section.
AutoSafeJSAPI jsapi;
JS::RootedObject scope(jsapi.cx(), CompilationScope(jsapi.cx()));
// Note: Code on the main thread *must not access Omnijar in any way* until
// this AutoBeginReading guard is destroyed.
URLPreloader::AutoBeginReading abr;
MOZ_TRY(OpenCache());
return InitCacheInternal();
return InitCacheInternal(scope);
}
Result<Ok, nsresult>
@ -445,7 +450,7 @@ ScriptPreloader::InitCache(const Maybe<ipc::FileDescriptor>& cacheFile, ScriptCa
}
Result<Ok, nsresult>
ScriptPreloader::InitCacheInternal()
ScriptPreloader::InitCacheInternal(JS::HandleObject scope)
{
auto size = mCacheData.size();
@ -520,7 +525,7 @@ ScriptPreloader::InitCacheInternal()
cleanup.release();
}
DecodeNextBatch(OFF_THREAD_FIRST_CHUNK_SIZE);
DecodeNextBatch(OFF_THREAD_FIRST_CHUNK_SIZE, scope);
return Ok();
}
@ -955,7 +960,7 @@ ScriptPreloader::MaybeFinishOffThreadDecode()
}
void
ScriptPreloader::DecodeNextBatch(size_t chunkSize)
ScriptPreloader::DecodeNextBatch(size_t chunkSize, JS::HandleObject scope)
{
MOZ_ASSERT(mParsingSources.length() == 0);
MOZ_ASSERT(mParsingScripts.length() == 0);
@ -1003,7 +1008,7 @@ ScriptPreloader::DecodeNextBatch(size_t chunkSize)
AutoSafeJSAPI jsapi;
JSContext* cx = jsapi.cx();
JSAutoCompartment ac(cx, CompilationScope(cx));
JSAutoCompartment ac(cx, scope ? scope : CompilationScope(cx));
JS::CompileOptions options(cx, JSVERSION_DEFAULT);
options.setNoScriptRval(true)

View File

@ -97,7 +97,7 @@ public:
}
private:
Result<Ok, nsresult> InitCacheInternal();
Result<Ok, nsresult> InitCacheInternal(JS::HandleObject scope = nullptr);
public:
void Trace(JSTracer* trc);
@ -388,7 +388,7 @@ private:
// decodes it synchronously on the main thread, as appropriate.
JSScript* WaitForCachedScript(JSContext* cx, CachedScript* script);
void DecodeNextBatch(size_t chunkSize);
void DecodeNextBatch(size_t chunkSize, JS::HandleObject scope = nullptr);
static void OffThreadDecodeCallback(void* token, void* context);
void MaybeFinishOffThreadDecode();

View File

@ -500,6 +500,16 @@ public:
{
}
// Implicit constructors for char* and char16_t* pointers are deleted in order
// to avoid accidental construction in cases where a pointer does not point to
// a zero-terminated string. A Span<const char> or Span<const char16_t> can be
// obtained for const char* or const char16_t pointing to a zero-terminated
// string using the MakeStringSpan() function.
Span(char* aStr) = delete;
Span(const char* aStr) = delete;
Span(char16_t* aStr) = delete;
Span(const char16_t* aStr) = delete;
/**
* Constructor for std::array.
*/
@ -650,8 +660,9 @@ public:
template<size_t Count>
MOZ_SPAN_GCC_CONSTEXPR Span<element_type, Count> Last() const
{
MOZ_RELEASE_ASSERT(Count <= size());
return { data() + (size() - Count), Count };
const size_t len = size();
MOZ_RELEASE_ASSERT(Count <= len);
return { data() + (len - Count), Count };
}
/**
@ -660,10 +671,11 @@ public:
template<size_t Offset, size_t Count = dynamic_extent>
MOZ_SPAN_GCC_CONSTEXPR Span<element_type, Count> Subspan() const
{
MOZ_RELEASE_ASSERT(Offset <= size() &&
(Count == dynamic_extent || (Offset + Count <= size())));
const size_t len = size();
MOZ_RELEASE_ASSERT(Offset <= len &&
(Count == dynamic_extent || (Offset + Count <= len)));
return { data() + Offset,
Count == dynamic_extent ? size() - Offset : Count };
Count == dynamic_extent ? len - Offset : Count };
}
/**
@ -682,8 +694,9 @@ public:
MOZ_SPAN_GCC_CONSTEXPR Span<element_type, dynamic_extent> Last(
index_type aCount) const
{
MOZ_RELEASE_ASSERT(aCount <= size());
return { data() + (size() - aCount), aCount };
const size_t len = size();
MOZ_RELEASE_ASSERT(aCount <= len);
return { data() + (len - aCount), aCount };
}
/**
@ -693,11 +706,12 @@ public:
index_type aStart,
index_type aLength = dynamic_extent) const
{
MOZ_RELEASE_ASSERT(aStart <= size() &&
const size_t len = size();
MOZ_RELEASE_ASSERT(aStart <= len &&
(aLength == dynamic_extent ||
(aStart + aLength <= size())));
(aStart + aLength <= len)));
return { data() + aStart,
aLength == dynamic_extent ? size() - aStart : aLength };
aLength == dynamic_extent ? len - aStart : aLength };
}
/**
@ -837,9 +851,10 @@ private:
// https://doc.rust-lang.org/std/slice/fn.from_raw_parts.html
, data_(elements ? elements : reinterpret_cast<pointer>(0x1))
{
const size_t extentSize = ExtentType::size();
MOZ_RELEASE_ASSERT(
(!elements && ExtentType::size() == 0) ||
(elements && ExtentType::size() != mozilla::MaxValue<size_t>::value));
(!elements && extentSize == 0) ||
(elements && extentSize != mozilla::MaxValue<size_t>::value));
}
constexpr pointer data() const { return data_; }
@ -971,11 +986,20 @@ MakeSpan(ElementType* aStartPtr, ElementType* aEndPtr)
/**
* Create span from C array.
* MakeSpan() does not permit creating Span objects from string literals (const
* char or char16_t arrays) because the Span length would include the zero
* terminator, which may surprise callers. Use MakeStringSpan() to create a
* Span whose length that excludes the string literal's zero terminator or use
* the MakeSpan() overload that accepts a pointer and length and specify the
* string literal's full length.
*/
template<class ElementType, size_t N>
template<class ElementType, size_t N,
class = span_details::enable_if_t<
!IsSame<ElementType, const char>::value &&
!IsSame<ElementType, const char16_t>::value>>
Span<ElementType> MakeSpan(ElementType (&aArr)[N])
{
return Span<ElementType>(aArr);
return Span<ElementType>(aArr, N);
}
/**

View File

@ -1201,6 +1201,37 @@ SPAN_TEST(from_cstring)
ASSERT_EQ(cs.size(), 3U);
ASSERT_EQ(cs.data(), str);
ASSERT_EQ(cs[2], 'c');
#ifdef CONFIRM_COMPILATION_ERRORS
Span<const char> scccl("literal"); // error
Span<const char> sccel;
sccel = "literal"; // error
cs = MakeSpan("literal"); // error
#endif
}
{
char arr[4] = {'a', 'b', 'c', 0};
auto cs = MakeStringSpan(arr);
ASSERT_EQ(cs.size(), 3U);
ASSERT_EQ(cs.data(), arr);
ASSERT_EQ(cs[2], 'c');
cs = MakeSpan(arr);
ASSERT_EQ(cs.size(), 4U); // zero terminator is part of the array span.
ASSERT_EQ(cs.data(), arr);
ASSERT_EQ(cs[2], 'c');
ASSERT_EQ(cs[3], '\0'); // zero terminator is part of the array span.
#ifdef CONFIRM_COMPILATION_ERRORS
Span<char> scca(arr); // error
Span<const char> sccca(arr); // error
Span<const char> scccea;
scccea = arr; // error
#endif
}
{
char16_t arr[4] = {'a', 'b', 'c', 0};
@ -1210,6 +1241,31 @@ SPAN_TEST(from_cstring)
ASSERT_EQ(cs.size(), 3U);
ASSERT_EQ(cs.data(), str);
ASSERT_EQ(cs[2], 'c');
cs = MakeStringSpan(arr);
ASSERT_EQ(cs.size(), 3U);
ASSERT_EQ(cs.data(), str);
ASSERT_EQ(cs[2], 'c');
cs = MakeSpan(arr);
ASSERT_EQ(cs.size(), 4U); // zero terminator is part of the array span.
ASSERT_EQ(cs.data(), str);
ASSERT_EQ(cs[2], 'c');
ASSERT_EQ(cs[3], '\0'); // zero terminator is part of the array span.
#ifdef CONFIRM_COMPILATION_ERRORS
Span<char16_t> scca(arr); // error
Span<const char16_t> scccea;
scccea = arr; // error
Span<const char16_t> scccl(u"literal"); // error
Span<const char16_t> *sccel;
*sccel = u"literal"; // error
cs = MakeSpan(u"literal"); // error
#endif
}
}

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,10 @@ static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
static mozilla::Module::CIDEntry kPrefCIDs[] = {
{ &kPrefServiceCID, true, nullptr, PreferencesConstructor },
{ &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor },
{ &kPrefLocalizedStringCID,
false,
nullptr,
nsPrefLocalizedStringConstructor },
{ &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
{ nullptr }
};
@ -41,14 +44,12 @@ UnloadPrefsModule()
Preferences::Shutdown();
}
static const mozilla::Module kPrefModule = {
mozilla::Module::kVersion,
kPrefCIDs,
kPrefContracts,
nullptr,
nullptr,
nullptr,
UnloadPrefsModule
};
static const mozilla::Module kPrefModule = { mozilla::Module::kVersion,
kPrefCIDs,
kPrefContracts,
nullptr,
nullptr,
nullptr,
UnloadPrefsModule };
NSMODULE_DEFN(nsPrefModule) = &kPrefModule;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1140,4 +1140,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
static const int32_t kUnknownId = -1;
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1515606006612000);
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1515909924308000);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -56,6 +56,8 @@ class VerifyToolsMixin(object):
return response
dirs = self.query_abs_dirs()
mozinfo.find_and_update_from_json(dirs['abs_test_install_dir'])
manifests = [
(os.path.join(dirs['abs_mochitest_dir'], 'tests', 'mochitest.ini'), 'plain'),
(os.path.join(dirs['abs_mochitest_dir'], 'chrome', 'chrome.ini'), 'chrome'),

View File

@ -653,8 +653,10 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
# preflight_run_tests defined in TestingMixin.
def run_tests(self):
self.start_time = datetime.now()
for category in SUITE_CATEGORIES:
self._run_category_suites(category)
if not self._run_category_suites(category):
break
def get_timeout_for_category(self, suite_category):
if suite_category == 'cppunittest':
@ -669,8 +671,6 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
abs_res_dir = self.query_abs_res_dir()
max_verify_time = timedelta(minutes=60)
verify_time_exceeded = False
start_time = datetime.now()
if suites:
self.info('#### Running %s suites' % suite_category)
@ -759,14 +759,15 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
cmd_timeout = self.get_timeout_for_category(suite_category)
for verify_args in self.query_verify_args(suite):
if (datetime.now() - start_time) > max_verify_time:
if (datetime.now() - self.start_time) > max_verify_time:
# Verification has run out of time. That is okay! Stop running
# tests so that a task timeout is not triggered, and so that
# (partial) results are made available in a timely manner.
self.info("TinderboxPrint: Verification too long: Not all tests were verified.<br/>")
# Signal verify time exceeded, to break out of suites loop also.
verify_time_exceeded = True
break
# Signal verify time exceeded, to break out of suites and
# suite categories loops also.
return False
final_cmd = copy.copy(cmd)
final_cmd.extend(verify_args)
return_code = self.run_command(final_cmd, cwd=dirs['abs_work_dir'],
@ -799,12 +800,9 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
else:
self.log("The %s suite: %s ran with return status: %s" %
(suite_category, suite, tbpl_status), level=log_level)
if verify_time_exceeded:
# Verification ran out of time, detected in inner loop.
break
else:
self.debug('There were no suites to run for %s' % suite_category)
return True
# main {{{1

View File

@ -1143,7 +1143,7 @@ BookmarkExporter.prototype = {
if (aItem.charset)
this._writeAttribute("LAST_CHARSET", escapeHtmlEntities(aItem.charset));
if (aItem.tags)
this._writeAttribute("TAGS", aItem.tags);
this._writeAttribute("TAGS", escapeHtmlEntities(aItem.tags));
this._writeLine(">" + escapeHtmlEntities(aItem.title) + "</A>");
this._writeDescription(aItem, aIndent);
},

View File

@ -0,0 +1,81 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Checks that html entities are escaped in bookmarks.html files.
const DESCRIPTION_ANNO = "bookmarkProperties/description";
add_task(async function() {
// Removes bookmarks.html if the file already exists.
let HTMLFile = OS.Path.join(OS.Constants.Path.profileDir, "bookmarks.html");
if ((await OS.File.exists(HTMLFile))) {
await OS.File.remove(HTMLFile);
}
let unescaped = '<unescaped="test">';
// Adds bookmarks and tags to the database.
const url = 'http://www.google.it/"/';
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url,
title: unescaped
});
await PlacesUtils.keywords.insert({ url, keyword: unescaped, postData: unescaped })
let uri = Services.io.newURI(url);
PlacesUtils.tagging.tagURI(uri, [unescaped]);
await PlacesUtils.setCharsetForURI(uri, unescaped);
PlacesUtils.annotations.setItemAnnotation(
await PlacesUtils.promiseItemId(bm.guid),
DESCRIPTION_ANNO, unescaped, 0, PlacesUtils.annotations.EXPIRE_NEVER);
// Exports the bookmarks as a HTML file.
await BookmarkHTMLUtils.exportToFile(HTMLFile);
await PlacesUtils.bookmarks.remove(bm);
// Check there are no unescaped entities in the html file.
let xml = await new Promise((resolve, reject) => {
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
xhr.onload = () => {
try {
resolve(xhr.responseXML);
} catch (e) {
reject(e);
}
};
xhr.onabort = xhr.onerror = xhr.ontimeout = () => {
reject(new Error("xmlhttprequest failed"));
};
xhr.open("GET", OS.Path.toFileURI(HTMLFile));
xhr.responseType = "document";
xhr.overrideMimeType("text/html");
xhr.send();
});
let checksCount = 6;
for (let current = xml; current;
current = current.firstChild || current.nextSibling || current.parentNode.nextSibling) {
switch (current.nodeType) {
case Ci.nsIDOMNode.ELEMENT_NODE:
for (let {name, value} of current.attributes) {
do_print("Found attribute: " + name);
// Check tags, keyword, postData and charSet.
if (["tags", "last_charset", "shortcuturl", "post_data"].includes(name)) {
Assert.equal(value, unescaped, `Attribute ${name} should be complete`);
checksCount--;
}
}
break;
case Ci.nsIDOMNode.TEXT_NODE:
// Check Title and description.
if (!current.data.startsWith("\n") && !current.data.includes("Bookmarks")) {
Assert.equal(current.data.trim(), unescaped, "Text node should be complete");
checksCount--;
}
break;
}
}
Assert.equal(checksCount, 0, "All the checks ran")
});

View File

@ -65,6 +65,7 @@ skip-if = (os == "win" && os_version == "5.1") # Bug 1158887
[test_bookmarks_json.js]
[test_bookmarks_html.js]
[test_bookmarks_html_corrupt.js]
[test_bookmarks_html_escape_entities.js]
[test_bookmarks_html_import_tags.js]
[test_bookmarks_html_singleframe.js]
[test_bookmarks_restore_notification.js]