Merge m-c to autoland, a=merge

MozReview-Commit-ID: DwtKxCKV42X
This commit is contained in:
Wes Kocher 2017-03-24 17:20:07 -07:00
commit 04968c7c99
195 changed files with 2678 additions and 964 deletions

View File

@ -698,12 +698,8 @@ ContentLinkHandler.init(this);
// TODO: Load this lazily so the JSM is run only if a relevant event/message fires.
var pluginContent = new PluginContent(global);
addEventListener("DOMWebNotificationClicked", function(event) {
sendAsyncMessage("DOMWebNotificationClicked", {});
}, false);
addEventListener("DOMServiceWorkerFocusClient", function(event) {
sendAsyncMessage("DOMServiceWorkerFocusClient", {});
addEventListener("DOMWindowFocus", function(event) {
sendAsyncMessage("DOMWindowFocus", {});
}, false);
ContentWebRTC.init();

View File

@ -2709,7 +2709,7 @@
// This call actually closes the window, unless the user
// cancels the operation. We are finished here in both cases.
this._windowIsClosing = window.closeWindow(true, window.warnAboutClosingWindow);
return null;
return false;
}
newTab = true;
@ -5011,8 +5011,7 @@
popup.openPopupAtScreen(event.screenX, event.screenY, true);
break;
}
case "DOMServiceWorkerFocusClient":
case "DOMWebNotificationClicked": {
case "DOMWindowFocus": {
let tab = this.getTabForBrowser(browser);
if (!tab)
return undefined;
@ -5244,8 +5243,7 @@
this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID,
this.mCurrentBrowser);
}
messageManager.addMessageListener("DOMWebNotificationClicked", this);
messageManager.addMessageListener("DOMServiceWorkerFocusClient", this);
messageManager.addMessageListener("DOMWindowFocus", this);
messageManager.addMessageListener("RefreshBlocker:Blocked", this);
messageManager.addMessageListener("Browser:WindowCreated", this);

View File

@ -73,6 +73,7 @@ run-if = e10s && crashreporter
skip-if = debug # bug 1167933
[browser_async_remove_tab.js]
run-if = e10s
skip-if = debug # bug 1211084
[browser_attributes.js]
[browser_backup_recovery.js]
[browser_broadcast.js]

View File

@ -1,3 +1,3 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.7.367
Current extension version is: 1.7.381

View File

@ -3667,8 +3667,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}
};
}();
exports.version = '1.7.367';
exports.build = 'f0c45f03';
exports.version = '1.7.381';
exports.build = '68f2bf3b';
exports.getDocument = getDocument;
exports.PDFDataRangeTransport = PDFDataRangeTransport;
exports.PDFWorker = PDFWorker;
@ -4685,8 +4685,8 @@ if (!globalScope.PDFJS) {
globalScope.PDFJS = {};
}
var PDFJS = globalScope.PDFJS;
PDFJS.version = '1.7.367';
PDFJS.build = 'f0c45f03';
PDFJS.version = '1.7.381';
PDFJS.build = '68f2bf3b';
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
sharedUtil.setVerbosityLevel(PDFJS.verbosity);
@ -7186,8 +7186,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.7.367';
var pdfjsBuild = 'f0c45f03';
var pdfjsVersion = '1.7.381';
var pdfjsBuild = '68f2bf3b';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);

View File

@ -26016,7 +26016,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
assert(isStream(xobj), 'XObject should be a stream');
var type = xobj.dict.get('Subtype');
assert(isName(type), 'XObject should have a Name subtype');
if ('Form' !== type.name) {
if (type.name !== 'Form') {
xobjsCache.key = name;
xobjsCache.texts = null;
break;
@ -27777,7 +27777,7 @@ var JpxImage = function JpxImageClosure() {
this.parseCodestream(data, position, position + dataLength);
break;
case 0x6A502020:
if (0x0d0a870a !== readUint32(data, position)) {
if (readUint32(data, position) !== 0x0d0a870a) {
warn('Invalid JP2 signature');
}
break;
@ -29884,6 +29884,9 @@ var Catalog = function CatalogClosure() {
try {
metadata = stringToUTF8String(bytesToString(stream.getBytes()));
} catch (e) {
if (e instanceof MissingDataException) {
throw e;
}
info('Skipping invalid metadata.');
}
}
@ -37756,6 +37759,9 @@ var PDFDocument = function PDFDocumentClosure() {
}
}
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
}
info('Something wrong with AcroForm entry');
this.acroForm = null;
}
@ -37869,6 +37875,9 @@ var PDFDocument = function PDFDocumentClosure() {
try {
infoDict = this.xref.trailer.get('Info');
} catch (err) {
if (err instanceof MissingDataException) {
throw err;
}
info('The document information dictionary is invalid.');
}
if (infoDict) {
@ -43370,6 +43379,7 @@ exports.Jbig2Image = Jbig2Image;
"use strict";
var sharedUtil = __w_pdfjs_require__(0);
var warn = sharedUtil.warn;
var error = sharedUtil.error;
var JpegImage = function JpegImageClosure() {
var dctZigZag = new Uint8Array([
@ -43692,23 +43702,21 @@ var JpegImage = function JpegImageClosure() {
} else {
mcuExpected = mcusPerLine * frame.mcusPerColumn;
}
if (!resetInterval) {
resetInterval = mcuExpected;
}
var h, v;
while (mcu < mcuExpected) {
var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
for (i = 0; i < componentsLength; i++) {
components[i].pred = 0;
}
eobrun = 0;
if (componentsLength === 1) {
component = components[0];
for (n = 0; n < resetInterval; n++) {
for (n = 0; n < mcuToRead; n++) {
decodeBlock(component, decodeFn, mcu);
mcu++;
}
} else {
for (n = 0; n < resetInterval; n++) {
for (n = 0; n < mcuToRead; n++) {
for (i = 0; i < componentsLength; i++) {
component = components[i];
h = component.h;
@ -43910,8 +43918,23 @@ var JpegImage = function JpegImageClosure() {
return value;
}
function readDataBlock() {
function isValidMarkerAt(pos) {
if (pos < data.length - 1) {
return data[pos] === 0xFF && data[pos + 1] >= 0xC0 && data[pos + 1] <= 0xFE;
}
return true;
}
var length = readUint16();
var array = data.subarray(offset, offset + length - 2);
var endOffset = offset + length - 2;
if (!isValidMarkerAt(endOffset)) {
warn('readDataBlock - incorrect length, next marker is: ' + (data[endOffset] << 8 | data[endOffset + 1]).toString('16'));
var pos = offset;
while (!isValidMarkerAt(pos)) {
pos++;
}
endOffset = pos;
}
var array = data.subarray(offset, endOffset);
offset += array.length;
return array;
}
@ -49132,8 +49155,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.7.367';
var pdfjsBuild = 'f0c45f03';
var pdfjsVersion = '1.7.381';
var pdfjsBuild = '68f2bf3b';
var pdfjsCoreWorker = __w_pdfjs_require__(17);
;
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

View File

@ -389,11 +389,6 @@ welcome.search=%S to search for sources
# prompt for searching for files.
sourceSearch.search=Search Sources…
# LOCALIZATION NOTE (sourceSearch.search): The center pane Source Search
# prompt for searching for files.
# Used in the old debugger fronted
sourceSearch.search=Search…
# LOCALIZATION NOTE (sourceSearch.noResults): The center pane Source Search
# message when the query did not match any of the sources.
sourceSearch.noResults=No files matching %S found

View File

@ -7,7 +7,7 @@
* Tests Curl Utils functionality.
*/
const { CurlUtils } = require("devtools/client/shared/curl");
const { Curl, CurlUtils } = require("devtools/client/shared/curl");
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CURL_UTILS_URL);
@ -39,6 +39,7 @@ add_task(function* () {
data = yield createCurlData(requests.post, getLongString);
testIsUrlEncodedRequest(data);
testWritePostDataTextParams(data);
testDataArgumentOnGeneratedCommand(data);
data = yield createCurlData(requests.multipart, getLongString);
testIsMultipartRequest(data);
@ -100,6 +101,12 @@ function testWritePostDataTextParams(data) {
"Should return a serialized representation of the request parameters");
}
function testDataArgumentOnGeneratedCommand(data) {
let curlCommand = Curl.generateCommand(data);
ok(curlCommand.includes("--data"),
"Should return a curl command with --data");
}
function testGetMultipartBoundary(data) {
let boundary = CurlUtils.getMultipartBoundary(data);
ok(/-{3,}\w+/.test(boundary),

View File

@ -76,7 +76,8 @@ const Curl = {
// Create post data.
let postData = [];
if (utils.isUrlEncodedRequest(data) || data.method == "PUT") {
if (utils.isUrlEncodedRequest(data) ||
["PUT", "POST"].includes(data.method)) {
postDataText = data.postDataText;
postData.push("--data");
postData.push(escapeString(utils.writePostDataTextParams(postDataText)));

View File

@ -10199,6 +10199,19 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// window will need to be made visible... For now,
// do nothing.
}
// Switch to target tab if we're currently focused window.
// Take loadDivertedInBackground into account so the behavior would be
// the same as how the tab first opened.
bool isTargetActive = false;
targetDocShell->GetIsActive(&isTargetActive);
if (mIsActive && !isTargetActive &&
!Preferences::GetBool("browser.tabs.loadDivertedInBackground", false)) {
if (NS_FAILED(nsContentUtils::DispatchFocusChromeEvent(
targetDocShell->GetWindow()))) {
return NS_ERROR_FAILURE;
}
}
}
// Else we ran out of memory, or were a popup and got blocked,

View File

@ -12,6 +12,7 @@
#include "mozilla/dom/WebSocketBinding.h" // for BinaryType
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Mutex.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupports.h"

View File

@ -4127,7 +4127,7 @@ nsContentUtils::DispatchFocusChromeEvent(nsPIDOMWindowOuter* aWindow)
}
return DispatchChromeEvent(doc, aWindow,
NS_LITERAL_STRING("DOMServiceWorkerFocusClient"),
NS_LITERAL_STRING("DOMWindowFocus"),
true, true);
}
@ -10080,3 +10080,36 @@ nsContentUtils::HtmlObjectContentTypeForMIMEType(const nsCString& aMIMEType,
return nsIObjectLoadingContent::TYPE_NULL;
}
/* static */ already_AddRefed<Dispatcher>
nsContentUtils::GetDispatcherByLoadInfo(nsILoadInfo* aLoadInfo)
{
if (NS_WARN_IF(!aLoadInfo)) {
return nullptr;
}
nsCOMPtr<nsIDOMDocument> domDoc;
aLoadInfo->GetLoadingDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
RefPtr<Dispatcher> dispatcher;
if (doc) {
dispatcher = doc->GetDocGroup();
} else {
// There's no document yet, but this might be a top-level load where we can
// find a TabGroup.
uint64_t outerWindowId;
if (NS_FAILED(aLoadInfo->GetOuterWindowID(&outerWindowId))) {
// No window. This might be an add-on XHR, a service worker request, or
// something else.
return nullptr;
}
RefPtr<nsGlobalWindow> window = nsGlobalWindow::GetOuterWindowWithId(outerWindowId);
if (!window) {
return nullptr;
}
dispatcher = window->TabGroup();
}
return dispatcher.forget();
}

View File

@ -72,6 +72,7 @@ class nsIImageLoadingContent;
class nsIInterfaceRequestor;
class nsIIOService;
class nsILineBreaker;
class nsILoadInfo;
class nsILoadGroup;
class nsIMessageBroadcaster;
class nsNameSpaceManager;
@ -115,6 +116,7 @@ template<class K, class V> class nsRefPtrHashtable;
template<class T> class nsReadingIterator;
namespace mozilla {
class Dispatcher;
class ErrorResult;
class EventListenerManager;
@ -1256,7 +1258,7 @@ public:
bool *aDefaultAction = nullptr);
/**
* Helper function for dispatching a "DOMServiceWorkerFocusClient" event to
* Helper function for dispatching a "DOMWindowFocus" event to
* the chrome event handler of the given DOM Window. This has the effect
* of focusing the corresponding tab and bringing the browser window
* to the foreground.
@ -2815,6 +2817,9 @@ public:
HtmlObjectContentTypeForMIMEType(const nsCString& aMIMEType,
nsIContent* aContent);
static already_AddRefed<mozilla::Dispatcher>
GetDispatcherByLoadInfo(nsILoadInfo* aLoadInfo);
private:
static bool InitializeEventTable();

View File

@ -6,6 +6,9 @@ support-files =
file_audioLoopInIframe.html
file_bug1011748_redirect.sjs
file_bug1011748_OK.sjs
file_bug1303838.html
file_bug1303838_target.html
file_bug1303838_with_iframe.html
file_messagemanager_unload.html
file_pluginAudio.html
file_use_counter_outer.html
@ -33,3 +36,4 @@ skip-if = true # Bug 1271028
[browser_use_counters.js]
[browser_bug1307747.js]
[browser_timeout_throttling_with_audio_playback.js]
[browser_bug1303838.js]

View File

@ -0,0 +1,162 @@
/* -*- Mode: JavaScript; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Test for bug 1303838.
* Load a tab with some links, emulate link clicks and check if the
* browser would switch to the existing target tab opened by previous
* link click if loadDivertedInBackground is set to true.
*/
"use strict";
const BASE_URL = "http://mochi.test:8888/browser/dom/base/test/";
add_task(function*() {
yield* testLinkClick(false, false);
yield* testLinkClick(false, true);
yield* testLinkClick(true, false);
yield* testLinkClick(true, true);
});
function* testLinkClick(withFrame, loadDivertedInBackground) {
yield SpecialPowers.pushPrefEnv({"set": [["browser.tabs.loadDivertedInBackground", loadDivertedInBackground]]});
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser,
BASE_URL + (withFrame ? "file_bug1303838_with_iframe.html" : "file_bug1303838.html"));
is(gBrowser.tabs.length, 2, "check tabs.length");
is(gBrowser.selectedTab, tab, "check selectedTab");
info("Test normal links with loadDivertedInBackground=" + loadDivertedInBackground + ", withFrame=" + withFrame);
let [testTab] = yield clickLink(withFrame, "#link-1", tab.linkedBrowser);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#link-2", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#link-3", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#link-4", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground, 2);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
info("Test anchor links with loadDivertedInBackground=" + loadDivertedInBackground + ", withFrame=" + withFrame);
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#anchor-link-1", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#anchor-link-2", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#anchor-link-3", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
info("Test iframe links with loadDivertedInBackground=" + loadDivertedInBackground + ", withFrame=" + withFrame);
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#frame-link-1", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#frame-link-2", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
if (!loadDivertedInBackground) {
yield BrowserTestUtils.switchTab(gBrowser, tab);
}
yield clickLink(withFrame, "#frame-link-3", tab.linkedBrowser, testTab.linkedBrowser, !loadDivertedInBackground);
is(gBrowser.tabs.length, 3, "check tabs.length");
is(gBrowser.selectedTab, loadDivertedInBackground ? tab : testTab, "check selectedTab");
yield BrowserTestUtils.removeTab(testTab);
yield BrowserTestUtils.removeTab(tab);
}
function clickLink(isFrame, linkId, browser, testBrowser, awaitTabSwitch = false, locationChangeNum = 1) {
let promises = [];
if (awaitTabSwitch) {
promises.push(waitForTabSwitch(gBrowser));
}
promises.push(testBrowser ?
waitForLocationChange(testBrowser, locationChangeNum) :
BrowserTestUtils.waitForNewTab(gBrowser));
promises.push(ContentTask.spawn(browser, [isFrame, linkId],
([contentIsFrame, contentLinkId]) => {
let doc = content.document;
if (contentIsFrame) {
let frame = content.document.getElementById("frame");
doc = frame.contentDocument;
}
info("Clicking " + contentLinkId);
doc.querySelector(contentLinkId).click();
}));
return Promise.all(promises);
}
function waitForTabSwitch(tabbrowser) {
info("Waiting for TabSwitch");
return new Promise(resolve => {
tabbrowser.addEventListener("TabSwitchDone", function onSwitch() {
info("TabSwitch done");
tabbrowser.removeEventListener("TabSwitchDone", onSwitch);
resolve(tabbrowser.selectedTab);
});
});
}
// We need a longer lifetime reference to ensure the listener is alive when
// location change occurs.
let locationChangeListener;
function waitForLocationChange(browser, locationChangeNum) {
info("Waiting for " + locationChangeNum + " LocationChange");
return new Promise(resolve => {
let seen = 0;
locationChangeListener = {
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
info("LocationChange: " + aLocation.spec);
if (++seen == locationChangeNum) {
browser.removeProgressListener(this);
resolve();
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
Ci.nsISupportsWeakReference])
};
browser.addProgressListener(locationChangeListener);
});
}

View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html>
<!--
Tests for tab switching on link clicks.
-->
<head>
<meta charset="utf-8">
<title>Tests for tab switching on link clicks.</title>
</head>
<body>
<a id="link-1" target="testTab" href="data:text/html;charset=utf-8,foo">Link 1</a><br>
<a id="link-2" target="testTab" href="data:text/html;charset=utf-8,bar">Link 2</a><br>
<a id="link-3" target="testTab" href="data:text/html;charset=utf-8,baz">Link 3</a><br>
<a id="link-4" target="testTab" href="file_bug1303838_target.html">Link 4</a><br>
<a id="anchor-link-1" target="testTab" href="file_bug1303838_target.html#foo">Anchor Link 1</a><br>
<a id="anchor-link-2" target="testTab" href="file_bug1303838_target.html#bar">Anchor Link 2</a><br>
<a id="anchor-link-3" target="testTab" href="file_bug1303838_target.html#baz">Anchor Link 3</a><br>
<a id="frame-link-1" target="testFrame" href="data:text/html;charset=utf-8,ifoo">Frame Link 1</a><br>
<a id="frame-link-2" target="testFrame" href="data:text/html;charset=utf-8,ibar">Frame Link 2</a><br>
<a id="frame-link-3" target="testFrame" href="data:text/html;charset=utf-8,ibaz">Frame Link 3</a><br>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html>
<!--
Tests for tab switching on link clicks.
-->
<head>
<meta charset="utf-8">
<title>Tests for tab switching on link clicks.</title>
</head>
<body onload="setTimeout(loadTestFrame, 0);">
<div id="foo">Foo</div>
<div id="bar">Bar</div>
<div id="baz">Baz</div>
<iframe name="testFrame"></iframe>
<script>
function loadTestFrame() {
window.open("data:text/html;charset=utf-8,testFrame", "testFrame");
}
</script>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<!--
Tests for tab switching on link clicks.
-->
<head>
<meta charset="utf-8">
<title>Tests for tab switching on link clicks.</title>
</head>
<body>
<iframe id="frame" src="file_bug1303838.html"></iframe>
</body>
</html>

View File

@ -25,7 +25,6 @@
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/RootedDictionary.h"
#include "mozilla/SegmentedVector.h"
#include "mozilla/dom/workers/Workers.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Likely.h"
#include "mozilla/MemoryReporting.h"

View File

@ -74,7 +74,7 @@ DocumentRendererChild::RenderDocument(nsPIDOMWindowOuter* window,
data.SetLength(renderSize.width * renderSize.height * 4);
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
Factory::CreateDrawTargetForData(gfxPlatform::GetPlatform()->GetSoftwareBackend(),
reinterpret_cast<uint8_t*>(data.BeginWriting()),
IntSize(renderSize.width, renderSize.height),
4 * renderSize.width,

View File

@ -110,7 +110,7 @@ ImageBitmapRenderingContext::MatchWithIntrinsicSize()
}
RefPtr<DrawTarget> dt =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
Factory::CreateDrawTargetForData(gfxPlatform::GetPlatform()->GetSoftwareBackend(),
map.GetData(),
temp->GetSize(),
map.GetStride(),

View File

@ -1981,7 +1981,7 @@ WebGLContext::GetSurfaceSnapshot(bool* out_premultAlpha)
}
RefPtr<DrawTarget> dt =
Factory::CreateDrawTarget(BackendType::CAIRO,
Factory::CreateDrawTarget(gfxPlatform::GetPlatform()->GetSoftwareBackend(),
IntSize(mWidth, mHeight),
SurfaceFormat::B8G8R8A8);

View File

@ -245,24 +245,11 @@ Event::WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
NS_IMETHODIMP
Event::GetType(nsAString& aType)
{
if (!mIsMainThreadEvent || !mEvent->mSpecifiedEventTypeString.IsEmpty()) {
if (!mIsMainThreadEvent) {
aType = mEvent->mSpecifiedEventTypeString;
return NS_OK;
}
const char* name = GetEventName(mEvent->mMessage);
if (name) {
CopyASCIItoUTF16(name, aType);
return NS_OK;
} else if (mEvent->mMessage == eUnidentifiedEvent &&
mEvent->mSpecifiedEventType) {
// Remove "on"
aType = Substring(nsDependentAtomString(mEvent->mSpecifiedEventType), 2);
mEvent->mSpecifiedEventTypeString = aType;
return NS_OK;
}
aType.Truncate();
GetWidgetEventType(mEvent, aType);
return NS_OK;
}
@ -1291,6 +1278,30 @@ Event::GetShadowRelatedTarget(nsIContent* aCurrentTarget,
return nullptr;
}
void
Event::GetWidgetEventType(WidgetEvent* aEvent, nsAString& aType)
{
if (!aEvent->mSpecifiedEventTypeString.IsEmpty()) {
aType = aEvent->mSpecifiedEventTypeString;
return;
}
const char* name = GetEventName(aEvent->mMessage);
if (name) {
CopyASCIItoUTF16(name, aType);
return;
} else if (aEvent->mMessage == eUnidentifiedEvent &&
aEvent->mSpecifiedEventType) {
// Remove "on"
aType = Substring(nsDependentAtomString(aEvent->mSpecifiedEventType), 2);
aEvent->mSpecifiedEventTypeString = aType;
return;
}
aType.Truncate();
}
NS_IMETHODIMP
Event::GetCancelBubble(bool* aCancelBubble)
{

View File

@ -265,6 +265,14 @@ public:
mEvent->mSpecifiedEventType = nullptr;
}
/**
* For WidgetEvent, return it's type in string.
*
* @param aEvent is a WidgetEvent to get its type.
* @param aType is a string where to return the type.
*/
static void GetWidgetEventType(WidgetEvent* aEvent, nsAString& aType);
protected:
// Internal helper functions

View File

@ -64,6 +64,7 @@
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Likely.h"
using namespace mozilla::tasktracer;
#endif
@ -606,23 +607,27 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
NS_ERROR_DOM_INVALID_STATE_ERR);
#ifdef MOZ_TASK_TRACER
{
if (MOZ_UNLIKELY(mozilla::tasktracer::IsStartLogging())) {
nsAutoCString eventType;
nsAutoString eventTypeU16;
if (aDOMEvent) {
nsAutoString eventType;
aDOMEvent->GetType(eventType);
nsCOMPtr<Element> element = do_QueryInterface(aTarget);
nsAutoString elementId;
nsAutoString elementTagName;
if (element) {
element->GetId(elementId);
element->GetTagName(elementTagName);
}
AddLabel("Event [%s] dispatched at target [id:%s tag:%s]",
NS_ConvertUTF16toUTF8(eventType).get(),
NS_ConvertUTF16toUTF8(elementId).get(),
NS_ConvertUTF16toUTF8(elementTagName).get());
aDOMEvent->GetType(eventTypeU16);
} else {
Event::GetWidgetEventType(aEvent, eventTypeU16);
}
eventType = NS_ConvertUTF16toUTF8(eventTypeU16);
nsCOMPtr<Element> element = do_QueryInterface(aTarget);
nsAutoString elementId;
nsAutoString elementTagName;
if (element) {
element->GetId(elementId);
element->GetTagName(elementTagName);
}
AddLabel("Event [%s] dispatched at target [id:%s tag:%s]",
eventType.get(),
NS_ConvertUTF16toUTF8(elementId).get(),
NS_ConvertUTF16toUTF8(elementTagName).get());
}
#endif

View File

@ -7,6 +7,8 @@
#ifndef mozilla_DeviceChangeCallback_h
#define mozilla_DeviceChangeCallback_h
#include "mozilla/Mutex.h"
namespace mozilla {
class DeviceChangeCallback

View File

@ -14,15 +14,16 @@
namespace mozilla {
namespace workers {
class WorkerPrivate;
} // namespace workers
namespace hal {
class NetworkInformation;
} // namespace hal
namespace dom {
namespace workers {
class WorkerPrivate;
} // namespace workers
namespace network {
class Connection : public DOMEventTargetHelper

View File

@ -322,14 +322,9 @@ public:
return NS_OK;
}
nsIDocument* doc = mWindow->GetExtantDoc();
if (doc) {
// Browser UI may use DOMWebNotificationClicked to focus the tab
// from which the event was dispatched.
nsContentUtils::DispatchChromeEvent(doc, mWindow->GetOuterWindow(),
NS_LITERAL_STRING("DOMWebNotificationClicked"),
true, true);
}
// Browser UI may use DOMWindowFocus to focus the tab
// from which the event was dispatched.
nsContentUtils::DispatchFocusChromeEvent(mWindow->GetOuterWindow());
return NS_OK;
}
@ -1500,14 +1495,9 @@ MainThreadNotificationObserver::Observe(nsISupports* aSubject, const char* aTopi
bool doDefaultAction = notification->DispatchClickEvent();
if (doDefaultAction) {
nsIDocument* doc = window ? window->GetExtantDoc() : nullptr;
if (doc) {
// Browser UI may use DOMWebNotificationClicked to focus the tab
// from which the event was dispatched.
nsContentUtils::DispatchChromeEvent(doc, window->GetOuterWindow(),
NS_LITERAL_STRING("DOMWebNotificationClicked"),
true, true);
}
// Browser UI may use DOMWindowFocus to focus the tab
// from which the event was dispatched.
nsContentUtils::DispatchFocusChromeEvent(window->GetOuterWindow());
}
} else if (!strcmp("alertfinished", aTopic)) {
notification->UnpersistNotification();

View File

@ -17,6 +17,7 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsIOfflineCacheUpdate.h"
#include "nsContentUtils.h"
#include "nsILoadContext.h"
#include "nsIObserverService.h"
#include "nsIScriptGlobalObject.h"
#include "nsIWebNavigation.h"

View File

@ -14,6 +14,7 @@
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsILoadContext.h"
#include "nsIPrivateBrowsingChannel.h"
#include "nsComponentManagerUtils.h"
#include "nsIComponentRegistrar.h"

View File

@ -8,6 +8,7 @@
#define mozilla_dom_workers_serviceworkerinfo_h
#include "mozilla/dom/ServiceWorkerBinding.h" // For ServiceWorkerState
#include "mozilla/dom/workers/Workers.h"
#include "nsIServiceWorkerManager.h"
namespace mozilla {

View File

@ -384,14 +384,6 @@ GetWorkerCrossThreadDispatcher(JSContext* aCx, const JS::Value& aWorker);
// Random unique constant to facilitate JSPrincipal debugging
const uint32_t kJSPrincipalsDebugToken = 0x7e2df9d2;
namespace exceptions {
// Implemented in Exceptions.cpp
void
ThrowDOMExceptionForNSResult(JSContext* aCx, nsresult aNSResult);
} // namespace exceptions
bool
IsWorkerGlobal(JSObject* global);

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "XMLHttpRequestString.h"
#include "mozilla/Mutex.h"
#include "nsISupportsImpl.h"
#include "mozilla/dom/DOMString.h"

View File

@ -7,12 +7,10 @@
#ifndef mozilla_dom_XMLHttpRequestString_h
#define mozilla_dom_XMLHttpRequestString_h
#include "mozilla/Mutex.h"
#include "nsString.h"
namespace mozilla {
class Mutex;
namespace dom {
class DOMString;

View File

@ -1,4 +1,3 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
# include the XUL reftests
include xul/reftest-stylo.list
@ -83,7 +82,7 @@ fails needs-focus == spellcheck-non-latin-japanese.html spellcheck-non-latin-jap
fails needs-focus == spellcheck-non-latin-korean.html spellcheck-non-latin-korean.html
fails == unneeded_scroll.html unneeded_scroll.html
== caret_on_presshell_reinit.html caret_on_presshell_reinit.html
== caret_on_presshell_reinit-2.html caret_on_presshell_reinit-2.html
asserts-if(stylo&&isDebugBuild,0-2) fuzzy-if(stylo,255,3) == caret_on_presshell_reinit-2.html caret_on_presshell_reinit-2.html
fails == 642800.html 642800.html
fails == selection_visibility_after_reframe.html selection_visibility_after_reframe.html
fails == selection_visibility_after_reframe-2.html selection_visibility_after_reframe-2.html

View File

@ -296,8 +296,11 @@ void MessageLoop::PostTask_Helper(already_AddRefed<Runnable> task, int delay_ms)
}
#ifdef MOZ_TASK_TRACER
RefPtr<Runnable> tracedTask = mozilla::tasktracer::CreateTracedRunnable(Move(task));
(static_cast<mozilla::tasktracer::TracedRunnable*>(tracedTask.get()))->DispatchTask();
RefPtr<Runnable> tracedTask = task;
if (mozilla::tasktracer::IsStartLogging()) {
tracedTask = mozilla::tasktracer::CreateTracedRunnable(Move(task));
(static_cast<mozilla::tasktracer::TracedRunnable*>(tracedTask.get()))->DispatchTask();
}
PendingTask pending_task(tracedTask.forget(), true);
#else
PendingTask pending_task(Move(task), true);

View File

@ -21,7 +21,7 @@
#ifdef MOZ_TASK_TRACER
using namespace mozilla::tasktracer;
#define MSG_HEADER_SZ (GetOrCreateTraceInfo() == nullptr ? \
#define MSG_HEADER_SZ (IsStartLogging() && GetOrCreateTraceInfo() == nullptr ? \
sizeof(Header) : sizeof(HeaderTaskTracer))
#else
#define MSG_HEADER_SZ sizeof(Header)

View File

@ -4,6 +4,9 @@
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "JavaScript Engine")
XPIDL_SOURCES += [
'IJSDebugger.idl',
]

13
js/moz.build Normal file
View File

@ -0,0 +1,13 @@
component_engine = ('Core', 'JavaScript Engine')
component_gc = ('Core', 'JavaScript: GC')
component_jit = ('Core', 'JavaScript Engine: JIT')
with Files("**"):
BUG_COMPONENT = component_engine
for header in ('GCAnnotations.h', 'GCAPI.h', 'HeapAPI.h', 'RootingAPI.h', 'SliceBudget.h', 'SweepingAPI.h', 'TraceKind.h', 'TracingAPI.h', 'WeakMapPtr.h', 'GCHashTable.h', 'GCPolicyAPI.h', 'GCVariant.h', 'GCVector.h'):
with Files('public/' + header):
BUG_COMPONENT = component_gc
with Files('public/TrackedOptimizationInfo.h'):
BUG_COMPONENT = component_jit

View File

@ -0,0 +1,2 @@
for (var i=0; i<40; i++)
assertEq(typeof objectEmulatingUndefined(), "undefined");

View File

@ -0,0 +1,32 @@
// |jit-test| exitstatus: 6;
// Don't include wasm.js in timeout tests: when wasm isn't supported, it will
// quit(0) which will cause the test to fail.
if (!wasmIsSupported())
quit(6);
newGlobal().Debugger().addDebuggee(this);
var t = new WebAssembly.Table({
initial: 1,
element: "anyfunc"
});
new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
(module
(func $iloop loop $top br $top end)
(import "imports" "t" (table1 anyfunc))
(elem (i32.const0) $iloop))
`)), { imports: { t } });
outer = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
(module
(import "imports" "t" (table1 anyfunc))
(type $v2v (func))
(func (export "run")
i32.const0
call_indirect $v2v)
)`)), { imports: { t } });
timeout(1);
outer.exports.run();

View File

@ -4328,6 +4328,9 @@ DoTypeOfFallback(JSContext* cx, BaselineFrame* frame, ICTypeOf_Fallback* stub, H
res.setString(string);
if (stub->numOptimizedStubs() >= ICTypeOf_Fallback::MAX_OPTIMIZED_STUBS)
return true;
MOZ_ASSERT(type != JSTYPE_NULL);
if (type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION) {
// Create a new TypeOf stub.

View File

@ -1534,6 +1534,8 @@ class ICTypeOf_Fallback : public ICFallbackStub
{ }
public:
static const uint32_t MAX_OPTIMIZED_STUBS = 6;
class Compiler : public ICStubCompiler {
protected:
MOZ_MUST_USE bool generateStubCode(MacroAssembler& masm);

View File

@ -1561,7 +1561,8 @@ Simulator::handleWasmFault(int32_t addr, unsigned numBytes)
return false;
void* pc = reinterpret_cast<void*>(get_pc());
wasm::Instance* instance = act->compartment()->wasm.lookupInstanceDeprecated(pc);
void* fp = reinterpret_cast<void*>(get_register(r11));
wasm::Instance* instance = wasm::LookupFaultingInstance(act, pc, fp);
if (!instance || !instance->memoryAccessInGuardRegion((uint8_t*)addr, numBytes))
return false;

View File

@ -13,8 +13,6 @@ component_stl = ('Core', 'JavaScript: Standard Library')
FILES_PER_UNIFIED_FILE = 6
with Files('../public/**'):
BUG_COMPONENT = component_engine
with Files('*'):
BUG_COMPONENT = component_engine
@ -33,9 +31,6 @@ with Files('jit/**'):
for gcfile in ['jsgc*', 'devtools/rootAnalysis', 'devtools/gc-ubench', 'devtools/gctrace']:
with Files(gcfile):
BUG_COMPONENT = component_gc
for header in ('GCAnnotations.h', 'GCAPI.h', 'HeapAPI.h', 'RootingAPI.h', 'SliceBudget.h', 'SweepingAPI.h', 'TraceKind.h', 'TracingAPI.h', 'WeakMapPtr.h'):
with Files('../public/' + header):
BUG_COMPONENT = component_gc
for stlfile in ['jsarray.*', 'jsbool*', 'jsdate.*', 'jsnum.*', 'json.*', 'jsstr.*']:
with Files(stlfile):
@ -46,9 +41,6 @@ with Files('builtin/Intl*'):
with Files('builtin/make_intl_data.py'):
BUG_COMPONENT = component_intl
with Files('../public/TrackedOptimizationInfo.h'):
BUG_COMPONENT = component_jit
if CONFIG['JS_BUNDLED_EDITLINE']:
DIRS += ['editline']

View File

@ -7730,6 +7730,9 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
if (op.getBoolOption("wasm-check-bce"))
jit::JitOptions.wasmAlwaysCheckBounds = true;
if (op.getBoolOption("wasm-test-mode"))
jit::JitOptions.wasmTestMode = true;
if (op.getBoolOption("no-unboxed-objects"))
jit::JitOptions.disableUnboxedObjects = true;
@ -8203,6 +8206,8 @@ main(int argc, char** argv, char** envp)
|| !op.addBoolOption('\0', "unboxed-arrays", "Allow creating unboxed arrays")
|| !op.addBoolOption('\0', "wasm-always-baseline", "Enable wasm baseline compiler when possible")
|| !op.addBoolOption('\0', "wasm-check-bce", "Always generate wasm bounds check, even redundant ones.")
|| !op.addBoolOption('\0', "wasm-test-mode", "Enable wasm testing mode, creating synthetic "
"objects for non-canonical NaNs and i64 returned from wasm.")
#ifdef ENABLE_SHARED_ARRAY_BUFFER
|| !op.addStringOption('\0', "shared-memory", "on/off",
"SharedArrayBuffer and Atomics "
@ -8312,7 +8317,7 @@ main(int argc, char** argv, char** envp)
|| !op.addIntOption('\0', "arm-sim-stop-at", "NUMBER", "Stop the ARM simulator after the given "
"NUMBER of instructions.", -1)
#elif defined(JS_SIMULATOR_MIPS32) || defined(JS_SIMULATOR_MIPS64)
|| !op.addBoolOption('\0', "mips-sim-icache-checks", "Enable icache flush checks in the MIPS "
|| !op.addBoolOption('\0', "mips-sim-icache-checks", "Enable icache flush checks in the MIPS "
"simulator.")
|| !op.addIntOption('\0', "mips-sim-stop-at", "NUMBER", "Stop the MIPS simulator after the given "
"NUMBER of instructions.", -1)

View File

@ -826,21 +826,23 @@ skip script test262/language/expressions/class/gen-method-yield-spread-obj.js
skip script test262/language/expressions/class/dstr-meth-static-dflt-obj-ptrn-rest-val-obj.js
skip script test262/language/expressions/class/dstr-gen-meth-static-dflt-obj-ptrn-rest-getter.js
# https://bugzilla.mozilla.org/show_bug.cgi?id=1346068
skip script test262/built-ins/Atomics/wait/negative-timeout.js
skip script test262/built-ins/Atomics/wait/was-woken.js
skip script test262/built-ins/Atomics/wait/did-timeout.js
skip script test262/built-ins/Atomics/wait/good-views.js
skip script test262/built-ins/Atomics/wait/no-spurious-wakeup.js
skip script test262/built-ins/Atomics/wait/nan-timeout.js
skip script test262/built-ins/Atomics/wake/wake-all.js
skip script test262/built-ins/Atomics/wake/wake-zero.js
skip script test262/built-ins/Atomics/wake/wake-negative.js
skip script test262/built-ins/Atomics/wake/wake-nan.js
skip script test262/built-ins/Atomics/wake/wake-two.js
skip script test262/built-ins/Atomics/wake/wake-in-order.js
skip script test262/built-ins/Atomics/wake/wake-one.js
skip script test262/built-ins/Atomics/wake/wake-all-on-loc.js
# Dependent on evalInWorker, setSharedArrayBuffer, and
# getSharedArrayBuffer, plus the test cases can't actually run in the
# browser even if that were fixed, https://bugzil.la/1349863
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wait/negative-timeout.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wait/was-woken.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wait/did-timeout.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wait/good-views.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wait/no-spurious-wakeup.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wait/nan-timeout.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-all.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-zero.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-negative.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-nan.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-two.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-in-order.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-one.js
skip-if(!xulRuntime.shell) script test262/built-ins/Atomics/wake/wake-all-on-loc.js
# SharedArrayBuffer API pedantry
# https://bugzilla.mozilla.org/show_bug.cgi?id=1346071

View File

@ -7,6 +7,21 @@
var FunctionToString = global.Function.prototype.toString;
var ReflectApply = global.Reflect.apply;
var NewGlobal = global.newGlobal;
var Atomics = global.Atomics;
var SharedArrayBuffer = global.SharedArrayBuffer;
var Int32Array = global.Int32Array;
var setSharedArrayBuffer = global.setSharedArrayBuffer;
var getSharedArrayBuffer = global.getSharedArrayBuffer;
var evalInWorker = global.evalInWorker;
var hasThreads = ("helperThreadCount" in global ? global.helperThreadCount() > 0 : true);
var hasMailbox = typeof setSharedArrayBuffer == "function" && typeof getSharedArrayBuffer == "function";
var hasEvalInWorker = typeof evalInWorker == "function";
// The $262.agent framework is not appropriate for browsers yet, and some
// test cases can't work in browsers (they block the main thread).
var shellCode = hasMailbox && hasEvalInWorker;
var sabTestable = Atomics && SharedArrayBuffer && hasThreads && shellCode;
global.$262 = {
__proto__: null,
@ -19,6 +34,152 @@
detachArrayBuffer: global.detachArrayBuffer,
evalScript: global.evaluateScript || global.evaluate,
global,
agent: (function () {
// SpiderMonkey complication: With run-time argument --no-threads
// our test runner will not properly filter test cases that can't be
// run because agents can't be started, and so we do a little
// filtering here: We will quietly succeed and exit if an agent test
// should not have been run because threads cannot be started.
//
// Firefox complication: The test cases that use $262.agent can't
// currently work in the browser, so for now we rely on them not
// being run at all.
if (!sabTestable) {
return {
_notAvailable() {
// See comment above.
if (!hasThreads && shellCode) {
global.reportCompare(0,0);
global.quit(0);
}
throw new Error("Agents not available");
},
start(script) { this._notAvailable() },
broadcast(sab, id) { this._notAvailable() },
getReport() { this._notAvailable() },
sleep(s) { this._notAvailable() }
}
}
// The SpiderMonkey implementation uses a designated shared buffer _ia
// for coordination, and spinlocks for everything except sleeping.
var _MSG_LOC = 0; // Low bit set: broadcast available; High bits: seq #
var _ID_LOC = 1; // ID sent with broadcast
var _ACK_LOC = 2; // Worker increments this to ack that broadcast was received
var _RDY_LOC = 3; // Worker increments this to ack that worker is up and running
var _LOCKTXT_LOC = 4; // Writer lock for the text buffer: 0=open, 1=closed
var _NUMTXT_LOC = 5; // Count of messages in text buffer
var _NEXT_LOC = 6; // First free location in the buffer
var _SLEEP_LOC = 7; // Used for sleeping
var _FIRST = 10; // First location of first message
var _ia = new Int32Array(new SharedArrayBuffer(65536));
_ia[_NEXT_LOC] = _FIRST;
var _worker_prefix =
// BEGIN WORKER PREFIX
`if (typeof $262 == 'undefined')
$262 = {};
$262.agent = (function () {
var _ia = new Int32Array(getSharedArrayBuffer());
var agent = {
receiveBroadcast(receiver) {
var k;
while (((k = Atomics.load(_ia, ${_MSG_LOC})) & 1) == 0)
;
var received_sab = getSharedArrayBuffer();
var received_id = Atomics.load(_ia, ${_ID_LOC});
Atomics.add(_ia, ${_ACK_LOC}, 1);
while (Atomics.load(_ia, ${_MSG_LOC}) == k)
;
receiver(received_sab, received_id);
},
report(msg) {
while (Atomics.compareExchange(_ia, ${_LOCKTXT_LOC}, 0, 1) == 1)
;
msg = "" + msg;
var i = _ia[${_NEXT_LOC}];
_ia[i++] = msg.length;
for ( let j=0 ; j < msg.length ; j++ )
_ia[i++] = msg.charCodeAt(j);
_ia[${_NEXT_LOC}] = i;
Atomics.add(_ia, ${_NUMTXT_LOC}, 1);
Atomics.store(_ia, ${_LOCKTXT_LOC}, 0);
},
sleep(s) {
Atomics.wait(_ia, ${_SLEEP_LOC}, 0, s);
},
leaving() {}
};
Atomics.add(_ia, ${_RDY_LOC}, 1);
return agent;
})();`;
// END WORKER PREFIX
return {
_numWorkers: 0,
_numReports: 0,
_reportPtr: _FIRST,
_bailIfNotAvailable() {
if (!sabTestable) {
// See comment above.
if (!hasThreads && shellCode) {
global.reportCompare(0,0);
global.quit(0);
}
throw new Error("Agents not available");
}
},
start(script) {
this._bailIfNotAvailable();
setSharedArrayBuffer(_ia.buffer);
var oldrdy = Atomics.load(_ia, _RDY_LOC);
evalInWorker(_worker_prefix + script);
while (Atomics.load(_ia, _RDY_LOC) == oldrdy)
;
this._numWorkers++;
},
broadcast(sab, id) {
this._bailIfNotAvailable();
setSharedArrayBuffer(sab);
Atomics.store(_ia, _ID_LOC, id);
Atomics.store(_ia, _ACK_LOC, 0);
Atomics.add(_ia, _MSG_LOC, 1);
while (Atomics.load(_ia, _ACK_LOC) < this._numWorkers)
;
Atomics.add(_ia, _MSG_LOC, 1);
},
getReport() {
this._bailIfNotAvailable();
if (this._numReports == Atomics.load(_ia, _NUMTXT_LOC))
return null;
var s = "";
var i = this._reportPtr;
var len = _ia[i++];
for ( let j=0 ; j < len ; j++ )
s += String.fromCharCode(_ia[i++]);
this._reportPtr = i;
this._numReports++;
return s;
},
sleep(s) {
this._bailIfNotAvailable();
Atomics.wait(_ia, _SLEEP_LOC, 0, s);
},
};
})()
};
})(this);

View File

@ -243,6 +243,21 @@ function testFailed(message) {
var FunctionToString = global.Function.prototype.toString;
var ReflectApply = global.Reflect.apply;
var NewGlobal = global.newGlobal;
var Atomics = global.Atomics;
var SharedArrayBuffer = global.SharedArrayBuffer;
var Int32Array = global.Int32Array;
var setSharedArrayBuffer = global.setSharedArrayBuffer;
var getSharedArrayBuffer = global.getSharedArrayBuffer;
var evalInWorker = global.evalInWorker;
var hasThreads = ("helperThreadCount" in global ? global.helperThreadCount() > 0 : true);
var hasMailbox = typeof setSharedArrayBuffer == "function" && typeof getSharedArrayBuffer == "function";
var hasEvalInWorker = typeof evalInWorker == "function";
// The $262.agent framework is not appropriate for browsers yet, and some
// test cases can't work in browsers (they block the main thread).
var shellCode = hasMailbox && hasEvalInWorker;
var sabTestable = Atomics && SharedArrayBuffer && hasThreads && shellCode;
global.$262 = {
__proto__: null,
@ -255,6 +270,152 @@ function testFailed(message) {
detachArrayBuffer: global.detachArrayBuffer,
evalScript: global.evaluateScript || global.evaluate,
global,
agent: (function () {
// SpiderMonkey complication: With run-time argument --no-threads
// our test runner will not properly filter test cases that can't be
// run because agents can't be started, and so we do a little
// filtering here: We will quietly succeed and exit if an agent test
// should not have been run because threads cannot be started.
//
// Firefox complication: The test cases that use $262.agent can't
// currently work in the browser, so for now we rely on them not
// being run at all.
if (!sabTestable) {
return {
_notAvailable() {
// See comment above.
if (!hasThreads && shellCode) {
global.reportCompare(0,0);
global.quit(0);
}
throw new Error("Agents not available");
},
start(script) { this._notAvailable() },
broadcast(sab, id) { this._notAvailable() },
getReport() { this._notAvailable() },
sleep(s) { this._notAvailable() }
}
}
// The SpiderMonkey implementation uses a designated shared buffer _ia
// for coordination, and spinlocks for everything except sleeping.
var _MSG_LOC = 0; // Low bit set: broadcast available; High bits: seq #
var _ID_LOC = 1; // ID sent with broadcast
var _ACK_LOC = 2; // Worker increments this to ack that broadcast was received
var _RDY_LOC = 3; // Worker increments this to ack that worker is up and running
var _LOCKTXT_LOC = 4; // Writer lock for the text buffer: 0=open, 1=closed
var _NUMTXT_LOC = 5; // Count of messages in text buffer
var _NEXT_LOC = 6; // First free location in the buffer
var _SLEEP_LOC = 7; // Used for sleeping
var _FIRST = 10; // First location of first message
var _ia = new Int32Array(new SharedArrayBuffer(65536));
_ia[_NEXT_LOC] = _FIRST;
var _worker_prefix =
// BEGIN WORKER PREFIX
`if (typeof $262 == 'undefined')
$262 = {};
$262.agent = (function () {
var _ia = new Int32Array(getSharedArrayBuffer());
var agent = {
receiveBroadcast(receiver) {
var k;
while (((k = Atomics.load(_ia, ${_MSG_LOC})) & 1) == 0)
;
var received_sab = getSharedArrayBuffer();
var received_id = Atomics.load(_ia, ${_ID_LOC});
Atomics.add(_ia, ${_ACK_LOC}, 1);
while (Atomics.load(_ia, ${_MSG_LOC}) == k)
;
receiver(received_sab, received_id);
},
report(msg) {
while (Atomics.compareExchange(_ia, ${_LOCKTXT_LOC}, 0, 1) == 1)
;
msg = "" + msg;
var i = _ia[${_NEXT_LOC}];
_ia[i++] = msg.length;
for ( let j=0 ; j < msg.length ; j++ )
_ia[i++] = msg.charCodeAt(j);
_ia[${_NEXT_LOC}] = i;
Atomics.add(_ia, ${_NUMTXT_LOC}, 1);
Atomics.store(_ia, ${_LOCKTXT_LOC}, 0);
},
sleep(s) {
Atomics.wait(_ia, ${_SLEEP_LOC}, 0, s);
},
leaving() {}
};
Atomics.add(_ia, ${_RDY_LOC}, 1);
return agent;
})();`;
// END WORKER PREFIX
return {
_numWorkers: 0,
_numReports: 0,
_reportPtr: _FIRST,
_bailIfNotAvailable() {
if (!sabTestable) {
// See comment above.
if (!hasThreads && shellCode) {
global.reportCompare(0,0);
global.quit(0);
}
throw new Error("Agents not available");
}
},
start(script) {
this._bailIfNotAvailable();
setSharedArrayBuffer(_ia.buffer);
var oldrdy = Atomics.load(_ia, _RDY_LOC);
evalInWorker(_worker_prefix + script);
while (Atomics.load(_ia, _RDY_LOC) == oldrdy)
;
this._numWorkers++;
},
broadcast(sab, id) {
this._bailIfNotAvailable();
setSharedArrayBuffer(sab);
Atomics.store(_ia, _ID_LOC, id);
Atomics.store(_ia, _ACK_LOC, 0);
Atomics.add(_ia, _MSG_LOC, 1);
while (Atomics.load(_ia, _ACK_LOC) < this._numWorkers)
;
Atomics.add(_ia, _MSG_LOC, 1);
},
getReport() {
this._bailIfNotAvailable();
if (this._numReports == Atomics.load(_ia, _NUMTXT_LOC))
return null;
var s = "";
var i = this._reportPtr;
var len = _ia[i++];
for ( let j=0 ; j < len ; j++ )
s += String.fromCharCode(_ia[i++]);
this._reportPtr = i;
this._numReports++;
return s;
},
sleep(s) {
this._bailIfNotAvailable();
Atomics.wait(_ia, _SLEEP_LOC, 0, s);
},
};
})()
};
})(this);

View File

@ -1135,10 +1135,12 @@ CallAddPropertyHookDense(JSContext* cx, HandleNativeObject obj, uint32_t index,
return true;
}
static bool
UpdateShapeTypeAndValue(JSContext* cx, HandleNativeObject obj, HandleShape shape, const Value& value)
static MOZ_ALWAYS_INLINE void
UpdateShapeTypeAndValue(JSContext* cx, NativeObject* obj, Shape* shape, jsid id,
const Value& value)
{
jsid id = shape->propid();
MOZ_ASSERT(id == shape->propid());
if (shape->hasSlot()) {
obj->setSlotWithType(cx, shape, value, /* overwriting = */ false);
@ -1154,7 +1156,6 @@ UpdateShapeTypeAndValue(JSContext* cx, HandleNativeObject obj, HandleShape shape
MarkTypePropertyNonData(cx, obj, id);
if (!shape->writable())
MarkTypePropertyNonWritable(cx, obj, id);
return true;
}
static bool
@ -1261,8 +1262,7 @@ AddOrChangeProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
if (!shape)
return false;
if (!UpdateShapeTypeAndValue(cx, obj, shape, desc.value()))
return false;
UpdateShapeTypeAndValue(cx, obj, shape, id, desc.value());
// Clear any existing dense index after adding a sparse indexed property,
// and investigate converting the object to dense indexes.
@ -1498,11 +1498,8 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
// type for this property that doesn't match the value in the slot.
// Update the type here, even though this DefineProperty call is
// otherwise a no-op. (See bug 1125624 comment 13.)
if (!prop.isDenseOrTypedArrayElement() && desc.hasValue()) {
RootedShape shape(cx, prop.shape());
if (!UpdateShapeTypeAndValue(cx, obj, shape, desc.value()))
return false;
}
if (!prop.isDenseOrTypedArrayElement() && desc.hasValue())
UpdateShapeTypeAndValue(cx, obj, prop.shape(), id, desc.value());
return result.succeed();
}

View File

@ -430,15 +430,7 @@ NativeObject::addProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
MOZ_ASSERT(!JSID_IS_VOID(id));
MOZ_ASSERT(getter != JS_PropertyStub);
MOZ_ASSERT(setter != JS_StrictPropertyStub);
bool extensible;
if (!IsExtensible(cx, obj, &extensible))
return nullptr;
if (!extensible) {
if (!cx->helperThread())
JSObject::reportNotExtensible(cx, obj);
return nullptr;
}
MOZ_ASSERT(obj->nonProxyIsExtensible());
AutoKeepShapeTables keep(cx);
ShapeTable::Entry* entry = nullptr;
@ -680,16 +672,7 @@ NativeObject::putProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
* You can't add properties to a non-extensible object, but you can change
* attributes of properties in such objects.
*/
bool extensible;
if (!IsExtensible(cx, obj, &extensible))
return nullptr;
if (!extensible) {
if (!cx->helperThread())
JSObject::reportNotExtensible(cx, obj);
return nullptr;
}
MOZ_ASSERT(obj->nonProxyIsExtensible());
return addPropertyInternal(cx, obj, id, getter, setter, slot, attrs, flags,
entry, true, keep);

View File

@ -47,8 +47,13 @@ struct InstanceComparator
int operator()(const Instance* instance) const {
if (instance == &target)
return 0;
MOZ_ASSERT(!target.codeSegment().containsCodePC(instance->codeBase()));
MOZ_ASSERT(!instance->codeSegment().containsCodePC(target.codeBase()));
// Instances can share code, so the segments can be equal (though they
// can't partially overlap). If the codeBases are equal, we sort by
// Instance address. Thus a Code may map to many instances.
if (instance->codeBase() == target.codeBase())
return instance < &target ? -1 : 1;
return target.codeBase() < instance->codeBase() ? -1 : 1;
}
};
@ -119,13 +124,6 @@ struct PCComparator
Code*
Compartment::lookupCode(const void* pc) const
{
Instance* instance = lookupInstanceDeprecated(pc);
return instance ? &instance->code() : nullptr;
}
Instance*
Compartment::lookupInstanceDeprecated(const void* pc) const
{
// lookupInstanceDeprecated can be called asynchronously from the interrupt
// signal handler. In that case, the signal handler is just asking whether
@ -138,7 +136,7 @@ Compartment::lookupInstanceDeprecated(const void* pc) const
if (!BinarySearchIf(instances_, 0, instances_.length(), PCComparator(pc), &index))
return nullptr;
return instances_[index];
return &instances_[index]->code();
}
void

View File

@ -81,13 +81,6 @@ class Compartment
Code* lookupCode(const void* pc) const;
// Currently, there is one Code per Instance so it is also possible to
// lookup a Instance given a pc. However, the goal is to share one Code
// between multiple Instances at which point in time this method will be
// removed.
Instance* lookupInstanceDeprecated(const void* pc) const;
// The wasm::Compartment must be notified when execution is interrupted
// while executing in wasm code in this compartment.

View File

@ -226,8 +226,11 @@ FrameIterator::debugEnabled() const
{
MOZ_ASSERT(!done() && code_);
MOZ_ASSERT_IF(!missingFrameMessage_, codeRange_->kind() == CodeRange::Function);
MOZ_ASSERT_IF(missingFrameMessage_, !codeRange_ && !fp_);
// Only non-imported functions can have debug frames.
return code_->metadata().debugEnabled &&
fp_ &&
!missingFrameMessage_ &&
codeRange_->funcIndex() >= code_->metadata().funcImports.length();
}
@ -235,6 +238,7 @@ DebugFrame*
FrameIterator::debugFrame() const
{
MOZ_ASSERT(!done() && debugEnabled());
MOZ_ASSERT(fp_);
return FrameToDebugFrame(fp_);
}
@ -255,37 +259,43 @@ FrameIterator::debugTrapCallsite() const
// generation.
#if defined(JS_CODEGEN_X64)
static const unsigned PushedRetAddr = 0;
static const unsigned PushedFP = 1;
static const unsigned PushedTLS = 3;
static const unsigned PoppedTLS = 1;
static const unsigned PushedTLS = 2;
static const unsigned PushedFP = 3;
static const unsigned SetFP = 6;
static const unsigned PoppedFP = 2;
#elif defined(JS_CODEGEN_X86)
static const unsigned PushedRetAddr = 0;
static const unsigned PushedFP = 1;
static const unsigned PushedTLS = 2;
static const unsigned PoppedTLS = 1;
static const unsigned PushedTLS = 1;
static const unsigned PushedFP = 2;
static const unsigned SetFP = 4;
static const unsigned PoppedFP = 1;
#elif defined(JS_CODEGEN_ARM)
static const unsigned BeforePushRetAddr = 0;
static const unsigned PushedRetAddr = 4;
static const unsigned PushedFP = 8;
static const unsigned PushedTLS = 12;
static const unsigned PoppedTLS = 4;
static const unsigned PushedTLS = 8;
static const unsigned PushedFP = 12;
static const unsigned SetFP = 16;
static const unsigned PoppedFP = 4;
#elif defined(JS_CODEGEN_ARM64)
static const unsigned BeforePushRetAddr = 0;
static const unsigned PushedRetAddr = 0;
static const unsigned PushedFP = 0;
static const unsigned PushedTLS = 0;
static const unsigned PoppedTLS = 0;
static const unsigned PushedFP = 0;
static const unsigned SetFP = 0;
static const unsigned PoppedFP = 0;
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
static const unsigned BeforePushRetAddr = 0;
static const unsigned PushedRetAddr = 4;
static const unsigned PushedFP = 8;
static const unsigned PushedTLS = 12;
static const unsigned PoppedTLS = 4;
static const unsigned PushedTLS = 8;
static const unsigned PushedFP = 12;
static const unsigned SetFP = 16;
static const unsigned PoppedFP = 4;
#elif defined(JS_CODEGEN_NONE)
static const unsigned PushedRetAddr = 0;
static const unsigned PushedFP = 0;
static const unsigned PushedTLS = 0;
static const unsigned PoppedTLS = 0;
static const unsigned PushedFP = 0;
static const unsigned SetFP = 0;
static const unsigned PoppedFP = 0;
#else
# error "Unknown architecture!"
#endif
@ -322,11 +332,12 @@ GenerateCallablePrologue(MacroAssembler& masm, unsigned framePushed, ExitReason
PushRetAddr(masm, *entry);
MOZ_ASSERT_IF(!masm.oom(), PushedRetAddr == masm.currentOffset() - *entry);
masm.push(FramePointer);
MOZ_ASSERT_IF(!masm.oom(), PushedFP == masm.currentOffset() - *entry);
masm.push(WasmTlsReg);
MOZ_ASSERT_IF(!masm.oom(), PushedTLS == masm.currentOffset() - *entry);
masm.push(FramePointer);
MOZ_ASSERT_IF(!masm.oom(), PushedFP == masm.currentOffset() - *entry);
masm.moveStackPtrTo(FramePointer);
MOZ_ASSERT_IF(!masm.oom(), SetFP == masm.currentOffset() - *entry);
}
if (reason != ExitReason::None) {
@ -365,12 +376,20 @@ GenerateCallableEpilogue(MacroAssembler& masm, unsigned framePushed, ExitReason
AutoForbidPools afp(&masm, /* number of instructions in scope = */ 3);
#endif
masm.pop(WasmTlsReg);
DebugOnly<uint32_t> poppedTLS = masm.currentOffset();
// There is an important ordering constraint here: fp must be repointed to
// the caller's frame before any field of the frame currently pointed to by
// fp is popped: asynchronous signal handlers (which use stack space
// starting at sp) could otherwise clobber these fields while they are still
// accessible via fp (fp fields are read during frame iteration which is
// *also* done asynchronously).
masm.pop(FramePointer);
DebugOnly<uint32_t> poppedFP = masm.currentOffset();
masm.pop(WasmTlsReg);
*ret = masm.currentOffset();
masm.ret();
MOZ_ASSERT_IF(!masm.oom(), PoppedTLS == *ret - poppedTLS);
MOZ_ASSERT_IF(!masm.oom(), PoppedFP == *ret - poppedFP);
}
void
@ -618,22 +637,22 @@ ProfilingFrameIterator::ProfilingFrameIterator(const WasmActivation& activation,
callerPC_ = sp[0];
callerFP_ = fp;
AssertMatchesCallSite(*activation_, callerPC_, callerFP_);
} else if (offsetFromEntry == PushedFP) {
// The return address and caller's fp have been pushed on the stack; fp
} else if (offsetFromEntry == PushedTLS) {
// The return address and caller's TLS have been pushed on the stack; fp
// is still the caller's fp.
callerPC_ = sp[1];
callerFP_ = sp[0];
callerFP_ = fp;
AssertMatchesCallSite(*activation_, callerPC_, callerFP_);
} else if (offsetFromEntry == PushedTLS) {
} else if (offsetFromEntry == PushedFP) {
// The full Frame has been pushed; fp is still the caller's fp.
MOZ_ASSERT(fp == CallerFPFromFP(sp));
callerPC_ = ReturnAddressFromFP(sp);
callerFP_ = fp;
AssertMatchesCallSite(*activation_, callerPC_, callerFP_);
} else if (offsetInModule == codeRange->ret() - PoppedTLS) {
// The TLS field of the Frame has been popped.
} else if (offsetInModule == codeRange->ret() - PoppedFP) {
// The callerFP field of the Frame has been popped into fp.
callerPC_ = sp[1];
callerFP_ = sp[0];
callerFP_ = fp;
} else if (offsetInModule == codeRange->ret()) {
// Both the TLS and callerFP fields have been popped and fp now
// points to the caller's frame.
@ -779,3 +798,31 @@ wasm::TraceActivations(JSContext* cx, const CooperatingContext& target, JSTracer
}
}
}
Instance*
wasm::LookupFaultingInstance(WasmActivation* activation, void* pc, void* fp)
{
// Assume bug-caused faults can be raised at any PC and apply the logic of
// ProfilingFrameIterator to reject any pc outside the (post-prologue,
// pre-epilogue) body of a wasm function. This is exhaustively tested by the
// simulators which call this function at every load/store before even
// knowing whether there is a fault.
Code* code = activation->compartment()->wasm.lookupCode(pc);
if (!code)
return nullptr;
const CodeRange* codeRange = code->lookupRange(pc);
if (!codeRange || !codeRange->isFunction())
return nullptr;
size_t offsetInModule = ((uint8_t*)pc) - code->segment().base();
if (offsetInModule < codeRange->funcNormalEntry() + SetFP)
return nullptr;
if (offsetInModule >= codeRange->ret() - PoppedFP)
return nullptr;
Instance* instance = reinterpret_cast<Frame*>(fp)->tls->instance;
MOZ_RELEASE_ASSERT(&instance->code() == code);
return instance;
}

View File

@ -138,6 +138,12 @@ GenerateFunctionEpilogue(jit::MacroAssembler& masm, unsigned framePushed, FuncOf
void
TraceActivations(JSContext* cx, const CooperatingContext& target, JSTracer* trc);
// Given a fault at pc with register fp, return the faulting instance if there
// is such a plausible instance, and otherwise null.
Instance*
LookupFaultingInstance(WasmActivation* activation, void* pc, void* fp);
} // namespace wasm
} // namespace js

View File

@ -69,6 +69,7 @@ class AutoSetHandlingSegFault
#if defined(XP_WIN)
# define XMM_sig(p,i) ((p)->Xmm##i)
# define EIP_sig(p) ((p)->Eip)
# define EBP_sig(p) ((p)->Ebp)
# define RIP_sig(p) ((p)->Rip)
# define RAX_sig(p) ((p)->Rax)
# define RCX_sig(p) ((p)->Rcx)
@ -89,6 +90,7 @@ class AutoSetHandlingSegFault
#elif defined(__OpenBSD__)
# define XMM_sig(p,i) ((p)->sc_fpstate->fx_xmm[i])
# define EIP_sig(p) ((p)->sc_eip)
# define EBP_sig(p) ((p)->sc_ebp)
# define RIP_sig(p) ((p)->sc_rip)
# define RAX_sig(p) ((p)->sc_rax)
# define RCX_sig(p) ((p)->sc_rcx)
@ -110,9 +112,11 @@ class AutoSetHandlingSegFault
# if defined(__linux__)
# define XMM_sig(p,i) ((p)->uc_mcontext.fpregs->_xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_EIP])
# define EBP_sig(p) ((p)->uc_mcontext.gregs[REG_EBP])
# else
# define XMM_sig(p,i) ((p)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.gregs[REG_PC])
# define EBP_sig(p) ((p)->uc_mcontext.gregs[REG_EBP])
# endif
# define RIP_sig(p) ((p)->uc_mcontext.gregs[REG_RIP])
# define RAX_sig(p) ((p)->uc_mcontext.gregs[REG_RAX])
@ -126,13 +130,14 @@ class AutoSetHandlingSegFault
# define R8_sig(p) ((p)->uc_mcontext.gregs[REG_R8])
# define R9_sig(p) ((p)->uc_mcontext.gregs[REG_R9])
# define R10_sig(p) ((p)->uc_mcontext.gregs[REG_R10])
# define R11_sig(p) ((p)->uc_mcontext.gregs[REG_R11])
# define R12_sig(p) ((p)->uc_mcontext.gregs[REG_R12])
# define R13_sig(p) ((p)->uc_mcontext.gregs[REG_R13])
# define R14_sig(p) ((p)->uc_mcontext.gregs[REG_R14])
# if defined(__linux__) && defined(__arm__)
# define R11_sig(p) ((p)->uc_mcontext.arm_fp)
# define R15_sig(p) ((p)->uc_mcontext.arm_pc)
# else
# define R11_sig(p) ((p)->uc_mcontext.gregs[REG_R11])
# define R15_sig(p) ((p)->uc_mcontext.gregs[REG_R15])
# endif
# if defined(__linux__) && defined(__aarch64__)
@ -146,6 +151,7 @@ class AutoSetHandlingSegFault
#elif defined(__NetBSD__)
# define XMM_sig(p,i) (((struct fxsave64*)(p)->uc_mcontext.__fpregs)->fx_xmm[i])
# define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP])
# define EBP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EBP])
# define RIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_RIP])
# define RAX_sig(p) ((p)->uc_mcontext.__gregs[_REG_RAX])
# define RCX_sig(p) ((p)->uc_mcontext.__gregs[_REG_RCX])
@ -170,6 +176,7 @@ class AutoSetHandlingSegFault
# define XMM_sig(p,i) (((struct savefpu*)(p)->uc_mcontext.mc_fpstate)->sv_xmm[i])
# endif
# define EIP_sig(p) ((p)->uc_mcontext.mc_eip)
# define EBP_sig(p) ((p)->uc_mcontext.mc_ebp)
# define RIP_sig(p) ((p)->uc_mcontext.mc_rip)
# define RAX_sig(p) ((p)->uc_mcontext.mc_rax)
# define RCX_sig(p) ((p)->uc_mcontext.mc_rcx)
@ -193,7 +200,9 @@ class AutoSetHandlingSegFault
# endif
#elif defined(XP_DARWIN)
# define EIP_sig(p) ((p)->uc_mcontext->__ss.__eip)
# define EBP_sig(p) ((p)->uc_mcontext->__ss.__ebp)
# define RIP_sig(p) ((p)->uc_mcontext->__ss.__rip)
# define RBP_sig(p) ((p)->uc_mcontext->__ss.__rbp)
# define R15_sig(p) ((p)->uc_mcontext->__ss.__pc)
#else
# error "Don't know how to read/write to the thread state via the mcontext_t."
@ -335,14 +344,19 @@ struct macos_arm_context {
#if defined(_M_X64) || defined(__x86_64__)
# define PC_sig(p) RIP_sig(p)
# define FP_sig(p) RBP_sig(p)
#elif defined(_M_IX86) || defined(__i386__)
# define PC_sig(p) EIP_sig(p)
# define FP_sig(p) EBP_sig(p)
#elif defined(__arm__)
# define PC_sig(p) R15_sig(p)
# define FP_sig(p) R11_sig(p)
#elif defined(__aarch64__)
# define PC_sig(p) EPC_sig(p)
# define FP_sig(p) RFP_sig(p)
#elif defined(__mips__)
# define PC_sig(p) EPC_sig(p)
# define FP_sig(p) RFP_sig(p)
#endif
static uint8_t**
@ -355,6 +369,16 @@ ContextToPC(CONTEXT* context)
#endif
}
uint8_t*
ContextToFP(CONTEXT* context)
{
#ifdef JS_CODEGEN_NONE
MOZ_CRASH();
#else
return reinterpret_cast<uint8_t*>(FP_sig(context));
#endif
}
#if defined(WASM_HUGE_MEMORY)
MOZ_COLD static void
SetFPRegToNaN(size_t size, void* fp_reg)
@ -790,7 +814,25 @@ HandleFault(PEXCEPTION_POINTERS exception)
if (!activation)
return false;
const Instance* instance = activation->compartment()->wasm.lookupInstanceDeprecated(pc);
Code* code = activation->compartment()->wasm.lookupCode(pc);
if (!code)
return false;
if (!code->segment().containsFunctionPC(pc)) {
// On Windows, it is possible for InterruptRunningCode to execute
// between a faulting heap access and the handling of the fault due
// to InterruptRunningCode's use of SuspendThread. When this happens,
// after ResumeThread, the exception handler is called with pc equal to
// CodeSegment.interrupt, which is logically wrong. The Right Thing would
// be for the OS to make fault-handling atomic (so that CONTEXT.pc was
// always the logically-faulting pc). Fortunately, we can detect this
// case and silence the exception ourselves (the exception will
// retrigger after the interrupt jumps back to resumePC).
return pc == code->segment().interruptCode() &&
code->segment().containsFunctionPC(activation->resumePC());
}
const Instance* instance = LookupFaultingInstance(activation, pc, ContextToFP(context));
if (!instance)
return false;
@ -801,20 +843,6 @@ HandleFault(PEXCEPTION_POINTERS exception)
if (!IsHeapAccessAddress(*instance, faultingAddress))
return false;
if (!instance->codeSegment().containsFunctionPC(pc)) {
// On Windows, it is possible for InterruptRunningCode to execute
// between a faulting heap access and the handling of the fault due
// to InterruptRunningCode's use of SuspendThread. When this happens,
// after ResumeThread, the exception handler is called with pc equal to
// instance.interrupt, which is logically wrong. The Right Thing would
// be for the OS to make fault-handling atomic (so that CONTEXT.pc was
// always the logically-faulting pc). Fortunately, we can detect this
// case and silence the exception ourselves (the exception will
// retrigger after the interrupt jumps back to resumePC).
return pc == instance->codeSegment().interruptCode() &&
instance->codeSegment().containsFunctionPC(activation->resumePC());
}
HandleMemoryAccess(context, pc, faultingAddress, *instance, ppc);
return true;
}
@ -852,6 +880,20 @@ ContextToPC(EMULATOR_CONTEXT* context)
# endif
}
static void*
ContextToFP(EMULATOR_CONTEXT* context)
{
# if defined(__x86_64__)
return (void*)context->thread.__rbp;
# elif defined(__i386__)
return (void*)context->thread.uts.ts32.__ebp;
# elif defined(__arm__)
return (void*)context->thread.__fp;
# else
# error Unsupported architecture
# endif
}
// This definition was generated by mig (the Mach Interface Generator) for the
// routine 'exception_raise' (exc.defs).
#pragma pack(4)
@ -927,7 +969,7 @@ HandleMachException(JSContext* cx, const ExceptionRequest& request)
if (!activation)
return false;
const Instance* instance = activation->compartment()->wasm.lookupInstanceDeprecated(pc);
const Instance* instance = LookupFaultingInstance(activation, pc, ContextToFP(&context));
if (!instance || !instance->codeSegment().containsFunctionPC(pc))
return false;
@ -1134,7 +1176,7 @@ HandleFault(int signum, siginfo_t* info, void* ctx)
if (!activation)
return false;
const Instance* instance = activation->compartment()->wasm.lookupInstanceDeprecated(pc);
const Instance* instance = LookupFaultingInstance(activation, pc, ContextToFP(context));
if (!instance || !instance->codeSegment().containsFunctionPC(pc))
return false;
@ -1245,17 +1287,17 @@ RedirectJitCodeToInterruptCheck(JSContext* cx, CONTEXT* context)
void* pc = cx->simulator()->get_pc_as<void*>();
const Instance* instance = activation->compartment()->wasm.lookupInstanceDeprecated(pc);
if (instance && instance->codeSegment().containsFunctionPC(pc))
cx->simulator()->set_resume_pc(instance->codeSegment().interruptCode());
const Code* code = activation->compartment()->wasm.lookupCode(pc);
if (code && code->segment().containsFunctionPC(pc))
cx->simulator()->set_resume_pc(code->segment().interruptCode());
#else
uint8_t** ppc = ContextToPC(context);
uint8_t* pc = *ppc;
const Instance* instance = activation->compartment()->wasm.lookupInstanceDeprecated(pc);
if (instance && instance->codeSegment().containsFunctionPC(pc)) {
const Code* code = activation->compartment()->wasm.lookupCode(pc);
if (code && code->segment().containsFunctionPC(pc)) {
activation->setResumePC(pc);
*ppc = instance->codeSegment().interruptCode();
*ppc = code->segment().interruptCode();
return true;
}
#endif
@ -1487,5 +1529,5 @@ js::wasm::IsPCInWasmCode(void *pc)
if (!activation)
return false;
return !!activation->compartment()->wasm.lookupInstanceDeprecated(pc);
return !!activation->compartment()->wasm.lookupCode(pc);
}

View File

@ -1446,21 +1446,28 @@ class MemoryAccess
WASM_DECLARE_POD_VECTOR(MemoryAccess, MemoryAccessVector)
// As an invariant across architectures, within wasm code:
// $sp % WasmStackAlignment = (sizeof(wasm::Frame) + masm.framePushed) % WasmStackAlignment
// Thus, wasm::Frame represents the bytes pushed after the call (which occurred
// with a WasmStackAlignment-aligned StackPointer) that are not included in
// masm.framePushed.
// wasm::Frame represents the bytes pushed by the call instruction and the fixed
// prologue generated by wasm::GenerateCallablePrologue.
//
// Across all architectures it is assumed that, before the call instruction, the
// stack pointer is WasmStackAlignment-aligned. Thus after the prologue, and
// before the function has made its stack reservation, the stack alignment is
// sizeof(Frame) % WasmStackAlignment.
//
// During MacroAssembler code generation, the bytes pushed after the wasm::Frame
// are counted by masm.framePushed. Thus, the stack alignment at any point in
// time is (sizeof(wasm::Frame) + masm.framePushed) % WasmStackAlignment.
struct Frame
{
// The caller's Frame*. See GenerateCallableEpilogue for why this must be
// the first field of wasm::Frame (in a downward-growing stack).
uint8_t* callerFP;
// The saved value of WasmTlsReg on entry to the function. This is
// effectively the callee's instance.
TlsData* tls;
// The caller's Frame*.
uint8_t* callerFP;
// The return address pushed by the call (in the case of ARM/MIPS the return
// address is pushed by the first instruction of the prologue).
void* returnAddress;

View File

@ -169,8 +169,11 @@ void
AsyncScriptCompiler::FinishCompile(JSContext* aCx)
{
Rooted<JSScript*> script(aCx, JS::FinishOffThreadScript(aCx, mToken));
Finish(aCx, script);
if (script) {
Finish(aCx, script);
} else {
Reject(aCx);
}
}

View File

@ -53,3 +53,20 @@ add_task(function*() {
equal(Cu.getObjectPrincipal(sandbox2.bar).origin, "http://example.org", "Object value origin is correct");
equal(sandbox2.bar.foo, "\u00ae", "Object value has the correct charset");
});
add_task(function* test_syntaxError() {
// Generate an artificially large script to force off-main-thread
// compilation.
let scriptUrl = `data:,${";".repeat(1024 * 1024)}(`;
yield Assert.rejects(
ChromeUtils.compileScript(scriptUrl),
SyntaxError);
// Generate a small script to force main thread compilation.
scriptUrl = `data:,;(`;
yield Assert.rejects(
ChromeUtils.compileScript(scriptUrl),
SyntaxError);
});

View File

@ -7185,17 +7185,21 @@ PresShell::HandleEvent(nsIFrame* aFrame,
nsIContent** aTargetContent)
{
#ifdef MOZ_TASK_TRACER
// Make touch events, mouse events and hardware key events to be the source
// events of TaskTracer, and originate the rest correlation tasks from here.
SourceEventType type = SourceEventType::Unknown;
if (aEvent->AsTouchEvent()) {
type = SourceEventType::Touch;
} else if (aEvent->AsMouseEvent()) {
type = SourceEventType::Mouse;
} else if (aEvent->AsKeyboardEvent()) {
type = SourceEventType::Key;
Maybe<AutoSourceEvent> taskTracerEvent;
if (MOZ_UNLIKELY(IsStartLogging())) {
// Make touch events, mouse events and hardware key events to be
// the source events of TaskTracer, and originate the rest
// correlation tasks from here.
SourceEventType type = SourceEventType::Unknown;
if (aEvent->AsTouchEvent()) {
type = SourceEventType::Touch;
} else if (aEvent->AsMouseEvent()) {
type = SourceEventType::Mouse;
} else if (aEvent->AsKeyboardEvent()) {
type = SourceEventType::Key;
}
taskTracerEvent.emplace(type);
}
AutoSourceEvent taskTracerEvent(type);
#endif
NS_ASSERTION(aFrame, "aFrame should be not null");

View File

@ -634,8 +634,8 @@ load text-overflow-iframe.html
asserts-if(Android,2-4) asserts-if(!Android,4) asserts-if(stylo,0) load 1225005.html # bug 682647 and bug 448083
load 1233191.html
asserts-if(stylo,0-15) load 1271765.html # bug 1324684
asserts(2) load 1272983-1.html # bug 1324654 # bug 586628
asserts(2) load 1272983-2.html # bug 1324654 # bug 586628
asserts(2) load 1272983-1.html # bug 586628
asserts(2) load 1272983-2.html # bug 586628
load 1275059.html
load 1278007.html
load 1278080.html

View File

@ -8040,8 +8040,7 @@ bool nsDisplayMask::TryMerge(nsDisplayItem* aItem)
// Do not merge if mFrame has mask. Continuation frames should apply mask
// independently(just like nsDisplayBackgroundImage).
const nsStyleSVGReset *style = mFrame->StyleSVGReset();
if (style->mMask.HasLayerWithImage()) {
if (mFrame->StyleSVGReset()->HasMask()) {
return false;
}

View File

@ -1,4 +1,3 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
== bg-fixed-1.html bg-fixed-1.html
== bg-fixed-cover-1.html bg-fixed-cover-1.html
== bg-fixed-cover-2.html bg-fixed-cover-2.html
@ -32,7 +31,7 @@ fails == fixed-pos-scrollable-1.html fixed-pos-scrollable-1.html
== culling-1.html culling-1.html
== position-fixed-iframe-1.html position-fixed-iframe-1.html
== position-fixed-iframe-2.html position-fixed-iframe-2.html
fuzzy-if(skiaContent,1,11300) skip-if(!asyncPan) == position-fixed-in-scroll-container.html position-fixed-in-scroll-container.html
fuzzy-if(skiaContent,1,11300) skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == position-fixed-in-scroll-container.html position-fixed-in-scroll-container.html
== position-fixed-inside-sticky-1.html position-fixed-inside-sticky-1.html
== position-fixed-inside-sticky-2.html position-fixed-inside-sticky-2.html
== group-opacity-surface-size-1.html group-opacity-surface-size-1.html
@ -41,12 +40,12 @@ skip-if(!asyncPan) == position-sticky-transformed.html position-sticky-transform
fails == offscreen-clipped-blendmode-1.html offscreen-clipped-blendmode-1.html
fails == offscreen-clipped-blendmode-2.html offscreen-clipped-blendmode-2.html
fuzzy-if(Android,6,4) skip == offscreen-clipped-blendmode-3.html offscreen-clipped-blendmode-3.html
fuzzy-if(Android,6,4) skip-if(!asyncPan) == offscreen-clipped-blendmode-4.html offscreen-clipped-blendmode-4.html
fuzzy-if(Android,6,4) skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == offscreen-clipped-blendmode-4.html offscreen-clipped-blendmode-4.html
fails == perspective-scrolling-1.html perspective-scrolling-1.html
fails == perspective-scrolling-2.html perspective-scrolling-2.html
fuzzy-if(Android,7,4) skip-if(!asyncPan) == perspective-scrolling-3.html perspective-scrolling-3.html
fuzzy-if(Android,7,4) skip-if(!asyncPan) == perspective-scrolling-4.html perspective-scrolling-4.html
pref(apz.disable_for_scroll_linked_effects,true) skip-if(!asyncPan) == disable-apz-for-sle-pages.html disable-apz-for-sle-pages.html
fuzzy-if(Android,7,4) skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == perspective-scrolling-3.html perspective-scrolling-3.html
fuzzy-if(Android,7,4) skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == perspective-scrolling-4.html perspective-scrolling-4.html
pref(apz.disable_for_scroll_linked_effects,true) skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == disable-apz-for-sle-pages.html disable-apz-for-sle-pages.html
== background-blend-mode-1.html background-blend-mode-1.html
fails == opaque-fractional-displayport-1.html opaque-fractional-displayport-1.html
fails == opaque-fractional-displayport-2.html opaque-fractional-displayport-2.html

View File

@ -971,7 +971,7 @@ fails == 413027-3.html 413027-3-ref.html
== 413286-4b.html 413286-4-ref.html
== 413286-5.html 413286-5-ref.html
== 413286-6.html 413286-6-ref.html
skip-if(cocoaWidget) == 413292-1.html 413292-1-ref.html # disabling due to failure loading on some mac tinderboxes. See bug 432954
== 413292-1.html 413292-1-ref.html
fuzzy-if(Android,11,17) == 413361-1.html 413361-1-ref.html # bug 1128229
== 413840-background-unchanged.html 413840-background-unchanged-ref.html
== 413840-ltr-offsets.html 413840-ltr-offsets-ref.html

View File

@ -1,11 +1,10 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
== table-repaint-a.html table-repaint-a.html
== table-repaint-b.html table-repaint-b.html
== table-repaint-c.html table-repaint-c.html
== table-repaint-d.html table-repaint-d.html
== 540247-1.xul 540247-1.xul
fails == 543681-1.html 543681-1.html
fails == 1243409-1.html 1243409-1.html
fails-if(stylo&&!browserIsRemote) == 1243409-1.html 1243409-1.html
fails == test-image-layers.html test-image-layers.html
fails == test-image-layers-multiple-displayitem.html test-image-layers-multiple-displayitem.html
pref(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == test-animated-image-layers.html test-animated-image-layers.html

View File

@ -1,4 +1,3 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
== move-to-background-1.html move-to-background-1.html
== component-alpha-exit-1.html component-alpha-exit-1.html
fails == pull-background-1.html pull-background-1.html
@ -15,10 +14,10 @@ fails == pull-background-animated-position-4.html pull-background-animated-posit
fails == pull-background-animated-position-5.html pull-background-animated-position-5.html
fails == pull-background-displayport-1.html pull-background-displayport-1.html
fails == pull-background-displayport-2.html pull-background-displayport-2.html
skip-if(!asyncPan) == pull-background-displayport-3.html pull-background-displayport-3.html
skip-if(!asyncPan) == pull-background-displayport-4.html pull-background-displayport-4.html
skip-if(!asyncPan) == pull-background-displayport-5.html pull-background-displayport-5.html
skip-if(!asyncPan) == pull-background-displayport-6.html pull-background-displayport-6.html
skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == pull-background-displayport-3.html pull-background-displayport-3.html
skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == pull-background-displayport-4.html pull-background-displayport-4.html
skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == pull-background-displayport-5.html pull-background-displayport-5.html
skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == pull-background-displayport-6.html pull-background-displayport-6.html
fuzzy(2,30150) == opacity-blending.html opacity-blending.html
fuzzy(16,5) == mask-layer-transform.html mask-layer-transform.html
fails == forced-bg-color-outside-visible-region.html forced-bg-color-outside-visible-region.html

View File

@ -1,6 +1,6 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
# NOTE: bug 1084564 covers "fails"/"skip" annotations for android below:
== 444-1.html 444-1.html
fuzzy-if(stylo,2377,28) == 444-1.html 444-1.html
== aspect-ratio-1a.xhtml aspect-ratio-1a.xhtml
== aspect-ratio-1b.xhtml aspect-ratio-1b.xhtml
fails-if(Android) skip-if(gtkWidget) HTTP(..) == aspect-ratio-2a.xhtml aspect-ratio-2a.xhtml

View File

@ -41,7 +41,7 @@ fails == scrollframe-auto-1.html scrollframe-auto-1.html
fails == inline-1.html inline-1.html
fails == inline-2.html inline-2.html
fails == inline-3.html inline-3.html
skip-if(!asyncPan) == inline-4.html inline-4.html
skip-if(!asyncPan) fails-if(stylo&&browserIsRemote) == inline-4.html inline-4.html
== column-contain-1a.html column-contain-1a.html
== column-contain-1b.html column-contain-1b.html
== column-contain-2.html column-contain-2.html

View File

@ -1,4 +1,3 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
== data:text/html,<body> data:text/html,<body>
== data:text/plain, data:text/plain,
fails == data:text/plain,HELLO data:text/plain,HELLO # Bug 1341637
@ -100,7 +99,7 @@ pref(dom.meta-viewport.enabled,true) skip-if(!browserIsRemote||layersOMTC) == te
# Fixed layers are temporarily disabled (bug 656167).
pref(dom.meta-viewport.enabled,true) skip-if(!browserIsRemote) == test-pos-fixed.html test-pos-fixed.html
pref(dom.meta-viewport.enabled,true) skip-if(!browserIsRemote) == test-bg-attachment-fixed.html test-bg-attachment-fixed.html
pref(dom.meta-viewport.enabled,true) skip-if(!browserIsRemote) == test-pos-fixed-transform.html test-pos-fixed-transform.html
pref(dom.meta-viewport.enabled,true) skip-if(stylo) == test-pos-fixed-transform.html test-pos-fixed-transform.html # Bug 1348754
# reftest syntax: require-or
fails require-or(unrecognizedCondition,skip) script scripttest-fail.html

View File

@ -236,7 +236,7 @@ fails == css-values-3/ch-unit-001.html css-values-3/ch-unit-001.html
fails == css-values-3/vh-support-atviewport.html css-values-3/vh-support-atviewport.html
== css-values-3/vh-support-margin.html css-values-3/vh-support-margin.html
== css-values-3/vh-support-transform-origin.html css-values-3/vh-support-transform-origin.html
== css-values-3/vh-support-transform-translate.html css-values-3/vh-support-transform-translate.html
fuzzy-if(stylo,160000,251) == css-values-3/vh-support-transform-translate.html css-values-3/vh-support-transform-translate.html
== css-values-3/vh-support.html css-values-3/vh-support.html
== css-values-3/vh-zero-support.html css-values-3/vh-zero-support.html
skip-if(stylo) == css-values-3/vh_not_refreshing_on_chrome.html css-values-3/vh_not_refreshing_on_chrome.html # bug 1346829

View File

@ -1,4 +1,3 @@
# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
== box-sizing-border-box-001.xht box-sizing-border-box-001.xht
== box-sizing-border-box-002.xht box-sizing-border-box-002.xht
== box-sizing-border-box-003.xht box-sizing-border-box-003.xht
@ -8,4 +7,4 @@
== box-sizing-content-box-003.xht box-sizing-content-box-003.xht
== box-sizing-replaced-001.xht box-sizing-replaced-001.xht
== box-sizing-replaced-002.xht box-sizing-replaced-002.xht
== box-sizing-replaced-003.xht box-sizing-replaced-003.xht
random-if(stylo&&browserIsRemote) == box-sizing-replaced-003.xht box-sizing-replaced-003.xht

View File

@ -30,6 +30,7 @@
#include "nsIContentSecurityPolicy.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsILoadContext.h"
#include "nsINetworkPredictor.h"
#include "nsIPresShell.h"
#include "nsIPrincipal.h"

View File

@ -257,9 +257,6 @@ public:
* @param aComputedValue The computed value to be converted.
* @param [out] aSpecifiedValue The resulting specified value.
* @return true on success, false on failure.
*
* These functions are not MOZ_MUST_USE because failing to check the return
* value is common and reasonable.
*/
static MOZ_MUST_USE bool
UncomputeValue(nsCSSPropertyID aProperty,

View File

@ -1180,8 +1180,8 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
// only need to return the hint if the overall computation of
// whether we establish a containing block has changed.
// This depends on data in nsStyleDisplay and nsStyleEffects, so we
// do it here.
// This depends on data in nsStyleDisplay, nsStyleEffects and
// nsStyleSVGReset, so we do it here.
// Note that it's perhaps good for this test to be last because it
// doesn't use Peek* functions to get the structs on the old

View File

@ -1221,12 +1221,36 @@ nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
hint |= nsChangeHint_RepaintFrame;
}
if (HasMask() != aNewData.HasMask()) {
// A change from/to being a containing block for position:fixed.
hint |= nsChangeHint_UpdateContainingBlock;
}
hint |= mMask.CalcDifference(aNewData.mMask,
nsStyleImageLayers::LayerType::Mask);
return hint;
}
bool
nsStyleSVGReset::HasMask() const
{
for (uint32_t i = 0; i < mMask.mImageCount; i++) {
// mMask.mLayers[i].mSourceURI can be nullptr if mask-image prop value is
// <element-reference> or <gradient>.
// mMask.mLayers[i].mImage can be empty if mask-image prop value is a
// reference to SVG mask element.
//
// So we need to test both mSourceURI and mImage.
if ((mMask.mLayers[i].mSourceURI && mMask.mLayers[i].mSourceURI->GetURI()) ||
!mMask.mLayers[i].mImage.IsEmpty()) {
return true;
}
}
return false;
}
// nsStyleSVGPaint implementation
nsStyleSVGPaint::nsStyleSVGPaint(nsStyleSVGPaintType aType)
: mType(aType)
@ -2647,24 +2671,6 @@ nsStyleImageLayers::CalcDifference(const nsStyleImageLayers& aNewLayers,
return hint;
}
bool
nsStyleImageLayers::HasLayerWithImage() const
{
for (uint32_t i = 0; i < mImageCount; i++) {
// mLayers[i].mSourceURI can be nullptr if mask-image prop value is
// <element-reference> or <gradient>
// mLayers[i].mImage can be empty if mask-image prop value is a reference
// to SVG mask element.
// So we need to test both mSourceURI and mImage.
if ((mLayers[i].mSourceURI && mLayers[i].mSourceURI->GetURI()) ||
!mLayers[i].mImage.IsEmpty()) {
return true;
}
}
return false;
}
nsStyleImageLayers&
nsStyleImageLayers::operator=(const nsStyleImageLayers& aOther)
{

View File

@ -828,7 +828,6 @@ struct nsStyleImageLayers {
nsChangeHint CalcDifference(const nsStyleImageLayers& aNewLayers,
nsStyleImageLayers::LayerType aType) const;
bool HasLayerWithImage() const;
nsStyleImageLayers& operator=(const nsStyleImageLayers& aOther);
nsStyleImageLayers& operator=(nsStyleImageLayers&& aOther);
bool operator==(const nsStyleImageLayers& aOther) const;
@ -3626,6 +3625,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
return mClipPath.GetType() != mozilla::StyleShapeSourceType::None;
}
bool HasMask() const;
bool HasNonScalingStroke() const {
return mVectorEffect == NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE;
}

View File

@ -589,7 +589,7 @@ nsSVGEffects::GetEffectProperties(nsIFrame* aFrame)
}
MOZ_ASSERT(style->mMask.mImageCount > 0);
result.mMask = style->mMask.HasLayerWithImage()
result.mMask = style->HasMask()
? GetOrCreateMaskProperty(aFrame) : nullptr;
return result;

View File

@ -137,16 +137,14 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
// painting or hit-testing anyway.
const nsStyleSVGReset *style = aFrame->StyleSVGReset();
return aFrame->StyleEffects()->HasFilters() ||
style->HasClipPath() ||
style->mMask.HasLayerWithImage();
style->HasClipPath() || style->HasMask();
}
bool
nsSVGIntegrationUtils::UsingMaskOrClipPathForFrame(const nsIFrame* aFrame)
{
const nsStyleSVGReset *style = aFrame->StyleSVGReset();
return style->HasClipPath() ||
style->mMask.HasLayerWithImage();
return style->HasClipPath() || style->HasMask();
}
nsPoint
@ -1138,7 +1136,7 @@ PaintFrameCallback::operator()(gfxContext* aContext,
if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER)
return false;
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
AutoSetRestorePaintServerState paintServer(mFrame);
aContext->Save();
@ -1206,8 +1204,6 @@ PaintFrameCallback::operator()(gfxContext* aContext,
aContext->Restore();
mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
return true;
}

View File

@ -26,6 +26,32 @@ class nsStyleContext;
struct gfxRect;
/**
* RAII class used to temporarily set and remove the
* NS_FRAME_DRAWING_AS_PAINTSERVER frame state bit while a frame is being
* drawn as a paint server.
*/
class MOZ_RAII AutoSetRestorePaintServerState
{
public:
explicit AutoSetRestorePaintServerState(
nsIFrame* aFrame
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
mFrame(aFrame)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
}
~AutoSetRestorePaintServerState()
{
mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
}
private:
nsIFrame* mFrame;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class nsSVGPaintServerFrame : public nsSVGContainerFrame
{
protected:

View File

@ -380,7 +380,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
// Delay checking NS_FRAME_DRAWING_AS_PAINTSERVER bit until here so we can
// give back a clear surface if there's a loop
if (!(patternWithChildren->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER)) {
patternWithChildren->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
AutoSetRestorePaintServerState paintServer(patternWithChildren);
for (nsIFrame* kid = firstKid; kid;
kid = kid->GetNextSibling()) {
// The CTM of each frame referencing us can be different
@ -398,7 +398,6 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
return nullptr;
}
}
patternWithChildren->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
}
patternWithChildren->mSource = nullptr;

View File

@ -18,6 +18,7 @@
#include "pk11pub.h"
#include "nsNetCID.h"
#include "nsILoadContext.h"
#include "nsIProperty.h"
#include "nsIPropertyBag2.h"
#include "nsIServiceManager.h"

View File

@ -3629,7 +3629,7 @@ Tab.prototype = {
this.browser.addEventListener("pageshow", this, true);
this.browser.addEventListener("MozApplicationManifest", this, true);
this.browser.addEventListener("TabPreZombify", this, true);
this.browser.addEventListener("DOMServiceWorkerFocusClient", this, true);
this.browser.addEventListener("DOMWindowFocus", this, true);
// Note that the XBL binding is untrusted
this.browser.addEventListener("PluginBindingAttached", this, true, true);
@ -3745,7 +3745,7 @@ Tab.prototype = {
this.browser.removeEventListener("pageshow", this, true);
this.browser.removeEventListener("MozApplicationManifest", this, true);
this.browser.removeEventListener("TabPreZombify", this, true);
this.browser.removeEventListener("DOMServiceWorkerFocusClient", this, true);
this.browser.removeEventListener("DOMWindowFocus", this, true);
this.browser.removeEventListener("PluginBindingAttached", this, true, true);
this.browser.removeEventListener("VideoBindingAttached", this, true, true);
@ -4268,7 +4268,7 @@ Tab.prototype = {
break;
}
case "DOMServiceWorkerFocusClient": {
case "DOMWindowFocus": {
GlobalEventDispatcher.sendRequest({
type: "Tab:Select",
tabID: this.id,

View File

@ -327,8 +327,10 @@ nsresult CacheIOThread::DispatchInternal(already_AddRefed<nsIRunnable> aRunnable
{
nsCOMPtr<nsIRunnable> runnable(aRunnable);
#ifdef MOZ_TASK_TRACER
runnable = tasktracer::CreateTracedRunnable(runnable.forget());
(static_cast<tasktracer::TracedRunnable*>(runnable.get()))->DispatchTask();
if (tasktracer::IsStartLogging()) {
runnable = tasktracer::CreateTracedRunnable(runnable.forget());
(static_cast<tasktracer::TracedRunnable*>(runnable.get()))->DispatchTask();
}
#endif
if (NS_WARN_IF(!runnable))

View File

@ -11,6 +11,7 @@
#include "nsIPrefService.h"
#include "nsIProtocolProxyService.h"
#include "nsNetCID.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/net/DNSListenerProxy.h"
#include "nsServiceManagerUtils.h"
@ -173,9 +174,7 @@ ChildDNSService::AsyncResolveExtendedNative(const nsACString &hostname,
nsCOMPtr<nsIEventTarget> target = target_;
nsCOMPtr<nsIXPConnectWrappedJS> wrappedListener = do_QueryInterface(listener);
if (wrappedListener && !target) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));
target = do_QueryInterface(mainThread);
target = SystemGroup::EventTargetFor(TaskCategory::Network);
}
if (target) {
// Guarantee listener freed on main thread. Not sure we need this in child

View File

@ -7,6 +7,7 @@
#include "mozilla/net/ChildDNSService.h"
#include "mozilla/net/DNSRequestChild.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/Unused.h"
#include "nsIDNSRecord.h"
#include "nsHostResolver.h"
@ -210,11 +211,18 @@ DNSRequestChild::StartRequest()
{
// we can only do IPDL on the main thread
if (!NS_IsMainThread()) {
NS_DispatchToMainThread(
SystemGroup::Dispatch(
"StartDNSRequestChild",
TaskCategory::Other,
NewRunnableMethod(this, &DNSRequestChild::StartRequest));
return;
}
nsCOMPtr<nsIEventTarget> systemGroupEventTarget
= SystemGroup::EventTargetFor(TaskCategory::Other);
gNeckoChild->SetEventTargetForActor(this, systemGroupEventTarget);
// Send request to Parent process.
gNeckoChild->SendPDNSRequestConstructor(this, mHost, mOriginAttributes,
mFlags, mNetworkInterface);
@ -306,8 +314,10 @@ DNSRequestChild::Cancel(nsresult reason)
{
if(mIPCOpen) {
// We can only do IPDL on the main thread
NS_DispatchToMainThread(
new CancelDNSRequestEvent(this, reason));
nsCOMPtr<nsIRunnable> runnable = new CancelDNSRequestEvent(this, reason);
SystemGroup::Dispatch("CancelDNSRequest",
TaskCategory::Other,
runnable.forget());
}
return NS_OK;
}

View File

@ -5,11 +5,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/SystemGroup.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/net/ChannelDiverterChild.h"
#include "mozilla/net/FTPChannelChild.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabChild.h"
#include "nsContentUtils.h"
#include "nsFtpProtocolHandler.h"
#include "nsITabChild.h"
#include "nsStringStream.h"
@ -198,6 +201,9 @@ FTPChannelChild::AsyncOpen(::nsIStreamListener* listener, nsISupports* aContext)
rv = mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &openArgs.loadInfo());
NS_ENSURE_SUCCESS(rv, rv);
// This must happen before the constructor message is sent.
EnsureDispatcher();
gNeckoChild->
SendPFTPChannelConstructor(this, tabChild, IPC::SerializedLoadContext(this),
openArgs);
@ -608,7 +614,17 @@ FTPChannelChild::DoOnStopRequest(const nsresult& aChannelStatus,
alertEvent = new nsFtpChildAsyncAlert(prompter,
NS_ConvertASCIItoUTF16(aErrorMsg));
}
NS_DispatchToMainThread(alertEvent);
if (mDispatcher) {
mDispatcher->Dispatch("FTPAlertEvent",
TaskCategory::Other,
alertEvent.forget());
} else {
// In case |mDispatcher| is null, dispatch by SystemGroup.
SystemGroup::Dispatch("FTPAlertEvent",
TaskCategory::Other,
alertEvent.forget());
}
}
}
@ -820,6 +836,9 @@ FTPChannelChild::ConnectParent(uint32_t id)
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
}
// This must happen before the constructor message is sent.
EnsureDispatcher();
// The socket transport in the chrome process now holds a logical ref to us
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
AddIPDLReference();
@ -924,6 +943,27 @@ FTPChannelChild::GetDivertingToParent(bool* aDiverting)
return NS_OK;
}
void
FTPChannelChild::EnsureDispatcher()
{
if (mDispatcher) {
return;
}
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
mDispatcher = nsContentUtils::GetDispatcherByLoadInfo(loadInfo);
if (!mDispatcher) {
return;
}
nsCOMPtr<nsIEventTarget> target =
mDispatcher->EventTargetFor(TaskCategory::Network);
gNeckoChild->SetEventTargetForActor(this, target);
mEventQ->RetargetDeliveryTo(target);
}
} // namespace net
} // namespace mozilla

View File

@ -23,6 +23,9 @@
#include "PrivateBrowsingChannel.h"
namespace mozilla {
class Dispatcher;
namespace net {
// This class inherits logic from nsBaseChannel that is not needed for an
@ -150,6 +153,10 @@ private:
// Set if SendSuspend is called. Determines if SendResume is needed when
// diverting callbacks to parent.
bool mSuspendSent;
RefPtr<Dispatcher> mDispatcher;
void EnsureDispatcher();
};
inline bool

View File

@ -1978,11 +1978,13 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
mAsyncOpenTime = TimeStamp::Now();
#ifdef MOZ_TASK_TRACER
nsCOMPtr<nsIURI> uri;
GetURI(getter_AddRefs(uri));
nsAutoCString urispec;
uri->GetSpec(urispec);
tasktracer::AddLabel("HttpChannelChild::AsyncOpen %s", urispec.get());
if (tasktracer::IsStartLogging()) {
nsCOMPtr<nsIURI> uri;
GetURI(getter_AddRefs(uri));
nsAutoCString urispec;
uri->GetSpec(urispec);
tasktracer::AddLabel("HttpChannelChild::AsyncOpen %s", urispec.get());
}
#endif
@ -2070,46 +2072,27 @@ HttpChannelChild::SetEventTarget()
{
nsCOMPtr<nsILoadInfo> loadInfo;
GetLoadInfo(getter_AddRefs(loadInfo));
if (!loadInfo) {
RefPtr<Dispatcher> dispatcher =
nsContentUtils::GetDispatcherByLoadInfo(loadInfo);
if (!dispatcher) {
return;
}
nsCOMPtr<nsIDOMDocument> domDoc;
loadInfo->GetLoadingDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
RefPtr<Dispatcher> dispatcher;
if (doc) {
dispatcher = doc->GetDocGroup();
} else {
// There's no document yet, but this might be a top-level load where we can
// find a TabGroup.
uint64_t outerWindowId;
if (NS_FAILED(loadInfo->GetOuterWindowID(&outerWindowId))) {
// No window. This might be an add-on XHR, a service worker request, or
// something else.
return;
}
RefPtr<nsGlobalWindow> window = nsGlobalWindow::GetOuterWindowWithId(outerWindowId);
if (!window) {
return;
}
#ifdef DEBUG
if (dispatcher->AsTabGroup()) {
// We have a TabGroup. This must be a top-level load.
bool isMainDocumentChannel;
GetIsMainDocumentChannel(&isMainDocumentChannel);
MOZ_ASSERT(isMainDocumentChannel);
}
#endif
dispatcher = window->TabGroup();
}
if (dispatcher) {
nsCOMPtr<nsIEventTarget> target =
dispatcher->EventTargetFor(TaskCategory::Network);
gNeckoChild->SetEventTargetForActor(this, target);
mEventQ->RetargetDeliveryTo(target);
}
nsCOMPtr<nsIEventTarget> target =
dispatcher->EventTargetFor(TaskCategory::Network);
gNeckoChild->SetEventTargetForActor(this, target);
mEventQ->RetargetDeliveryTo(target);
}
nsresult

View File

@ -5774,7 +5774,7 @@ nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
LOG(("nsHttpChannel::AsyncOpen [this=%p]\n", this));
#ifdef MOZ_TASK_TRACER
{
if (tasktracer::IsStartLogging()) {
uint64_t sourceEventId, parentTaskId;
tasktracer::SourceEventType sourceEventType;
GetCurTraceInfo(&sourceEventId, &parentTaskId, &sourceEventType);

View File

@ -1923,7 +1923,7 @@ nsHttpHandler::NewProxiedChannel2(nsIURI *uri,
givenProxyInfo));
#ifdef MOZ_TASK_TRACER
{
if (tasktracer::IsStartLogging()) {
nsAutoCString urispec;
uri->GetSpec(urispec);
tasktracer::AddLabel("nsHttpHandler::NewProxiedChannel2 %s", urispec.get());

View File

@ -1 +1 @@
NSPR_4_14_BETA2
NSPR_4_15_BETA1

40
nsprpub/configure vendored
View File

@ -2488,7 +2488,7 @@ test -n "$target_alias" &&
program_prefix=${target_alias}-
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=14
MOD_MINOR_VERSION=15
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
@ -5424,6 +5424,40 @@ $as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma diagnostic" >&5
$as_echo_n "checking for pragma diagnostic... " >&6; }
if test "$GNU_CC" = "1"; then
cat >dummy-hello.c <<EOF
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
int main() {
char *dummy = "";
return 0;
}
EOF
${CC} -Werror=unused-but-set-variable -S dummy-hello.c -o dummy-hello.s 2>&5
if test $? != 0; then
${CC} -Werror=unused-but-set-variable -D_PR_HAS_PRAGMA_DIAGNOSTIC -S dummy-hello.c -o dummy-hello.s 2>&5
if test $? = 0; then
CFLAGS="$CFLAGS -D_PR_HAS_PRAGMA_DIAGNOSTIC=1"
_res=yes
else
_res=no
fi
else
_res=no
fi
rm -f dummy-hello.c dummy-hello.s
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_res" >&5
$as_echo "$_res" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
@ -6524,6 +6558,8 @@ fi
$as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
$as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
AS='$(CC) -x assembler-with-cpp'
CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
@ -6975,6 +7011,8 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
$as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
case "${target}" in
*-android*|*-linuxandroid*)
OS_TARGET=Android

View File

@ -15,7 +15,7 @@ dnl ========================================================
dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=14
MOD_MINOR_VERSION=15
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
@ -715,6 +715,40 @@ else
AC_MSG_RESULT([no])
fi
dnl ========================================================
dnl Check for pragma diagnostic
dnl ========================================================
AC_MSG_CHECKING([for pragma diagnostic])
if test "$GNU_CC" = "1"; then
cat >dummy-hello.c <<EOF
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
int main() {
char *dummy = "";
return 0;
}
EOF
${CC} -Werror=unused-but-set-variable -S dummy-hello.c -o dummy-hello.s 2>&5
if test $? != 0; then
${CC} -Werror=unused-but-set-variable -D_PR_HAS_PRAGMA_DIAGNOSTIC -S dummy-hello.c -o dummy-hello.s 2>&5
if test $? = 0; then
CFLAGS="$CFLAGS -D_PR_HAS_PRAGMA_DIAGNOSTIC=1"
_res=yes
else
_res=no
fi
else
_res=no
fi
rm -f dummy-hello.c dummy-hello.s
AC_MSG_RESULT([$_res])
else
AC_MSG_RESULT([no])
fi
dnl ========================================================
dnl Profile guided optimization
dnl ========================================================
@ -1349,6 +1383,7 @@ case "$target" in
AC_DEFINE(DARWIN)
AC_DEFINE(HAVE_BSD_FLOCK)
AC_DEFINE(HAVE_SOCKLEN_T)
AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
AS='$(CC) -x assembler-with-cpp'
CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
@ -1789,6 +1824,7 @@ tools are selected during the Xcode/Developer Tools installation.])
AC_DEFINE(XP_UNIX)
AC_DEFINE(_GNU_SOURCE)
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
case "${target}" in
*-android*|*-linuxandroid*)
OS_TARGET=Android

View File

@ -74,6 +74,10 @@ static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
#endif /* XP_UNIX */
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
{
#ifdef XP_UNIX
@ -88,6 +92,9 @@ PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
#endif
return &VERSION_DESC_NAME;
} /* versionEntryPointType */
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
/* plvrsion.c */

View File

@ -74,6 +74,10 @@ static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
#endif /* XP_UNIX */
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
{
#ifdef XP_UNIX
@ -88,6 +92,9 @@ PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
#endif
return &VERSION_DESC_NAME;
} /* versionEntryPointType */
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
/* plvrsion.c */

View File

@ -74,6 +74,10 @@ static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
#endif /* XP_UNIX */
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
{
#ifdef XP_UNIX
@ -88,6 +92,9 @@ PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
#endif
return &VERSION_DESC_NAME;
} /* versionEntryPointType */
#ifdef _PR_HAS_PRAGMA_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
/* plvrsion.c */

View File

@ -31,9 +31,9 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
#define PR_VERSION "4.14 Beta"
#define PR_VERSION "4.15 Beta"
#define PR_VMAJOR 4
#define PR_VMINOR 14
#define PR_VMINOR 15
#define PR_VPATCH 0
#define PR_BETA PR_TRUE

View File

@ -652,9 +652,11 @@ retry:
if ((NULL != names) && (identity < length))
{
/* what we did is still okay */
memcpy(
names, identity_cache.name,
identity_cache.length * sizeof(char*));
if (identity_cache.length != 0) {
memcpy(
names, identity_cache.name,
identity_cache.length * sizeof(char*));
}
old = identity_cache.name;
identity_cache.name = names;
identity_cache.length = length;

View File

@ -177,19 +177,21 @@ pr_inet_aton(const char *cp, PRUint32 *addr)
case 2: /*%< a.b -- 8.24 bits */
if (val > 0xffffffU)
return (0);
val |= parts[0] << 24;
val |= (unsigned int)parts[0] << 24;
break;
case 3: /*%< a.b.c -- 8.8.16 bits */
if (val > 0xffffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16);
val |= ((unsigned int)parts[0] << 24) | ((unsigned int)parts[1] << 16);
break;
case 4: /*%< a.b.c.d -- 8.8.8.8 bits */
if (val > 0xffU)
return (0);
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
val |= ((unsigned int)parts[0] << 24) |
((unsigned int)parts[1] << 16) |
((unsigned int)parts[2] << 8);
break;
}
*addr = PR_htonl(val);

View File

@ -1405,7 +1405,7 @@ PR_IMPLEMENT(PRStatus) PR_InitializeNetAddr(
PRStatus rv = PR_SUCCESS;
if (!_pr_initialized) _PR_ImplicitInitialization();
if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet));
if (val != PR_IpAddrNull) memset(addr, 0, sizeof(*addr));
addr->inet.family = AF_INET;
addr->inet.port = htons(port);
switch (val)
@ -1777,18 +1777,12 @@ PR_IMPLEMENT(PRUint64) PR_ntohll(PRUint64 n)
#ifdef IS_BIG_ENDIAN
return n;
#else
PRUint64 tmp;
PRUint32 hi, lo;
LL_L2UI(lo, n);
LL_SHR(tmp, n, 32);
LL_L2UI(hi, tmp);
lo = (PRUint32)n;
hi = (PRUint32)(n >> 32);
hi = PR_ntohl(hi);
lo = PR_ntohl(lo);
LL_UI2L(n, lo);
LL_SHL(n, n, 32);
LL_UI2L(tmp, hi);
LL_ADD(n, n, tmp);
return n;
return ((PRUint64)lo << 32) + (PRUint64)hi;
#endif
} /* ntohll */
@ -1797,18 +1791,12 @@ PR_IMPLEMENT(PRUint64) PR_htonll(PRUint64 n)
#ifdef IS_BIG_ENDIAN
return n;
#else
PRUint64 tmp;
PRUint32 hi, lo;
LL_L2UI(lo, n);
LL_SHR(tmp, n, 32);
LL_L2UI(hi, tmp);
lo = (PRUint32)n;
hi = (PRUint32)(n >> 32);
hi = htonl(hi);
lo = htonl(lo);
LL_UI2L(n, lo);
LL_SHL(n, n, 32);
LL_UI2L(tmp, hi);
LL_ADD(n, n, tmp);
return n;
return ((PRUint64)lo << 32) + (PRUint64)hi;
#endif
} /* htonll */

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