From 4c4f2bf1a37b242acdd9c601bf7598aeb44dd2d1 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Thu, 11 Oct 2018 15:13:47 -0700 Subject: [PATCH 01/22] Bug 1494195 - Back out bug 1491946, using '.fxsnapshot.gz' for memory heap snapshots. r=fitzgen --- devtools/client/locales/en-US/memory.properties | 2 +- devtools/client/memory/actions/io.js | 6 ++---- devtools/client/memory/test/unit/head.js | 2 +- devtools/client/memory/utils.js | 5 ++--- devtools/shared/heapsnapshot/HeapSnapshot.cpp | 4 ++-- devtools/shared/heapsnapshot/HeapSnapshot.h | 2 +- devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js | 8 ++++---- dom/chrome-webidl/ChromeUtils.webidl | 4 ++-- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/devtools/client/locales/en-US/memory.properties b/devtools/client/locales/en-US/memory.properties index abb00f23e62e..5dcc77375466 100644 --- a/devtools/client/locales/en-US/memory.properties +++ b/devtools/client/locales/en-US/memory.properties @@ -27,7 +27,7 @@ snapshot.io.save.window=Save Snapshot snapshot.io.import.window=Import Snapshot # LOCALIZATION NOTE (snapshot.io.filter): The title for the filter used to -# filter file types (*.fxsnapshot.gz) +# filter file types (*.fxsnapshot) snapshot.io.filter=Firefox Snapshots # LOCALIZATION NOTE (aggregate.mb): The label annotating the number of bytes (in diff --git a/devtools/client/memory/actions/io.js b/devtools/client/memory/actions/io.js index 2b3e77daf279..eca5b0bc5915 100644 --- a/devtools/client/memory/actions/io.js +++ b/devtools/client/memory/actions/io.js @@ -19,8 +19,7 @@ exports.pickFileAndExportSnapshot = function(snapshot) { const outputFile = await openFilePicker({ title: L10N.getFormatStr("snapshot.io.save.window"), defaultName: OS.Path.basename(snapshot.path), - filters: [[L10N.getFormatStr("snapshot.io.filter"), - "*.fxsnapshot; *.fxsnapshot.gz"]], + filters: [[L10N.getFormatStr("snapshot.io.filter"), "*.fxsnapshot"]], mode: "save", }); @@ -54,8 +53,7 @@ exports.pickFileAndImportSnapshotAndCensus = function(heapWorker) { return async function(dispatch, getState) { const input = await openFilePicker({ title: L10N.getFormatStr("snapshot.io.import.window"), - filters: [[L10N.getFormatStr("snapshot.io.filter"), - "*.fxsnapshot; *.fxsnapshot.gz"]], + filters: [[L10N.getFormatStr("snapshot.io.filter"), "*.fxsnapshot"]], mode: "open", }); diff --git a/devtools/client/memory/test/unit/head.js b/devtools/client/memory/test/unit/head.js index c5d03532d267..b14064f0e6e9 100644 --- a/devtools/client/memory/test/unit/head.js +++ b/devtools/client/memory/test/unit/head.js @@ -126,7 +126,7 @@ function waitUntilCensusState(store, getCensus, expected) { } async function createTempFile() { - const file = FileUtils.getFile("TmpD", ["tmp.fxsnapshot.gz"]); + const file = FileUtils.getFile("TmpD", ["tmp.fxsnapshot"]); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); const destPath = file.path; const stat = await OS.File.stat(destPath); diff --git a/devtools/client/memory/utils.js b/devtools/client/memory/utils.js index 07bb810bba3f..d0135fb6b878 100644 --- a/devtools/client/memory/utils.js +++ b/devtools/client/memory/utils.js @@ -42,9 +42,8 @@ exports.getSnapshotTitle = function(snapshot) { } if (snapshot.imported) { - // Strip out the extension if it's the expected ".fxsnapshot.gz" - // (".gz" optional) - return OS.Path.basename(snapshot.path.replace(/\.fxsnapshot(?:\.gz)?$/, "")); + // Strip out the extension if it's the expected ".fxsnapshot" + return OS.Path.basename(snapshot.path.replace(/\.fxsnapshot$/, "")); } const date = new Date(snapshot.creationTime / 1000); diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.cpp b/devtools/shared/heapsnapshot/HeapSnapshot.cpp index 11d25daa1533..157d67dd5196 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.cpp +++ b/devtools/shared/heapsnapshot/HeapSnapshot.cpp @@ -1449,7 +1449,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv, return nullptr; auto ms = msSinceProcessCreation(now); - rv = file->AppendNative(nsPrintfCString("%lu.fxsnapshot.gz", ms)); + rv = file->AppendNative(nsPrintfCString("%lu.fxsnapshot", ms)); if (NS_WARN_IF(rv.Failed())) return nullptr; @@ -1464,7 +1464,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv, // The snapshot ID must be computed in the process that created the // temp file, because TmpD may not be the same in all processes. outSnapshotId.Assign(Substring(outFilePath, tempPath.Length() + 1, - outFilePath.Length() - tempPath.Length() - sizeof(".fxsnapshot.gz"))); + outFilePath.Length() - tempPath.Length() - sizeof(".fxsnapshot"))); return file.forget(); } diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.h b/devtools/shared/heapsnapshot/HeapSnapshot.h index 9b330a243a6d..d045bfdfdf8b 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.h +++ b/devtools/shared/heapsnapshot/HeapSnapshot.h @@ -116,7 +116,7 @@ public: uint32_t size, ErrorResult& rv); - // Creates the `$TEMP_DIR/XXXXXX-XXX.fxsnapshot.gz` core dump file that heap + // Creates the `$TEMP_DIR/XXXXXX-XXX.fxsnapshot` core dump file that heap // snapshots are serialized into. static already_AddRefed CreateUniqueCoreDumpFile(ErrorResult& rv, const TimeStamp& now, diff --git a/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js b/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js index 313714fece70..a30c3fdd8f0d 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js +++ b/devtools/shared/heapsnapshot/HeapSnapshotFileUtils.js @@ -15,8 +15,8 @@ // // The heap snapshot file path conventions permits the following forms: // -// $TEMP_DIRECTORY/XXXXXXXXXX.fxsnapshot.gz -// $TEMP_DIRECTORY/XXXXXXXXXX-XXXXX.fxsnapshot.gz +// $TEMP_DIRECTORY/XXXXXXXXXX.fxsnapshot +// $TEMP_DIRECTORY/XXXXXXXXXX-XXXXX.fxsnapshot // // Where the strings of "X" are zero or more digits. @@ -28,7 +28,7 @@ loader.lazyRequireGetter(this, "FileUtils", loader.lazyRequireGetter(this, "OS", "resource://gre/modules/osfile.jsm", true); function getHeapSnapshotFileTemplate() { - return OS.Path.join(OS.Constants.Path.tmpDir, `${Date.now()}.fxsnapshot.gz`); + return OS.Path.join(OS.Constants.Path.tmpDir, `${Date.now()}.fxsnapshot`); } /** @@ -63,7 +63,7 @@ exports.getHeapSnapshotTempFilePath = function(snapshotId) { if (!isValidSnapshotFileId(snapshotId)) { return null; } - return OS.Path.join(OS.Constants.Path.tmpDir, snapshotId + ".fxsnapshot.gz"); + return OS.Path.join(OS.Constants.Path.tmpDir, snapshotId + ".fxsnapshot"); }; /** diff --git a/dom/chrome-webidl/ChromeUtils.webidl b/dom/chrome-webidl/ChromeUtils.webidl index 70580df76d83..20c3076478c8 100644 --- a/dom/chrome-webidl/ChromeUtils.webidl +++ b/dom/chrome-webidl/ChromeUtils.webidl @@ -36,7 +36,7 @@ namespace ChromeUtils { * @returns The path to the file the heap snapshot was written * to. This is guaranteed to be within the temp * directory and its file name will match the regexp - * `\d+(\-\d+)?\.fxsnapshot.gz`. + * `\d+(\-\d+)?\.fxsnapshot`. */ [Throws] DOMString saveHeapSnapshot(optional HeapSnapshotBoundaries boundaries); @@ -46,7 +46,7 @@ namespace ChromeUtils { * * @returns The snapshot ID of the file. This is the file name * without the temp directory or the trailing - * `.fxsnapshot.gz`. + * `.fxsnapshot`. */ [Throws] DOMString saveHeapSnapshotGetId(optional HeapSnapshotBoundaries boundaries); From 4bc161d5424c6d3991d9325f8d86123c1e692d23 Mon Sep 17 00:00:00 2001 From: Diego Pino Garcia Date: Fri, 12 Oct 2018 12:59:00 +0300 Subject: [PATCH 02/22] Bug 734063 - Remove the multicol element from nsContentUtils::IsHTMLBlock r=hsivonen --- dom/base/nsContentUtils.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index c6bc7e6e00b9..a986f90fd982 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -1755,7 +1755,6 @@ nsContentUtils::IsHTMLBlock(nsIContent* aContent) nsGkAtoms::li, nsGkAtoms::listing, nsGkAtoms::menu, - nsGkAtoms::multicol, // XXX get rid of this one? nsGkAtoms::nav, nsGkAtoms::ol, nsGkAtoms::p, From 73f65236b338d79c92548a3b610b885d81d364d7 Mon Sep 17 00:00:00 2001 From: tossj Date: Wed, 10 Oct 2018 11:10:28 -0400 Subject: [PATCH 03/22] Bug 1396680 - Add HLS M3U8 MIME types to netmonitor "media" request filter. r=Honza --- .../netmonitor/src/utils/filter-predicates.js | 4 +- .../netmonitor/test/browser_net_filter-01.js | 74 ++++++++++++------- .../test/sjs_content-type-test-server.sjs | 8 ++ 3 files changed, 60 insertions(+), 26 deletions(-) diff --git a/devtools/client/netmonitor/src/utils/filter-predicates.js b/devtools/client/netmonitor/src/utils/filter-predicates.js index 1ca6c53d86d7..bf440d64912c 100644 --- a/devtools/client/netmonitor/src/utils/filter-predicates.js +++ b/devtools/client/netmonitor/src/utils/filter-predicates.js @@ -58,7 +58,9 @@ function isMedia({ mimeType }) { return mimeType && ( mimeType.includes("audio/") || mimeType.includes("video/") || - mimeType.includes("model/")); + mimeType.includes("model/") || + mimeType === "application/vnd.apple.mpegurl" || + mimeType === "application/x-mpegurl"); } function isWS({ requestHeaders, responseHeaders }) { diff --git a/devtools/client/netmonitor/test/browser_net_filter-01.js b/devtools/client/netmonitor/test/browser_net_filter-01.js index 4525355038e5..75af553afce1 100644 --- a/devtools/client/netmonitor/test/browser_net_filter-01.js +++ b/devtools/client/netmonitor/test/browser_net_filter-01.js @@ -28,6 +28,8 @@ const REQUESTS_WITH_MEDIA = BASIC_REQUESTS.concat([ { url: "sjs_content-type-test-server.sjs?fmt=image" }, { url: "sjs_content-type-test-server.sjs?fmt=audio" }, { url: "sjs_content-type-test-server.sjs?fmt=video" }, + { url: "sjs_content-type-test-server.sjs?fmt=hls-m3u8" }, + { url: "sjs_content-type-test-server.sjs?fmt=hls-m3u8-alt-mime-type" }, ]); const REQUESTS_WITH_MEDIA_AND_FLASH = REQUESTS_WITH_MEDIA.concat([ @@ -150,6 +152,28 @@ const EXPECTED_REQUESTS = [ fullMimeType: "video/webm" }, }, + { + method: "GET", + url: CONTENT_TYPE_SJS + "?fmt=hls-m3u8", + data: { + fuzzyUrl: true, + status: 200, + statusText: "OK", + type: "x-mpegurl", + fullMimeType: "application/x-mpegurl" + }, + }, + { + method: "GET", + url: CONTENT_TYPE_SJS + "?fmt=hls-m3u8-alt-mime-type", + data: { + fuzzyUrl: true, + status: 200, + statusText: "OK", + type: "vnd.apple.mpegurl", + fullMimeType: "application/vnd.apple.mpegurl" + }, + }, { method: "GET", url: CONTENT_TYPE_SJS + "?fmt=flash", @@ -208,12 +232,12 @@ add_task(async function() { // First test with single filters... testFilterButtons(monitor, "all"); - await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); + await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-html-button")); testFilterButtons(monitor, "html"); - await testContents([1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Reset filters EventUtils.sendMouseEvent({ type: "click" }, @@ -221,105 +245,105 @@ add_task(async function() { EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-css-button")); testFilterButtons(monitor, "css"); - await testContents([0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]); + await testContents([0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-js-button")); testFilterButtons(monitor, "js"); - await testContents([0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0]); + await testContents([0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-xhr-button")); testFilterButtons(monitor, "xhr"); - await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]); + await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-fonts-button")); testFilterButtons(monitor, "fonts"); - await testContents([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]); + await testContents([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-images-button")); testFilterButtons(monitor, "images"); - await testContents([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]); + await testContents([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-media-button")); testFilterButtons(monitor, "media"); - await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]); + await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-ws-button")); testFilterButtons(monitor, "ws"); - await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); + await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); testFilterButtons(monitor, "all"); - await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); + await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); // Text in filter box that matches nothing should hide all. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter("foobar"); - await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // ASCII text in filter box that matches should filter out everything else. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter("sample"); - await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // ASCII text in filter box that matches should filter out everything else. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter("SAMPLE"); - await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Test negative filtering ASCII text(only show unmatched items) EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter("-sample"); - await testContents([0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]); + await testContents([0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); // Unicode text in filter box that matches should filter out everything else. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter(UNICODE_IN_URI_COMPONENT); - await testContents([0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0]); + await testContents([0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]); // Ditto, except the above is for a Unicode URI component, and this one is for // a Unicode domain name. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter(UNICODE_IN_IDN); - await testContents([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]); + await testContents([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]); // Test negative filtering Unicode text(only show unmatched items) EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter(`-${UNICODE_IN_URI_COMPONENT}`); - await testContents([1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1]); + await testContents([1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]); // Ditto, except the above is for a Unicode URI component, and this one is for // a Unicode domain name. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); setFreetextFilter(`-${UNICODE_IN_IDN}`); - await testContents([0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]); + await testContents([0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1]); // ...then combine multiple filters together. @@ -330,29 +354,29 @@ add_task(async function() { EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-css-button")); testFilterButtonsCustom(monitor, [0, 1, 1, 0, 0, 0, 0, 0, 0, 0]); - await testContents([1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Html and css filter enabled and text filter should show just the html and css match. // Should not show both the items matching the button plus the items matching the text. setFreetextFilter("sample"); - await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); setFreetextFilter(UNICODE_IN_URI_COMPONENT); - await testContents([0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]); + await testContents([0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); setFreetextFilter(""); testFilterButtonsCustom(monitor, [0, 1, 1, 0, 0, 0, 0, 0, 0, 0]); - await testContents([1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Disable some filters. Only one left active. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-css-button")); testFilterButtons(monitor, "html"); - await testContents([1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]); + await testContents([1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Disable last active filter. Should toggle to all. EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-html-button")); testFilterButtons(monitor, "all"); - await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); + await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); // Enable few filters and click on all. Only "all" should be checked. EventUtils.sendMouseEvent({ type: "click" }, @@ -365,7 +389,7 @@ add_task(async function() { EventUtils.sendMouseEvent({ type: "click" }, document.querySelector(".requests-list-filter-all-button")); testFilterButtons(monitor, "all"); - await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); + await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); await teardown(monitor); diff --git a/devtools/client/netmonitor/test/sjs_content-type-test-server.sjs b/devtools/client/netmonitor/test/sjs_content-type-test-server.sjs index 91ec8fe2e7e6..511407d00a4e 100644 --- a/devtools/client/netmonitor/test/sjs_content-type-test-server.sjs +++ b/devtools/client/netmonitor/test/sjs_content-type-test-server.sjs @@ -266,6 +266,14 @@ function handleRequest(request, response) { response.finish(); break; } + case "hls-m3u8-alt-mime-type": { + response.setStatusLine(request.httpVersion, status, "OK"); + response.setHeader("Content-Type", "application/vnd.apple.mpegurl", false); + setCacheHeaders(); + response.write("#EXTM3U\n"); + response.finish(); + break; + } case "mpeg-dash": { response.setStatusLine(request.httpVersion, status, "OK"); response.setHeader("Content-Type", "video/vnd.mpeg.dash.mpd", false); From 2dae3826d6e81467c2f6943e6e376931c28b7097 Mon Sep 17 00:00:00 2001 From: sotaro Date: Mon, 15 Oct 2018 20:28:01 +0900 Subject: [PATCH 04/22] Bug 1498092 - Add necessary forced frame rendering r=nical --- gfx/layers/ipc/CompositorBridgeParent.cpp | 2 +- gfx/layers/wr/WebRenderBridgeParent.cpp | 11 ++++++++--- gfx/layers/wr/WebRenderBridgeParent.h | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp index 87e6fb79d8c4..c19fb6aec84a 100644 --- a/gfx/layers/ipc/CompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CompositorBridgeParent.cpp @@ -645,7 +645,7 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvForcePresent() { if (mWrBridge) { - mWrBridge->ScheduleGenerateFrame(); + mWrBridge->ScheduleForcedGenerateFrame(); } // During the shutdown sequence mLayerManager may be null if (mLayerManager) { diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 464be3376015..014161c83446 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -1389,18 +1389,23 @@ WebRenderBridgeParent::UpdateWebRender(CompositorVsyncScheduler* aScheduler, mozilla::ipc::IPCResult WebRenderBridgeParent::RecvScheduleComposite() +{ + ScheduleGenerateFrame(); + return IPC_OK(); +} + +void +WebRenderBridgeParent::ScheduleForcedGenerateFrame() { if (mDestroyed) { - return IPC_OK(); + return; } - // Force frame rendering during next frame generation. wr::TransactionBuilder fastTxn(/* aUseSceneBuilderThread */ false); fastTxn.InvalidateRenderedFrame(); mApi->SendTransaction(fastTxn); ScheduleGenerateFrame(); - return IPC_OK(); } mozilla::ipc::IPCResult diff --git a/gfx/layers/wr/WebRenderBridgeParent.h b/gfx/layers/wr/WebRenderBridgeParent.h index 1f1f891f1ece..61af38500de0 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.h +++ b/gfx/layers/wr/WebRenderBridgeParent.h @@ -186,6 +186,14 @@ public: */ void ScheduleGenerateFrame(); + /** + * Schedule forced frame rendering at next composite timing. + * + * WebRender could skip frame rendering if there is no update. + * This function is used to force rendering even when there is not update. + */ + void ScheduleForcedGenerateFrame(); + wr::Epoch UpdateWebRender(CompositorVsyncScheduler* aScheduler, wr::WebRenderAPI* aApi, AsyncImagePipelineManager* aImageMgr, From 9f39be4f0fa2ef0131942c14027ee780a8eb53ad Mon Sep 17 00:00:00 2001 From: tossj Date: Mon, 8 Oct 2018 21:11:00 -0400 Subject: [PATCH 05/22] Bug 1361739 - Fix Params Panel to display empty values when multiple values exist for one parameter. r=Honza --- .../netmonitor/src/components/ParamsPanel.js | 2 +- .../test/browser_net_complex-params.js | 58 ++++++++++++++++--- .../test/html_params-test-page.html | 2 + 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/devtools/client/netmonitor/src/components/ParamsPanel.js b/devtools/client/netmonitor/src/components/ParamsPanel.js index 63a3c524c270..a449d4c292f7 100644 --- a/devtools/client/netmonitor/src/components/ParamsPanel.js +++ b/devtools/client/netmonitor/src/components/ParamsPanel.js @@ -82,7 +82,7 @@ class ParamsPanel extends Component { getProperties(arr) { return arr.reduce((map, obj) => { const value = map[obj.name]; - if (value) { + if (value || value === "") { if (typeof value !== "object") { map[obj.name] = [value]; } diff --git a/devtools/client/netmonitor/test/browser_net_complex-params.js b/devtools/client/netmonitor/test/browser_net_complex-params.js index 70ac96d67433..56b44c8dc11b 100644 --- a/devtools/client/netmonitor/test/browser_net_complex-params.js +++ b/devtools/client/netmonitor/test/browser_net_complex-params.js @@ -19,7 +19,7 @@ add_task(async function() { store.dispatch(Actions.batchEnable(false)); // Execute requests. - await performRequests(monitor, tab, 10); + await performRequests(monitor, tab, 12); wait = waitForDOM(document, "#params-panel .tree-section", 2); EventUtils.sendMouseEvent({ type: "mousedown" }, @@ -85,6 +85,23 @@ add_task(async function() { ["species", "in=(52,60)"], ])); + wait = waitForDOM(document, "#params-panel .tree-section", 1); + EventUtils.sendMouseEvent({ type: "mousedown" }, + document.querySelectorAll(".request-list-item")[10]); + await wait; + testParamsTabGetWithArgs(new Map([ + ["a", ["", "b"]], + ])); + + wait = waitForDOM(document, "#params-panel .tree-section", 1); + EventUtils.sendMouseEvent({ type: "mousedown" }, + document.querySelectorAll(".request-list-item")[11]); + await wait; + testParamsTabGetWithArgs(new Map([ + ["a", ["b", "c"]], + ["d", "1"] + ])); + await teardown(monitor); function testParamsTab1(queryStringParamName, queryStringParamValue, @@ -198,15 +215,22 @@ add_task(async function() { } /** - * @param {Map} expectedParams A map of expected parameter keys and values - * as Strings. + * @param {Map} expectedParams A map of expected parameter keys, and values + * as Strings or an array of Strings if the parameter key has multiple + * values */ function testParamsTabGetWithArgs(expectedParams) { const tabpanel = document.querySelector("#params-panel"); + let numParamRows = 0; + expectedParams.forEach((v, k, m) => { + numParamRows += (typeof v === "object" ? v.length + 1 : 1); + }); + is(tabpanel.querySelectorAll(".tree-section").length, 1, "Check the number of param tree sections displayed in this tabpanel."); - is(tabpanel.querySelectorAll("tr:not(.tree-section).treeRow").length, 1, + is(tabpanel.querySelectorAll("tr:not(.tree-section).treeRow").length, + numParamRows, "Check the number of param rows displayed in this tabpanel."); ok(!tabpanel.querySelector(".empty-notice"), "The empty notice should not be displayed in this tabpanel."); @@ -229,10 +253,28 @@ add_task(async function() { const labelsIter = labels.values(); const valuesIter = values.values(); for (const [expKey, expValue] of expectedParams) { - const label = labelsIter.next().value; - const value = valuesIter.next().value; - is(label.textContent, expKey, "Check that parameter name matches."); - is(value.textContent, expValue, "Check that parameter value matches."); + let label = labelsIter.next().value; + let value = valuesIter.next().value; + + if (typeof expValue === "object") { + // multiple values for one parameter + is(label.textContent, expKey, "Check that parameter name matches."); + is(value.textContent, "[\u2026]", // horizontal ellipsis + "Check that parameter value indicates multiple."); + + for (let i = 0; i < expValue.length; i++) { + label = labelsIter.next().value; + value = valuesIter.next().value; + is(label.textContent, i + "", + "Check that multi-value parameter index matches."); + is(value.textContent, expValue[i], + "Check that multi-value parameter value matches."); + is(label.dataset.level, 2, "Check that parameter is nested."); + } + } else { + is(label.textContent, expKey, "Check that parameter name matches."); + is(value.textContent, expValue, "Check that parameter value matches."); + } } } }); diff --git a/devtools/client/netmonitor/test/html_params-test-page.html b/devtools/client/netmonitor/test/html_params-test-page.html index 98d2d9b47bfb..4bdb248b8529 100644 --- a/devtools/client/netmonitor/test/html_params-test-page.html +++ b/devtools/client/netmonitor/test/html_params-test-page.html @@ -69,6 +69,8 @@ await patch("baz", "?a=b", urlencoded, '{ "foo": "bar" }'); await put("baz", "?a=b", urlencoded, '{ "foo": "bar" }'); await get("baz", "?species=in=(52,60)"); + await get("baz", "?a=&a=b"); + await get("baz", "?a=b&a=c&d=1"); } From 8281a7e7bb694309efe26f1260e4849e19bd5e7e Mon Sep 17 00:00:00 2001 From: "florin.strugariu" Date: Wed, 3 Oct 2018 11:03:04 +0300 Subject: [PATCH 06/22] Bug 1477870 - Talos fails to find module 'util' when run locally in moziila-build environment. r=rwood --- testing/talos/requirements.txt | 1 + testing/talos/talos/cmanager_mac.py | 2 +- testing/talos/talos/cmanager_win32.py | 4 ++-- testing/talos/talos/mainthreadio.py | 4 ++-- testing/talos/talos/output.py | 4 ++-- testing/talos/talos/run_tests.py | 3 ++- testing/talos/talos/talos_process.py | 2 +- testing/talos/talos/ttest.py | 7 ++++--- testing/talos/talos/whitelist.py | 2 +- 9 files changed, 16 insertions(+), 13 deletions(-) diff --git a/testing/talos/requirements.txt b/testing/talos/requirements.txt index c6942bf02f3f..50411dfc1c85 100644 --- a/testing/talos/requirements.txt +++ b/testing/talos/requirements.txt @@ -7,6 +7,7 @@ mozinfo>=0.8 mozprocess>=0.22 mozversion>=1.3 mozprofile>=0.25 +mozrunner>=7.1.0 psutil>=3.1.1 simplejson>=2.1.1 requests>=2.9.1 diff --git a/testing/talos/talos/cmanager_mac.py b/testing/talos/talos/cmanager_mac.py index 72df5d1e6700..0b2a66ddd24c 100644 --- a/testing/talos/talos/cmanager_mac.py +++ b/testing/talos/talos/cmanager_mac.py @@ -8,7 +8,7 @@ from __future__ import absolute_import, print_function import subprocess import sys -from cmanager_base import CounterManager +from talos.cmanager_base import CounterManager def GetProcessData(pid): diff --git a/testing/talos/talos/cmanager_win32.py b/testing/talos/talos/cmanager_win32.py index e8145eca0dfc..dea8f4b10945 100644 --- a/testing/talos/talos/cmanager_win32.py +++ b/testing/talos/talos/cmanager_win32.py @@ -10,8 +10,8 @@ from ctypes import windll from ctypes.wintypes import DWORD, HANDLE, LPSTR, LPCSTR, LPCWSTR, Structure, \ pointer, LONG -from cmanager_base import CounterManager -from utils import TalosError +from talos.cmanager_base import CounterManager +from talos.utils import TalosError pdh = windll.pdh diff --git a/testing/talos/talos/mainthreadio.py b/testing/talos/talos/mainthreadio.py index ee63738f1aa5..bc7e342959f8 100644 --- a/testing/talos/talos/mainthreadio.py +++ b/testing/talos/talos/mainthreadio.py @@ -7,8 +7,8 @@ from __future__ import absolute_import, print_function import os import re -import utils -import whitelist +from talos import utils +from talos import whitelist from collections import OrderedDict diff --git a/testing/talos/talos/output.py b/testing/talos/talos/output.py index 126bd6d22266..5f1edbf7ea45 100755 --- a/testing/talos/talos/output.py +++ b/testing/talos/talos/output.py @@ -6,10 +6,10 @@ """output formats for Talos""" from __future__ import absolute_import -import filter +from talos import filter # NOTE: we have a circular dependency with output.py when we import results import simplejson as json -import utils +from talos import utils from mozlog import get_proxy_logger LOG = get_proxy_logger() diff --git a/testing/talos/talos/run_tests.py b/testing/talos/talos/run_tests.py index 24ebbe6138a6..e61be83ebe6d 100755 --- a/testing/talos/talos/run_tests.py +++ b/testing/talos/talos/run_tests.py @@ -16,7 +16,8 @@ import urllib import mozhttpd import mozinfo import mozversion -import utils + +from talos import utils from mozlog import get_proxy_logger from talos.config import get_configs, ConfigurationError from talos.mitmproxy import mitmproxy diff --git a/testing/talos/talos/talos_process.py b/testing/talos/talos/talos_process.py index 9d3d697c0b63..552abf30b29e 100644 --- a/testing/talos/talos/talos_process.py +++ b/testing/talos/talos/talos_process.py @@ -14,7 +14,7 @@ import mozcrash import psutil from mozlog import get_proxy_logger from mozprocess import ProcessHandler -from utils import TalosError +from talos.utils import TalosError LOG = get_proxy_logger() diff --git a/testing/talos/talos/ttest.py b/testing/talos/talos/ttest.py index 8d2f49109b8d..87a867bdc4ca 100644 --- a/testing/talos/talos/ttest.py +++ b/testing/talos/talos/ttest.py @@ -23,13 +23,14 @@ import time import mozcrash import mozfile -import results -import talosconfig -import utils + from mozlog import get_proxy_logger from talos.cmanager import CounterManagement from talos.ffsetup import FFSetup from talos.talos_process import run_browser +from talos import utils +from talos import results +from talos import talosconfig from talos.utils import TalosCrash, TalosError, TalosRegression, run_in_debug_mode LOG = get_proxy_logger() diff --git a/testing/talos/talos/whitelist.py b/testing/talos/talos/whitelist.py index 87dbad5f855c..816462d8835b 100644 --- a/testing/talos/talos/whitelist.py +++ b/testing/talos/talos/whitelist.py @@ -8,7 +8,7 @@ from __future__ import absolute_import, print_function import json import os import re -import utils +from talos import utils KEY_XRE = '{xre}' DEFAULT_DURATION = 100.0 From a994b7ec92e55bc58510ae1a0612ac635d98b682 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 31 Mar 2015 19:30:36 +0100 Subject: [PATCH 07/22] Bug 1149304 - Reftest for repaint issues when changing CSS transform. r=roc --- .../bugs/1149304-1-transform-change-ref.html | 13 +++++++++++ .../bugs/1149304-1-transform-change.html | 23 +++++++++++++++++++ layout/reftests/bugs/reftest.list | 1 + 3 files changed, 37 insertions(+) create mode 100644 layout/reftests/bugs/1149304-1-transform-change-ref.html create mode 100644 layout/reftests/bugs/1149304-1-transform-change.html diff --git a/layout/reftests/bugs/1149304-1-transform-change-ref.html b/layout/reftests/bugs/1149304-1-transform-change-ref.html new file mode 100644 index 000000000000..52214ac420c1 --- /dev/null +++ b/layout/reftests/bugs/1149304-1-transform-change-ref.html @@ -0,0 +1,13 @@ + + + + + + +

         

+ + diff --git a/layout/reftests/bugs/1149304-1-transform-change.html b/layout/reftests/bugs/1149304-1-transform-change.html new file mode 100644 index 000000000000..7eb2e5dcd22b --- /dev/null +++ b/layout/reftests/bugs/1149304-1-transform-change.html @@ -0,0 +1,23 @@ + + + + + + + +

         

+ + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index a5de3f25cc5c..c453ef8b42f3 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1939,6 +1939,7 @@ skip-if(!Android) fails-if(Android) == 1133905-3-vh-rtl.html 1133905-ref-vh-rtl. skip-if(!Android) == 1133905-4-vh-rtl.html 1133905-ref-vh-rtl.html skip-if(!Android) fails-if(Android) == 1133905-5-vh-rtl.html 1133905-ref-vh-rtl.html skip-if(!Android) fails-if(Android) == 1133905-6-vh-rtl.html 1133905-ref-vh-rtl.html +== 1149304-1-transform-change.html 1149304-1-transform-change-ref.html == 1150021-1.xul 1150021-1-ref.xul == 1151145-1.html 1151145-1-ref.html == 1151306-1.html 1151306-1-ref.html From dac2a199470ac2e9bdc3de01f02e526a9997c12c Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Mon, 15 Oct 2018 12:00:23 +0200 Subject: [PATCH 08/22] Bug 1495862 - Ensure FeaturePolicy creation in the document, r=ckerschb --- dom/base/nsDocument.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 79d7bd77cf48..312aefab70cc 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -2137,6 +2137,11 @@ nsDocument::Init() mScriptLoader = new dom::ScriptLoader(this); + // we need to create a policy here so getting the policy within + // ::Policy() can *always* return a non null policy + mFeaturePolicy = new FeaturePolicy(this); + mFeaturePolicy->SetDefaultOrigin(NodePrincipal()); + mozilla::HoldJSObjects(this); return NS_OK; @@ -3012,11 +3017,9 @@ nsIDocument::InitCSP(nsIChannel* aChannel) nsresult nsIDocument::InitFeaturePolicy(nsIChannel* aChannel) { - MOZ_ASSERT(!mFeaturePolicy, "we should only call init once"); + MOZ_ASSERT(mFeaturePolicy, "we should only call init once"); - // we need to create a policy here so getting the policy within - // ::Policy() can *always* return a non null policy - mFeaturePolicy = new FeaturePolicy(this); + mFeaturePolicy->ResetDeclaredPolicy(); if (!StaticPrefs::dom_security_featurePolicy_enabled()) { return NS_OK; From 167ef3084376c49a48e8c7ad5a358d743b0e2fa1 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 15 Oct 2018 09:32:51 -0400 Subject: [PATCH 09/22] Bug 1494151. Fix broken web platform test that was trying to connect on a non-existent port. r=jgraham --- .../EventListener-addEventListener.sub.window.js.ini | 5 ----- .../events/EventListener-incumbent-global-1.sub.html.ini | 9 --------- .../events/EventListener-addEventListener.sub.window.js | 2 +- 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 testing/web-platform/meta/dom/events/EventListener-addEventListener.sub.window.js.ini delete mode 100644 testing/web-platform/meta/dom/events/EventListener-incumbent-global-1.sub.html.ini diff --git a/testing/web-platform/meta/dom/events/EventListener-addEventListener.sub.window.js.ini b/testing/web-platform/meta/dom/events/EventListener-addEventListener.sub.window.js.ini deleted file mode 100644 index f88c23107ed6..000000000000 --- a/testing/web-platform/meta/dom/events/EventListener-addEventListener.sub.window.js.ini +++ /dev/null @@ -1,5 +0,0 @@ -[EventListener-addEventListener.sub.window.html] - expected: TIMEOUT - [EventListener.addEventListener doesn't throw when a cross origin object is passed in.] - expected: TIMEOUT - diff --git a/testing/web-platform/meta/dom/events/EventListener-incumbent-global-1.sub.html.ini b/testing/web-platform/meta/dom/events/EventListener-incumbent-global-1.sub.html.ini deleted file mode 100644 index 057d9dc54d85..000000000000 --- a/testing/web-platform/meta/dom/events/EventListener-incumbent-global-1.sub.html.ini +++ /dev/null @@ -1,9 +0,0 @@ -[EventListener-incumbent-global-1.sub.html] - expected: - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - [Check the incumbent global EventListeners are called with] - expected: - if not debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - if debug and not webrender and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): TIMEOUT - diff --git a/testing/web-platform/tests/dom/events/EventListener-addEventListener.sub.window.js b/testing/web-platform/tests/dom/events/EventListener-addEventListener.sub.window.js index b658140eea87..b44bc332859d 100644 --- a/testing/web-platform/tests/dom/events/EventListener-addEventListener.sub.window.js +++ b/testing/web-platform/tests/dom/events/EventListener-addEventListener.sub.window.js @@ -1,6 +1,6 @@ async_test(function(t) { let crossOriginFrame = document.createElement('iframe'); - crossOriginFrame.src = 'https://{{hosts[alt][]}}/common/blank.html'; + crossOriginFrame.src = 'https://{{hosts[alt][]}}:{{ports[https][0]}}/common/blank.html'; document.body.appendChild(crossOriginFrame); crossOriginFrame.addEventListener('load', t.step_func_done(function() { let crossOriginWindow = crossOriginFrame.contentWindow; From e94af8f1b28174b9eecf72ac9a426259a007e464 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 15 Oct 2018 10:06:53 -0400 Subject: [PATCH 10/22] Bug 1498102 - Add a rejection handler to another promise chain in the test which was forgotten in the previous debugging patch --- .../test/browser/browser_blockingServiceWorkers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js b/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js index f536037528d2..a2f0a1f0d6c2 100644 --- a/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js +++ b/toolkit/components/antitracking/test/browser/browser_blockingServiceWorkers.js @@ -4,7 +4,8 @@ AntiTracking.runTest("ServiceWorkers", async _ => { await navigator.serviceWorker.register("empty.js").then( _ => { ok(false, "ServiceWorker cannot be used!"); }, - _ => { ok(true, "ServiceWorker cannot be used!"); }); + _ => { ok(true, "ServiceWorker cannot be used!"); }). + catch(e => ok(false, "Promise rejected: " + e)); }, null, async _ => { From 86262308080e8a45e3b7db3ac29926f58050eb45 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Fri, 12 Oct 2018 12:55:16 -0500 Subject: [PATCH 11/22] Bug 1498672 Include string.h explicitly instead of relying on algorithm to bring it in r=bobowen The mingw-clang build was broken because the dependency wasn't specified explicitly. --- .../sandbox/chromium-shim/sandbox/win/permissionsService.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/security/sandbox/chromium-shim/sandbox/win/permissionsService.cpp b/security/sandbox/chromium-shim/sandbox/win/permissionsService.cpp index 7dbea4d51312..80ee82ed51bb 100644 --- a/security/sandbox/chromium-shim/sandbox/win/permissionsService.cpp +++ b/security/sandbox/chromium-shim/sandbox/win/permissionsService.cpp @@ -8,6 +8,7 @@ #include "permissionsService.h" #include +#include #include namespace mozilla { From ba7241c9d7dd17df8c775028a01e4537e449b52e Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Fri, 12 Oct 2018 13:15:33 -0500 Subject: [PATCH 12/22] Bug 1498676 - Revert the __try/__except mapping (part of Bug 1431803) for MinGW from the sandbox code r=bobowen This is no longer necessary, and in fact breaks the sandbox compilation, because code inside the transformed-else blocks is only valid inside an __except block --- mozilla-config.h.in | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/mozilla-config.h.in b/mozilla-config.h.in index e3e026872ab8..51624d7186f2 100644 --- a/mozilla-config.h.in +++ b/mozilla-config.h.in @@ -45,17 +45,6 @@ */ #if defined(CHROMIUM_SANDBOX_BUILD) && defined(XP_WIN) #include "base/win/sdkdecls.h" - -#ifdef __MINGW32__ -/* - * MinGW doesn't support __try / __except. There are a few mechanisms available - * to hack around it and pseudo-support it, but these are untested in Firefox. - * What is tested (and works) is replacing them with if(true) and else. - */ -#define __try if(true) -#define __except(x) else - -#endif /* __MINGW32__ */ #endif /* defined(CHROMIUM_SANDBOX_BUILD) && defined(XP_WIN) */ #endif /* MOZILLA_CONFIG_H */ From 8ae788d2db64b5526effbe7bfdc25858d5b65296 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Fri, 12 Oct 2018 13:44:37 -0500 Subject: [PATCH 13/22] Bug 1498693 - Revert the other part of 1431803, since mingw-clang can handle it now r=bobowen --- .../with_update/mingw_disable_one_try.patch | 51 ------------------- .../patches/with_update/patch_order.txt | 3 +- .../base/threading/platform_thread_win.cc | 3 -- 3 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 security/sandbox/chromium-shim/patches/with_update/mingw_disable_one_try.patch diff --git a/security/sandbox/chromium-shim/patches/with_update/mingw_disable_one_try.patch b/security/sandbox/chromium-shim/patches/with_update/mingw_disable_one_try.patch deleted file mode 100644 index d5b700ea8f31..000000000000 --- a/security/sandbox/chromium-shim/patches/with_update/mingw_disable_one_try.patch +++ /dev/null @@ -1,51 +0,0 @@ -# HG changeset patch -# User Tom Ritter -# Date 1516389982 21600 -# Fri Jan 19 13:26:22 2018 -0600 -# Node ID 3ca7306d73ebc1ce47ccdc62ee8cbb69a9bfbb2c -# Parent 6aa6c7d894609140ccde2e9e50eba8c25a9caeb5 -Bug 1431803 Disable a specific __try block on MinGW r?bobowen - -This function is a technique to name a thread for debugging purposes, -and it always throws an exception (and then continues). On MinGW -we don't want it to throw an exception, so we do nothing. - -This means on MinGW we won't get nice thread naming during debugging, -but we'll limp along. - -MozReview-Commit-ID: JRKY4wp7sdu - -diff --git a/security/sandbox/chromium/base/threading/platform_thread_win.cc b/security/sandbox/chromium/base/threading/platform_thread_win.cc ---- a/security/sandbox/chromium/base/threading/platform_thread_win.cc -+++ b/security/sandbox/chromium/base/threading/platform_thread_win.cc -@@ -32,27 +32,30 @@ typedef struct tagTHREADNAME_INFO { - } THREADNAME_INFO; - - // The SetThreadDescription API was brought in version 1607 of Windows 10. - typedef HRESULT(WINAPI* SetThreadDescription)(HANDLE hThread, - PCWSTR lpThreadDescription); - - // This function has try handling, so it is separated out of its caller. - void SetNameInternal(PlatformThreadId thread_id, const char* name) { -+ //This function is only used for debugging purposes, as you can find by its caller -+#ifndef __MINGW32__ - THREADNAME_INFO info; - info.dwType = 0x1000; - info.szName = name; - info.dwThreadID = thread_id; - info.dwFlags = 0; - - __try { - RaiseException(kVCThreadNameException, 0, sizeof(info)/sizeof(DWORD), - reinterpret_cast(&info)); - } __except(EXCEPTION_CONTINUE_EXECUTION) { - } -+#endif - } - - struct ThreadParams { - PlatformThread::Delegate* delegate; - bool joinable; - ThreadPriority priority; - }; - diff --git a/security/sandbox/chromium-shim/patches/with_update/patch_order.txt b/security/sandbox/chromium-shim/patches/with_update/patch_order.txt index a5f689c3a6cc..22163e46c15c 100755 --- a/security/sandbox/chromium-shim/patches/with_update/patch_order.txt +++ b/security/sandbox/chromium-shim/patches/with_update/patch_order.txt @@ -18,6 +18,5 @@ mingw_copy_s.patch mingw_operator_new.patch mingw_cast_getprocaddress.patch mingw_capitalization.patch -mingw_disable_one_try.patch mingw_noexports_casts.patch -mingw_offsetof.patch \ No newline at end of file +mingw_offsetof.patch diff --git a/security/sandbox/chromium/base/threading/platform_thread_win.cc b/security/sandbox/chromium/base/threading/platform_thread_win.cc index e2aa60b3e5a9..021c0df26093 100644 --- a/security/sandbox/chromium/base/threading/platform_thread_win.cc +++ b/security/sandbox/chromium/base/threading/platform_thread_win.cc @@ -37,8 +37,6 @@ typedef HRESULT(WINAPI* SetThreadDescription)(HANDLE hThread, // This function has try handling, so it is separated out of its caller. void SetNameInternal(PlatformThreadId thread_id, const char* name) { - //This function is only used for debugging purposes, as you can find by its caller -#ifndef __MINGW32__ THREADNAME_INFO info; info.dwType = 0x1000; info.szName = name; @@ -50,7 +48,6 @@ void SetNameInternal(PlatformThreadId thread_id, const char* name) { reinterpret_cast(&info)); } __except(EXCEPTION_CONTINUE_EXECUTION) { } -#endif } struct ThreadParams { From eba28f888dcb2bc041a23ee5e78fbffe303716e5 Mon Sep 17 00:00:00 2001 From: Dale Harvey Date: Wed, 26 Sep 2018 21:09:00 +0100 Subject: [PATCH 14/22] Bug 1363169 - Add support for native windows share. r=gijs, r=aklotz --- browser/base/content/browser-pageActions.js | 14 +- browser/base/content/test/urlbar/browser.ini | 4 + .../browser_page_action_menu_share_win.html | 2 + .../browser_page_action_menu_share_win.js | 45 ++++++ browser/modules/PageActions.jsm | 15 ++ browser/themes/windows/browser.css | 4 + browser/themes/windows/jar.mn | 1 + browser/themes/windows/share.svg | 7 + widget/nsIWindowsUIUtils.idl | 6 +- widget/windows/WindowsUIUtils.cpp | 131 ++++++++++++++++++ 10 files changed, 224 insertions(+), 5 deletions(-) create mode 100644 browser/base/content/test/urlbar/browser_page_action_menu_share_win.html create mode 100644 browser/base/content/test/urlbar/browser_page_action_menu_share_win.js create mode 100644 browser/themes/windows/share.svg diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index 3f604a151d32..c2d47527d5f9 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -1203,6 +1203,12 @@ BrowserPageActions.addSearchEngine = { // share URL BrowserPageActions.shareURL = { + onCommand(event, buttonNode) { + let browser = gBrowser.selectedBrowser; + let currentURI = gURLBar.makeURIReadable(browser.currentURI).displaySpec; + this._windowsUIUtils.shareUrl(currentURI, browser.contentTitle); + }, + onShowingInPanel(buttonNode) { this._cached = false; }, @@ -1264,7 +1270,7 @@ BrowserPageActions.shareURL = { }; // Attach sharingService here so tests can override the implementation -XPCOMUtils.defineLazyServiceGetter(BrowserPageActions.shareURL, - "_sharingService", - "@mozilla.org/widget/macsharingservice;1", - "nsIMacSharingService"); +XPCOMUtils.defineLazyServiceGetters(BrowserPageActions.shareURL, { + _sharingService: ["@mozilla.org/widget/macsharingservice;1", "nsIMacSharingService"], + _windowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"], +}); diff --git a/browser/base/content/test/urlbar/browser.ini b/browser/base/content/test/urlbar/browser.ini index 4166c66650ee..edfbab3e05ae 100644 --- a/browser/base/content/test/urlbar/browser.ini +++ b/browser/base/content/test/urlbar/browser.ini @@ -57,6 +57,10 @@ support-files = subsuite = clipboard [browser_page_action_menu_share_mac.js] skip-if = os != "mac" # Mac only feature +[browser_page_action_menu_share_win.js] +support-files = + browser_page_action_menu_share_win.html +skip-if = os != "win" # Windows only feature [browser_pasteAndGo.js] subsuite = clipboard [browser_populateAfterPushState.js] diff --git a/browser/base/content/test/urlbar/browser_page_action_menu_share_win.html b/browser/base/content/test/urlbar/browser_page_action_menu_share_win.html new file mode 100644 index 000000000000..6c47f98c7e24 --- /dev/null +++ b/browser/base/content/test/urlbar/browser_page_action_menu_share_win.html @@ -0,0 +1,2 @@ + +Windows Sharing diff --git a/browser/base/content/test/urlbar/browser_page_action_menu_share_win.js b/browser/base/content/test/urlbar/browser_page_action_menu_share_win.js new file mode 100644 index 000000000000..f98602571578 --- /dev/null +++ b/browser/base/content/test/urlbar/browser_page_action_menu_share_win.js @@ -0,0 +1,45 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/* global sinon */ +Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js"); + +const TEST_URL = getRootDirectory(gTestPath) + "browser_page_action_menu_share_win.html"; + +// Keep track of site details we are sharing +let sharedUrl, sharedTitle; + +let stub = sinon.stub(BrowserPageActions.shareURL, "_windowsUIUtils").get(() => { + return { + shareUrl(url, title) { + sharedUrl = url; + sharedTitle = title; + }, + }; +}); + +registerCleanupFunction(async function() { + stub.restore(); + delete window.sinon; +}); + +add_task(async function shareURL() { + await BrowserTestUtils.withNewTab(TEST_URL, async () => { + // Open the panel. + await promisePageActionPanelOpen(); + + // Click Share URL. + let shareURLButton = document.getElementById("pageAction-panel-shareURL"); + let hiddenPromise = promisePageActionPanelHidden(); + EventUtils.synthesizeMouseAtCenter(shareURLButton, {}); + + await hiddenPromise; + + Assert.equal(sharedUrl, TEST_URL, + "Shared correct URL"); + Assert.equal(sharedTitle, "Windows Sharing", + "Shared with the correct title"); + }); +}); diff --git a/browser/modules/PageActions.jsm b/browser/modules/PageActions.jsm index 7f8455fe9068..af682725f0e4 100644 --- a/browser/modules/PageActions.jsm +++ b/browser/modules/PageActions.jsm @@ -1185,6 +1185,21 @@ if (AppConstants.platform == "macosx") { }); } +if (AppConstants.isPlatformAndVersionAtLeast("win", "6.4")) { + gBuiltInActions.push( + // Share URL + { + id: "shareURL", + title: "shareURL-title", + onBeforePlacedInWindow(buttonNode) { + browserPageActions(buttonNode).shareURL.onBeforePlacedInWindow(buttonNode); + }, + onCommand(event, buttonNode) { + browserPageActions(buttonNode).shareURL.onCommand(event, buttonNode); + }, + }); +} + /** * Gets a BrowserPageActions object in a browser window. * diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index ae3f43ffc188..9de31faebd5d 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -597,6 +597,10 @@ html|*.urlbar-input:-moz-lwtheme::placeholder, color: GrayText; } +#pageAction-panel-shareURL { + list-style-image: url("chrome://browser/skin/share.svg"); +} + %include ../shared/urlbarSearchSuggestionsNotification.inc.css #search-container { diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn index e6ce8e18a498..57e60ea7cbaa 100644 --- a/browser/themes/windows/jar.mn +++ b/browser/themes/windows/jar.mn @@ -41,6 +41,7 @@ browser.jar: * skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css) * skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css) skin/classic/browser/preferences/applications.css (preferences/applications.css) + skin/classic/browser/share.svg (share.svg) skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) skin/classic/browser/window-controls/close.svg (window-controls/close.svg) skin/classic/browser/window-controls/close-highcontrast.svg (window-controls/close-highcontrast.svg) diff --git a/browser/themes/windows/share.svg b/browser/themes/windows/share.svg new file mode 100644 index 000000000000..3d5c2fe86f2b --- /dev/null +++ b/browser/themes/windows/share.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/widget/nsIWindowsUIUtils.idl b/widget/nsIWindowsUIUtils.idl index 331562a67245..779cc4ac9af5 100644 --- a/widget/nsIWindowsUIUtils.idl +++ b/widget/nsIWindowsUIUtils.idl @@ -20,5 +20,9 @@ interface nsIWindowsUIUtils : nsISupports * Update the tablet mode state */ void updateTabletModeState(); -}; + /** + * Share URL + */ + void shareUrl(in AString shareTitle, in AString urlToShare); +}; diff --git a/widget/windows/WindowsUIUtils.cpp b/widget/windows/WindowsUIUtils.cpp index 4d916d25cf1e..e6630baf7aed 100644 --- a/widget/windows/WindowsUIUtils.cpp +++ b/widget/windows/WindowsUIUtils.cpp @@ -35,6 +35,7 @@ using namespace ABI::Windows::UI::ViewManagement; using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; using namespace ABI::Windows::Foundation; +using namespace ABI::Windows::ApplicationModel::DataTransfer; /* All of this is win10 stuff and we're compiling against win81 headers * for now, so we may need to do some legwork: */ @@ -90,6 +91,21 @@ public: }; #endif +#ifndef __IDataTransferManagerInterop_INTERFACE_DEFINED__ +#define __IDataTransferManagerInterop_INTERFACE_DEFINED__ + +typedef interface IDataTransferManagerInterop IDataTransferManagerInterop; + +MIDL_INTERFACE("3A3DCD6C-3EAB-43DC-BCDE-45671CE800C8") +IDataTransferManagerInterop : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE GetForWindow(HWND appWindow, REFIID riid, void **dataTransferManager) = 0; + virtual HRESULT STDMETHODCALLTYPE ShowShareUIForWindow(HWND appWindow) = 0; +}; + +#endif + #endif WindowsUIUtils::WindowsUIUtils() : @@ -178,3 +194,118 @@ WindowsUIUtils::UpdateTabletModeState() return NS_OK; } + +struct HStringDeleter +{ + typedef HSTRING pointer; + void operator()(pointer aString) + { + WindowsDeleteString(aString); + } +}; + +typedef mozilla::UniquePtr HStringUniquePtr; + +NS_IMETHODIMP +WindowsUIUtils::ShareUrl(const nsAString& aUrlToShare, + const nsAString& aShareTitle) +{ +#ifndef __MINGW32__ + if (!IsWin10OrLater()) { + return NS_OK; + } + + HSTRING rawTitle; + HRESULT hr = WindowsCreateString(PromiseFlatString(aShareTitle).get(), aShareTitle.Length(), &rawTitle); + if (FAILED(hr)) { + return NS_OK; + } + HStringUniquePtr title(rawTitle); + + HSTRING rawUrl; + hr = WindowsCreateString(PromiseFlatString(aUrlToShare).get(), aUrlToShare.Length(), &rawUrl); + if (FAILED(hr)) { + return NS_OK; + } + HStringUniquePtr url(rawUrl); + + ComPtr uriFactory; + hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Foundation_Uri).Get(), &uriFactory); + if (FAILED(hr)) { + return NS_OK; + } + + ComPtr uri; + hr = uriFactory->CreateUri(url.get(), &uri); + if (FAILED(hr)) { + return NS_OK; + } + + HWND hwnd = GetForegroundWindow(); + if (!hwnd) { + return NS_OK; + } + + ComPtr dtmInterop; + hr = RoGetActivationFactory(HStringReference( + RuntimeClass_Windows_ApplicationModel_DataTransfer_DataTransferManager) + .Get(), IID_PPV_ARGS(&dtmInterop)); + if (FAILED(hr)) { + return NS_OK; + } + + ComPtr dtm; + hr = dtmInterop->GetForWindow(hwnd, IID_PPV_ARGS(&dtm)); + if (FAILED(hr)) { + return NS_OK; + } + + auto callback = Callback < ITypedEventHandler> ( + [uri = std::move(uri), title = std::move(title)](IDataTransferManager*, IDataRequestedEventArgs* pArgs) -> HRESULT + { + ComPtr spDataRequest; + HRESULT hr = pArgs->get_Request(&spDataRequest); + if (FAILED(hr)) { + return hr; + } + + ComPtr spDataPackage; + hr = spDataRequest->get_Data(&spDataPackage); + if (FAILED(hr)) { + return hr; + } + + ComPtr spDataPackageProperties; + hr = spDataPackage->get_Properties(&spDataPackageProperties); + if (FAILED(hr)) { + return hr; + } + + hr = spDataPackageProperties->put_Title(title.get()); + if (FAILED(hr)) { + return hr; + } + + hr = spDataPackage->SetUri(uri.Get()); + if (FAILED(hr)) { + return hr; + } + + return S_OK; + }); + + EventRegistrationToken dataRequestedToken; + hr = dtm->add_DataRequested(callback.Get(), &dataRequestedToken); + if (FAILED(hr)) { + return NS_OK; + } + + hr = dtmInterop->ShowShareUIForWindow(hwnd); + if (FAILED(hr)) { + return NS_OK; + } + +#endif + + return NS_OK; +} From b4cf0d97d73c0290d7e53a99249aa5957a116b90 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Mon, 15 Oct 2018 23:51:50 +0900 Subject: [PATCH 15/22] Bug 1496331 - Do not alter declaration kind from FormalParameter to BodyLevelFunction. r=Yoric --- js/src/frontend/BinSource.cpp | 8 +++++++- js/src/frontend/Parser.cpp | 2 +- js/src/frontend/Parser.h | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/js/src/frontend/BinSource.cpp b/js/src/frontend/BinSource.cpp index 2f4786d37c49..a9234f3143f9 100644 --- a/js/src/frontend/BinSource.cpp +++ b/js/src/frontend/BinSource.cpp @@ -242,7 +242,13 @@ BinASTParser::buildFunctionBox(GeneratorKind generatorKind, if (parseContext_ && syntax == FunctionSyntaxKind::Statement) { auto ptr = parseContext_->varScope().lookupDeclaredName(atom); MOZ_ASSERT(ptr); - ptr->value()->alterKind(DeclarationKind::BodyLevelFunction); + // FIXME: Should be merged with ParseContext::tryDeclareVarHelper + // (bug 1499044). + DeclarationKind declaredKind = ptr->value()->kind(); + if (DeclarationKindIsVar(declaredKind)) { + MOZ_ASSERT(declaredKind != DeclarationKind::VarForAnnexBLexicalFunction); + ptr->value()->alterKind(DeclarationKind::BodyLevelFunction); + } } // Allocate the function before walking down the tree. diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 9eb398c69879..4b340b830d82 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -1397,7 +1397,7 @@ PerHandlerParser::noteDestructuredPositionalFormalParameter(CodeNo return true; } -static bool +bool DeclarationKindIsVar(DeclarationKind kind) { return kind == DeclarationKind::Var || diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index b3bde51e65ec..195f8e10b51e 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -1700,6 +1700,10 @@ JSFunction* AllocNewFunction(JSContext* cx, HandleAtom atom, FunctionSyntaxKind kind, GeneratorKind generatorKind, FunctionAsyncKind asyncKind, HandleObject proto, bool isSelfHosting = false, bool inFunctionBox = false); +// Returns true if the declaration is `var` or equivalent. +bool +DeclarationKindIsVar(DeclarationKind kind); + } /* namespace frontend */ } /* namespace js */ From 2f65a3c2844120649a2296dc52eb0f3d10e923f4 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Mon, 15 Oct 2018 23:51:50 +0900 Subject: [PATCH 16/22] Bug 1496333 - Do not use AssertedParameterScope.paramNames.length for allocation. r=efaust --- js/src/frontend/BinSource-auto.cpp | 36 ++++++++++----- js/src/frontend/BinSource.cpp | 73 ++++++++++++++++++++---------- js/src/frontend/BinSource.yaml | 36 ++++++++++----- 3 files changed, 96 insertions(+), 49 deletions(-) diff --git a/js/src/frontend/BinSource-auto.cpp b/js/src/frontend/BinSource-auto.cpp index df5454be4566..36f458b5c808 100644 --- a/js/src/frontend/BinSource-auto.cpp +++ b/js/src/frontend/BinSource-auto.cpp @@ -2345,12 +2345,23 @@ BinASTParser::parseInterfaceAssertedPositionalParameterName(const size_t st RootedAtom name(cx_); MOZ_TRY_VAR(name, tokenizer_->readIdentifierName()); - // FIXME: The following checks should be performed inside - // checkPositionalParameterIndices to match the spec's order - // (bug 1490976). - if (index >= positionalParams.get().length()) { - return raiseError("AssertedPositionalParameterName.length out of range"); + // `positionalParams` vector can be shorter than the actual + // parameter length. Resize on demand. + // (see also ListOfAssertedMaybePositionalParameterName) + size_t prevLength = positionalParams.get().length(); + if (index >= prevLength) { + // This is implementation limit, which is not in the spec. + size_t newLength = index + 1; + if (newLength >= ARGNO_LIMIT) { + return raiseError("AssertedPositionalParameterName.index is too big"); + } + + BINJS_TRY(positionalParams.get().resize(newLength)); + for (uint32_t i = prevLength; i < newLength; i++) { + positionalParams.get()[i] = nullptr; + } } + if (positionalParams.get()[index]) { return raiseError("AssertedPositionalParameterName has duplicate entry for the same index"); } @@ -5481,13 +5492,14 @@ BinASTParser::parseListOfAssertedMaybePositionalParameterName( MOZ_TRY(tokenizer_->enterList(length, guard)); (void) start; auto result = Ok(); - if (length >= ARGNO_LIMIT) { - return raiseError("Too many function parameters"); - } - BINJS_TRY(positionalParams.get().resize(length)); - for (uint32_t i = 0; i < length; i++) { - positionalParams.get()[i] = nullptr; - } + // This list contains also destructuring parameters, and the number of + // list items can be greater than the actual parameters, or more than + // ARGNO_LIMIT even if the number of parameters fits into ARGNO_LIMIT. + // Also, the number of parameters can be greater than this list's length + // if one of destructuring parameter is empty. + // + // We resize `positionalParams` vector on demand, to keep the vector + // length match to the known maximum positional parameter index + 1. for (uint32_t i = 0; i < length; ++i) { MOZ_TRY(parseAssertedMaybePositionalParameterName( diff --git a/js/src/frontend/BinSource.cpp b/js/src/frontend/BinSource.cpp index a9234f3143f9..99faf869c49f 100644 --- a/js/src/frontend/BinSource.cpp +++ b/js/src/frontend/BinSource.cpp @@ -478,52 +478,75 @@ template JS::Result BinASTParser::checkPositionalParameterIndices(Handle> positionalParams, ListNode* params) { -#ifdef DEBUG - // positionalParams should have the same length as non-rest parameters. - size_t paramsCount = params->count(); - if (paramsCount > 0) { - if (params->last()->isKind(ParseNodeKind::Spread)) { - paramsCount--; - } - } - MOZ_ASSERT(positionalParams.get().length() == paramsCount); -#endif + // positionalParams should have the corresponding entry up to the last + // positional parameter. + // `positionalParams` corresponds to `expectedParams` parameter in the spec. + // `params` corresponds to `parseTree` in 3.1.9 CheckAssertedScope, and + // `positionalParamNames` parameter + + // Steps 1-3. + // PositionalParameterNames (3.1.9 CheckAssertedScope step 5.d) and + // CreatePositionalParameterIndices (3.1.5 CheckPositionalParameterIndices + // step 1) are done implicitly. uint32_t i = 0; for (ParseNode* param : params->contents()) { if (param->isKind(ParseNodeKind::Assign)) { param = param->as().left(); } - if (param->isKind(ParseNodeKind::Spread)) { - continue; - } - MOZ_ASSERT(param->isKind(ParseNodeKind::Name) || - param->isKind(ParseNodeKind::Object) || - param->isKind(ParseNodeKind::Array)); - - if (JSAtom* name = positionalParams.get()[i]) { + if (param->isKind(ParseNodeKind::Name)) { // Simple or default parameter. - if (param->isKind(ParseNodeKind::Object) || param->isKind(ParseNodeKind::Array)) { - return raiseError("AssertedPositionalParameterName: expected positional parameter, got destructuring parameter"); - } - if (param->isKind(ParseNodeKind::Spread)) { - return raiseError("AssertedPositionalParameterName: expected positional parameter, got rest parameter"); + + // Step 2.a. + if (i >= positionalParams.get().length()) { + return raiseError("AssertedParameterScope.paramNames doesn't have corresponding entry to positional parameter"); } + JSAtom* name = positionalParams.get()[i]; + if (!name) { + // Step 2.a.ii.1. + return raiseError("AssertedParameterScope.paramNames asserted destructuring/rest parameter, got positional parameter"); + } + + // Step 2.a.i. if (param->name() != name) { + // Step 2.a.ii.1. return raiseError("AssertedPositionalParameterName: name mismatch"); } + + // Step 2.a.i.1. + // Implicitly done. } else { // Destructuring or rest parameter. - if (param->isKind(ParseNodeKind::Name)) { - return raiseError("AssertedParameterName/AssertedRestParameterName: expected destructuring/rest parameter, got positional parameter"); + + MOZ_ASSERT(param->isKind(ParseNodeKind::Object) || + param->isKind(ParseNodeKind::Array) || + param->isKind(ParseNodeKind::Spread)); + + // Step 3. + if (i >= positionalParams.get().length()) { + continue; + } + + if (positionalParams.get()[i]) { + if (param->isKind(ParseNodeKind::Spread)) { + return raiseError("AssertedParameterScope.paramNames asserted positional parameter, got rest parameter"); + } else { + return raiseError("AssertedParameterScope.paramNames asserted positional parameter, got destructuring parameter"); + } } } i++; } + // Step 3. + if (positionalParams.get().length() > params->count()) { + // `positionalParams` has unchecked entries. + return raiseError("AssertedParameterScope.paramNames has unmatching items than the actual parameters"); + } + return Ok(); } diff --git a/js/src/frontend/BinSource.yaml b/js/src/frontend/BinSource.yaml index 0d14009e7687..a6df035988b9 100644 --- a/js/src/frontend/BinSource.yaml +++ b/js/src/frontend/BinSource.yaml @@ -277,12 +277,23 @@ AssertedPositionalParameterName: fields: name: after: | - // FIXME: The following checks should be performed inside - // checkPositionalParameterIndices to match the spec's order - // (bug 1490976). - if (index >= positionalParams.get().length()) { - return raiseError("AssertedPositionalParameterName.length out of range"); + // `positionalParams` vector can be shorter than the actual + // parameter length. Resize on demand. + // (see also ListOfAssertedMaybePositionalParameterName) + size_t prevLength = positionalParams.get().length(); + if (index >= prevLength) { + // This is implementation limit, which is not in the spec. + size_t newLength = index + 1; + if (newLength >= ARGNO_LIMIT) { + return raiseError("AssertedPositionalParameterName.index is too big"); + } + + BINJS_TRY(positionalParams.get().resize(newLength)); + for (uint32_t i = prevLength; i < newLength; i++) { + positionalParams.get()[i] = nullptr; + } } + if (positionalParams.get()[index]) { return raiseError("AssertedPositionalParameterName has duplicate entry for the same index"); } @@ -909,13 +920,14 @@ ListOfAssertedMaybePositionalParameterName: init: | (void) start; auto result = Ok(); - if (length >= ARGNO_LIMIT) { - return raiseError("Too many function parameters"); - } - BINJS_TRY(positionalParams.get().resize(length)); - for (uint32_t i = 0; i < length; i++) { - positionalParams.get()[i] = nullptr; - } + // This list contains also destructuring parameters, and the number of + // list items can be greater than the actual parameters, or more than + // ARGNO_LIMIT even if the number of parameters fits into ARGNO_LIMIT. + // Also, the number of parameters can be greater than this list's length + // if one of destructuring parameter is empty. + // + // We resize `positionalParams` vector on demand, to keep the vector + // length match to the known maximum positional parameter index + 1. ListOfAssertedDeclaredName: inherits: ListOfAssertedBoundName From e3deebb49bdd9d5972ecb1616630f39facb10f09 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Mon, 15 Oct 2018 23:51:50 +0900 Subject: [PATCH 17/22] Bug 1497036 - Throw error if function declaration is found without corresponding AssertedDeclaredName. r=Yoric --- js/src/frontend/BinSource.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/src/frontend/BinSource.cpp b/js/src/frontend/BinSource.cpp index 99faf869c49f..344fc1a145f0 100644 --- a/js/src/frontend/BinSource.cpp +++ b/js/src/frontend/BinSource.cpp @@ -241,7 +241,10 @@ BinASTParser::buildFunctionBox(GeneratorKind generatorKind, if (parseContext_ && syntax == FunctionSyntaxKind::Statement) { auto ptr = parseContext_->varScope().lookupDeclaredName(atom); - MOZ_ASSERT(ptr); + if (!ptr) { + return raiseError("FunctionDeclaration without corresponding AssertedDeclaredName."); + } + // FIXME: Should be merged with ParseContext::tryDeclareVarHelper // (bug 1499044). DeclarationKind declaredKind = ptr->value()->kind(); From 2709c843801e11235294f75591b642d11106a515 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Mon, 15 Oct 2018 23:51:50 +0900 Subject: [PATCH 18/22] Bug 1498488 - Drop support for destructuring/rest parameter. r=Yoric --- js/src/frontend/BinSource-auto.cpp | 171 ++++++++++---------------- js/src/frontend/BinSource-auto.h | 8 +- js/src/frontend/BinSource.cpp | 31 +++-- js/src/frontend/BinSource.yaml | 14 +-- js/src/frontend/binsource/src/main.rs | 38 ++++-- 5 files changed, 122 insertions(+), 140 deletions(-) diff --git a/js/src/frontend/BinSource-auto.cpp b/js/src/frontend/BinSource-auto.cpp index 36f458b5c808..03b6d8caf811 100644 --- a/js/src/frontend/BinSource-auto.cpp +++ b/js/src/frontend/BinSource-auto.cpp @@ -73,17 +73,13 @@ BinASTParser::parseSumAssertedMaybePositionalParameterName(const size_t sta Ok result; switch (kind) { case BinKind::AssertedParameterName: - MOZ_TRY_VAR(result, parseInterfaceAssertedParameterName(start, kind, fields, - scopeKind, positionalParams)); - break; + return raiseError("FIXME: Not implemented yet in this preview release (AssertedParameterName)"); case BinKind::AssertedPositionalParameterName: MOZ_TRY_VAR(result, parseInterfaceAssertedPositionalParameterName(start, kind, fields, scopeKind, positionalParams)); break; case BinKind::AssertedRestParameterName: - MOZ_TRY_VAR(result, parseInterfaceAssertedRestParameterName(start, kind, fields, - scopeKind, positionalParams)); - break; + return raiseError("FIXME: Not implemented yet in this preview release (AssertedRestParameterName)"); default: return raiseInvalidKind("AssertedMaybePositionalParameterName", kind); } @@ -1935,13 +1931,13 @@ BinASTParser::parseSumVariableDeclarationOrExpression(const size_t start, c template JS::Result BinASTParser::parseInterfaceArrayAssignmentTarget(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ArrayAssignmentTarget)"); + return raiseError("FIXME: Not implemented yet in this preview release (ArrayAssignmentTarget)"); } template JS::Result BinASTParser::parseInterfaceArrayBinding(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ArrayBinding)"); + return raiseError("FIXME: Not implemented yet in this preview release (ArrayBinding)"); } template JS::Result @@ -1994,7 +1990,7 @@ BinASTParser::parseArrowExpressionContentsWithExpression() template JS::Result BinASTParser::parseInterfaceArrowExpressionContentsWithExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ArrowExpressionContentsWithExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (ArrowExpressionContentsWithExpression)"); } @@ -2027,7 +2023,7 @@ BinASTParser::parseArrowExpressionContentsWithFunctionBody() template JS::Result BinASTParser::parseInterfaceArrowExpressionContentsWithFunctionBody(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ArrowExpressionContentsWithFunctionBody)"); + return raiseError("FIXME: Not implemented yet in this preview release (ArrowExpressionContentsWithFunctionBody)"); } @@ -2243,29 +2239,10 @@ BinASTParser::parseInterfaceAssertedDeclaredName(const size_t start, const return result; } -template JS::Result -BinASTParser::parseInterfaceAssertedParameterName(const size_t start, const BinKind kind, const BinFields& fields, - AssertedScopeKind scopeKind, - MutableHandle> positionalParams) +template JS::Result +BinASTParser::parseInterfaceAssertedParameterName(const size_t start, const BinKind kind, const BinFields& fields) { - MOZ_ASSERT(kind == BinKind::AssertedParameterName); - BINJS_TRY(CheckRecursionLimit(cx_)); - -#if defined(DEBUG) - const BinField expected_fields[2] = { BinField::Name, BinField::IsCaptured }; - MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields)); -#endif // defined(DEBUG) - - RootedAtom name(cx_); - MOZ_TRY_VAR(name, tokenizer_->readIdentifierName()); - - BINJS_MOZ_TRY_DECL(isCaptured, tokenizer_->readBool()); - ParseContext::Scope* scope; - DeclarationKind declKind; - MOZ_TRY(getBoundScope(scopeKind, scope, declKind)); - MOZ_TRY(addScopeName(scopeKind, name, scope, declKind, isCaptured)); - auto result = Ok(); - return result; + return raiseError("FIXME: Not implemented yet in this preview release (AssertedParameterName)"); } @@ -2375,29 +2352,10 @@ BinASTParser::parseInterfaceAssertedPositionalParameterName(const size_t st return result; } -template JS::Result -BinASTParser::parseInterfaceAssertedRestParameterName(const size_t start, const BinKind kind, const BinFields& fields, - AssertedScopeKind scopeKind, - MutableHandle> positionalParams) +template JS::Result +BinASTParser::parseInterfaceAssertedRestParameterName(const size_t start, const BinKind kind, const BinFields& fields) { - MOZ_ASSERT(kind == BinKind::AssertedRestParameterName); - BINJS_TRY(CheckRecursionLimit(cx_)); - -#if defined(DEBUG) - const BinField expected_fields[2] = { BinField::Name, BinField::IsCaptured }; - MOZ_TRY(tokenizer_->checkFields(kind, fields, expected_fields)); -#endif // defined(DEBUG) - - RootedAtom name(cx_); - MOZ_TRY_VAR(name, tokenizer_->readIdentifierName()); - - BINJS_MOZ_TRY_DECL(isCaptured, tokenizer_->readBool()); - ParseContext::Scope* scope; - DeclarationKind declKind; - MOZ_TRY(getBoundScope(scopeKind, scope, declKind)); - MOZ_TRY(addScopeName(scopeKind, name, scope, declKind, isCaptured)); - auto result = Ok(); - return result; + return raiseError("FIXME: Not implemented yet in this preview release (AssertedRestParameterName)"); } @@ -2576,25 +2534,25 @@ BinASTParser::parseInterfaceAssignmentTargetIdentifier(const size_t start, template JS::Result BinASTParser::parseInterfaceAssignmentTargetPropertyIdentifier(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (AssignmentTargetPropertyIdentifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (AssignmentTargetPropertyIdentifier)"); } template JS::Result BinASTParser::parseInterfaceAssignmentTargetPropertyProperty(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (AssignmentTargetPropertyProperty)"); + return raiseError("FIXME: Not implemented yet in this preview release (AssignmentTargetPropertyProperty)"); } template JS::Result BinASTParser::parseInterfaceAssignmentTargetWithInitializer(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (AssignmentTargetWithInitializer)"); + return raiseError("FIXME: Not implemented yet in this preview release (AssignmentTargetWithInitializer)"); } template JS::Result BinASTParser::parseInterfaceAwaitExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (AwaitExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (AwaitExpression)"); } template JS::Result @@ -2758,19 +2716,19 @@ BinASTParser::parseInterfaceBindingIdentifier(const size_t start, const Bin template JS::Result BinASTParser::parseInterfaceBindingPropertyIdentifier(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (BindingPropertyIdentifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (BindingPropertyIdentifier)"); } template JS::Result BinASTParser::parseInterfaceBindingPropertyProperty(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (BindingPropertyProperty)"); + return raiseError("FIXME: Not implemented yet in this preview release (BindingPropertyProperty)"); } template JS::Result BinASTParser::parseInterfaceBindingWithInitializer(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (BindingWithInitializer)"); + return raiseError("FIXME: Not implemented yet in this preview release (BindingWithInitializer)"); } @@ -2957,7 +2915,7 @@ BinASTParser::parseInterfaceCatchClause(const size_t start, const BinKind k template JS::Result BinASTParser::parseInterfaceClassDeclaration(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ClassDeclaration)"); + return raiseError("FIXME: Not implemented yet in this preview release (ClassDeclaration)"); } @@ -2988,13 +2946,13 @@ BinASTParser::parseClassElement() template JS::Result BinASTParser::parseInterfaceClassElement(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ClassElement)"); + return raiseError("FIXME: Not implemented yet in this preview release (ClassElement)"); } template JS::Result BinASTParser::parseInterfaceClassExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ClassExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (ClassExpression)"); } template JS::Result @@ -3098,7 +3056,7 @@ BinASTParser::parseInterfaceComputedMemberExpression(const size_t start, co template JS::Result BinASTParser::parseInterfaceComputedPropertyName(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ComputedPropertyName)"); + return raiseError("FIXME: Not implemented yet in this preview release (ComputedPropertyName)"); } template JS::Result @@ -3181,7 +3139,7 @@ BinASTParser::parseInterfaceDataProperty(const size_t start, const BinKind template JS::Result BinASTParser::parseInterfaceDebuggerStatement(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (DebuggerStatement)"); + return raiseError("FIXME: Not implemented yet in this preview release (DebuggerStatement)"); } @@ -3250,13 +3208,13 @@ BinASTParser::parseInterfaceDoWhileStatement(const size_t start, const BinK template JS::Result BinASTParser::parseInterfaceEagerArrowExpressionWithExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (EagerArrowExpressionWithExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (EagerArrowExpressionWithExpression)"); } template JS::Result BinASTParser::parseInterfaceEagerArrowExpressionWithFunctionBody(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (EagerArrowExpressionWithFunctionBody)"); + return raiseError("FIXME: Not implemented yet in this preview release (EagerArrowExpressionWithFunctionBody)"); } template JS::Result @@ -3528,25 +3486,25 @@ MOZ_TRY(tokenizer_->checkFields0(kind, fields)); template JS::Result BinASTParser::parseInterfaceExport(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (Export)"); + return raiseError("FIXME: Not implemented yet in this preview release (Export)"); } template JS::Result BinASTParser::parseInterfaceExportAllFrom(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ExportAllFrom)"); + return raiseError("FIXME: Not implemented yet in this preview release (ExportAllFrom)"); } template JS::Result BinASTParser::parseInterfaceExportDefault(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ExportDefault)"); + return raiseError("FIXME: Not implemented yet in this preview release (ExportDefault)"); } template JS::Result BinASTParser::parseInterfaceExportFrom(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ExportFrom)"); + return raiseError("FIXME: Not implemented yet in this preview release (ExportFrom)"); } @@ -3577,7 +3535,7 @@ BinASTParser::parseExportFromSpecifier() template JS::Result BinASTParser::parseInterfaceExportFromSpecifier(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ExportFromSpecifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (ExportFromSpecifier)"); } @@ -3608,13 +3566,13 @@ BinASTParser::parseExportLocalSpecifier() template JS::Result BinASTParser::parseInterfaceExportLocalSpecifier(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ExportLocalSpecifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (ExportLocalSpecifier)"); } template JS::Result BinASTParser::parseInterfaceExportLocals(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ExportLocals)"); + return raiseError("FIXME: Not implemented yet in this preview release (ExportLocals)"); } template JS::Result @@ -3700,7 +3658,7 @@ BinASTParser::parseInterfaceForInStatement(const size_t start, const BinKin template JS::Result BinASTParser::parseInterfaceForOfStatement(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ForOfStatement)"); + return raiseError("FIXME: Not implemented yet in this preview release (ForOfStatement)"); } template JS::Result @@ -3782,8 +3740,7 @@ BinASTParser::parseInterfaceFormalParameters(const size_t start, const BinK auto result = items; if (rest) { - BINJS_TRY_DECL(spread, factory_.newSpread(start, rest)); - factory_.addList(result, spread); + return raiseError("Rest parameter is not supported in this preview release"); } return result; } @@ -4058,13 +4015,13 @@ BinASTParser::parseInterfaceIfStatement(const size_t start, const BinKind k template JS::Result BinASTParser::parseInterfaceImport(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (Import)"); + return raiseError("FIXME: Not implemented yet in this preview release (Import)"); } template JS::Result BinASTParser::parseInterfaceImportNamespace(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ImportNamespace)"); + return raiseError("FIXME: Not implemented yet in this preview release (ImportNamespace)"); } @@ -4095,7 +4052,7 @@ BinASTParser::parseImportSpecifier() template JS::Result BinASTParser::parseInterfaceImportSpecifier(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ImportSpecifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (ImportSpecifier)"); } template JS::Result @@ -4124,13 +4081,13 @@ BinASTParser::parseInterfaceLabelledStatement(const size_t start, const Bin template JS::Result BinASTParser::parseInterfaceLazyArrowExpressionWithExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (LazyArrowExpressionWithExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (LazyArrowExpressionWithExpression)"); } template JS::Result BinASTParser::parseInterfaceLazyArrowExpressionWithFunctionBody(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (LazyArrowExpressionWithFunctionBody)"); + return raiseError("FIXME: Not implemented yet in this preview release (LazyArrowExpressionWithFunctionBody)"); } template JS::Result @@ -4244,19 +4201,19 @@ BinASTParser::parseInterfaceLazyFunctionExpression(const size_t start, cons template JS::Result BinASTParser::parseInterfaceLazyGetter(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (LazyGetter)"); + return raiseError("FIXME: Not implemented yet in this preview release (LazyGetter)"); } template JS::Result BinASTParser::parseInterfaceLazyMethod(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (LazyMethod)"); + return raiseError("FIXME: Not implemented yet in this preview release (LazyMethod)"); } template JS::Result BinASTParser::parseInterfaceLazySetter(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (LazySetter)"); + return raiseError("FIXME: Not implemented yet in this preview release (LazySetter)"); } template JS::Result @@ -4279,7 +4236,7 @@ BinASTParser::parseInterfaceLiteralBooleanExpression(const size_t start, co template JS::Result BinASTParser::parseInterfaceLiteralInfinityExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (LiteralInfinityExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (LiteralInfinityExpression)"); } template JS::Result @@ -4400,7 +4357,7 @@ BinASTParser::parseInterfaceLiteralStringExpression(const size_t start, con template JS::Result BinASTParser::parseInterfaceModule(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (Module)"); + return raiseError("FIXME: Not implemented yet in this preview release (Module)"); } template JS::Result @@ -4425,19 +4382,19 @@ BinASTParser::parseInterfaceNewExpression(const size_t start, const BinKind template JS::Result BinASTParser::parseInterfaceNewTargetExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (NewTargetExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (NewTargetExpression)"); } template JS::Result BinASTParser::parseInterfaceObjectAssignmentTarget(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ObjectAssignmentTarget)"); + return raiseError("FIXME: Not implemented yet in this preview release (ObjectAssignmentTarget)"); } template JS::Result BinASTParser::parseInterfaceObjectBinding(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (ObjectBinding)"); + return raiseError("FIXME: Not implemented yet in this preview release (ObjectBinding)"); } template JS::Result @@ -4592,7 +4549,7 @@ BinASTParser::parseInterfaceShorthandProperty(const size_t start, const Bin template JS::Result BinASTParser::parseInterfaceSpreadElement(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (SpreadElement)"); + return raiseError("FIXME: Not implemented yet in this preview release (SpreadElement)"); } template JS::Result @@ -4648,7 +4605,7 @@ BinASTParser::parseInterfaceStaticMemberExpression(const size_t start, cons template JS::Result BinASTParser::parseInterfaceSuper(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (Super)"); + return raiseError("FIXME: Not implemented yet in this preview release (Super)"); } @@ -4792,13 +4749,13 @@ BinASTParser::parseInterfaceSwitchStatementWithDefault(const size_t start, template JS::Result BinASTParser::parseInterfaceTemplateElement(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (TemplateElement)"); + return raiseError("FIXME: Not implemented yet in this preview release (TemplateElement)"); } template JS::Result BinASTParser::parseInterfaceTemplateExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (TemplateExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (TemplateExpression)"); } template JS::Result @@ -5136,13 +5093,13 @@ BinASTParser::parseInterfaceWithStatement(const size_t start, const BinKind template JS::Result BinASTParser::parseInterfaceYieldExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (YieldExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (YieldExpression)"); } template JS::Result BinASTParser::parseInterfaceYieldStarExpression(const size_t start, const BinKind kind, const BinFields& fields) { - return raiseError("FIXME: Not implemented yet (YieldStarExpression)"); + return raiseError("FIXME: Not implemented yet in this preview release (YieldStarExpression)"); } @@ -5514,25 +5471,25 @@ BinASTParser::parseListOfAssertedMaybePositionalParameterName( template JS::Result BinASTParser::parseListOfAssignmentTargetOrAssignmentTargetWithInitializer() { - return raiseError("FIXME: Not implemented yet (ListOfAssignmentTargetOrAssignmentTargetWithInitializer)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfAssignmentTargetOrAssignmentTargetWithInitializer)"); } template JS::Result BinASTParser::parseListOfAssignmentTargetProperty() { - return raiseError("FIXME: Not implemented yet (ListOfAssignmentTargetProperty)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfAssignmentTargetProperty)"); } template JS::Result BinASTParser::parseListOfBindingProperty() { - return raiseError("FIXME: Not implemented yet (ListOfBindingProperty)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfBindingProperty)"); } template JS::Result BinASTParser::parseListOfClassElement() { - return raiseError("FIXME: Not implemented yet (ListOfClassElement)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfClassElement)"); } template JS::Result @@ -5557,31 +5514,31 @@ BinASTParser::parseListOfDirective() template JS::Result BinASTParser::parseListOfExportFromSpecifier() { - return raiseError("FIXME: Not implemented yet (ListOfExportFromSpecifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfExportFromSpecifier)"); } template JS::Result BinASTParser::parseListOfExportLocalSpecifier() { - return raiseError("FIXME: Not implemented yet (ListOfExportLocalSpecifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfExportLocalSpecifier)"); } template JS::Result BinASTParser::parseListOfExpressionOrTemplateElement() { - return raiseError("FIXME: Not implemented yet (ListOfExpressionOrTemplateElement)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfExpressionOrTemplateElement)"); } template JS::Result BinASTParser::parseListOfImportDeclarationOrExportDeclarationOrStatement() { - return raiseError("FIXME: Not implemented yet (ListOfImportDeclarationOrExportDeclarationOrStatement)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfImportDeclarationOrExportDeclarationOrStatement)"); } template JS::Result BinASTParser::parseListOfImportSpecifier() { - return raiseError("FIXME: Not implemented yet (ListOfImportSpecifier)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfImportSpecifier)"); } template JS::Result @@ -5608,7 +5565,7 @@ BinASTParser::parseListOfObjectProperty() template JS::Result BinASTParser::parseListOfOptionalBindingOrBindingWithInitializer() { - return raiseError("FIXME: Not implemented yet (ListOfOptionalBindingOrBindingWithInitializer)"); + return raiseError("FIXME: Not implemented yet in this preview release (ListOfOptionalBindingOrBindingWithInitializer)"); } template JS::Result diff --git a/js/src/frontend/BinSource-auto.h b/js/src/frontend/BinSource-auto.h index 0fce306d8923..8d0292380714 100644 --- a/js/src/frontend/BinSource-auto.h +++ b/js/src/frontend/BinSource-auto.h @@ -196,17 +196,13 @@ JS::Result parseInterfaceAssertedBoundName(const size_t start, const BinKind JS::Result parseInterfaceAssertedBoundNamesScope(const size_t start, const BinKind kind, const BinFields& fields); JS::Result parseInterfaceAssertedDeclaredName(const size_t start, const BinKind kind, const BinFields& fields, AssertedScopeKind scopeKind); -JS::Result parseInterfaceAssertedParameterName(const size_t start, const BinKind kind, const BinFields& fields, - AssertedScopeKind scopeKind, - MutableHandle> positionalParams); +JS::Result parseInterfaceAssertedParameterName(const size_t start, const BinKind kind, const BinFields& fields); JS::Result parseInterfaceAssertedParameterScope(const size_t start, const BinKind kind, const BinFields& fields, MutableHandle> positionalParams); JS::Result parseInterfaceAssertedPositionalParameterName(const size_t start, const BinKind kind, const BinFields& fields, AssertedScopeKind scopeKind, MutableHandle> positionalParams); -JS::Result parseInterfaceAssertedRestParameterName(const size_t start, const BinKind kind, const BinFields& fields, - AssertedScopeKind scopeKind, - MutableHandle> positionalParams); +JS::Result parseInterfaceAssertedRestParameterName(const size_t start, const BinKind kind, const BinFields& fields); JS::Result parseInterfaceAssertedScriptGlobalScope(const size_t start, const BinKind kind, const BinFields& fields); JS::Result parseInterfaceAssertedVarScope(const size_t start, const BinKind kind, const BinFields& fields); JS::Result parseInterfaceAssignmentExpression(const size_t start, const BinKind kind, const BinFields& fields); diff --git a/js/src/frontend/BinSource.cpp b/js/src/frontend/BinSource.cpp index 344fc1a145f0..c8ee64a17923 100644 --- a/js/src/frontend/BinSource.cpp +++ b/js/src/frontend/BinSource.cpp @@ -493,12 +493,26 @@ BinASTParser::checkPositionalParameterIndices(Handle> pos // CreatePositionalParameterIndices (3.1.5 CheckPositionalParameterIndices // step 1) are done implicitly. uint32_t i = 0; + const bool hasRest = parseContext_->functionBox()->hasRest(); for (ParseNode* param : params->contents()) { if (param->isKind(ParseNodeKind::Assign)) { param = param->as().left(); } - if (param->isKind(ParseNodeKind::Name)) { + // At this point, function body is not part of params list. + const bool isRest = hasRest && !param->pn_next; + if (isRest) { + // Rest parameter + + // Step 3. + if (i >= positionalParams.get().length()) { + continue; + } + + if (positionalParams.get()[i]) { + return raiseError("Expected positional parameter per AssertedParameterScope.paramNames, got rest parameter"); + } + } else if (param->isKind(ParseNodeKind::Name)) { // Simple or default parameter. // Step 2.a. @@ -509,23 +523,22 @@ BinASTParser::checkPositionalParameterIndices(Handle> pos JSAtom* name = positionalParams.get()[i]; if (!name) { // Step 2.a.ii.1. - return raiseError("AssertedParameterScope.paramNames asserted destructuring/rest parameter, got positional parameter"); + return raiseError("Expected destructuring/rest parameter per AssertedParameterScope.paramNames, got positional parameter"); } // Step 2.a.i. if (param->name() != name) { // Step 2.a.ii.1. - return raiseError("AssertedPositionalParameterName: name mismatch"); + return raiseError("Name mismatch between AssertedPositionalParameterName in AssertedParameterScope.paramNames and actual parameter"); } // Step 2.a.i.1. // Implicitly done. } else { - // Destructuring or rest parameter. + // Destructuring parameter. MOZ_ASSERT(param->isKind(ParseNodeKind::Object) || - param->isKind(ParseNodeKind::Array) || - param->isKind(ParseNodeKind::Spread)); + param->isKind(ParseNodeKind::Array)); // Step 3. if (i >= positionalParams.get().length()) { @@ -533,11 +546,7 @@ BinASTParser::checkPositionalParameterIndices(Handle> pos } if (positionalParams.get()[i]) { - if (param->isKind(ParseNodeKind::Spread)) { - return raiseError("AssertedParameterScope.paramNames asserted positional parameter, got rest parameter"); - } else { - return raiseError("AssertedParameterScope.paramNames asserted positional parameter, got destructuring parameter"); - } + return raiseError("Expected positional parameter per AssertedParameterScope.paramNames, got destructuring parameter"); } } diff --git a/js/src/frontend/BinSource.yaml b/js/src/frontend/BinSource.yaml index a6df035988b9..b001c1ee2d5a 100644 --- a/js/src/frontend/BinSource.yaml +++ b/js/src/frontend/BinSource.yaml @@ -271,6 +271,11 @@ AssertedMaybePositionalParameterName: MutableHandle> positionalParams extra-args: | scopeKind, positionalParams + sum-arms: + AssertedRestParameterName: + disabled: true + AssertedParameterName: + disabled: true AssertedPositionalParameterName: inherits: AssertedMaybePositionalParameterName @@ -299,12 +304,6 @@ AssertedPositionalParameterName: } positionalParams.get()[index] = name; -AssertedRestParameterName: - inherits: AssertedMaybePositionalParameterName - -AssertedParameterName: - inherits: AssertedMaybePositionalParameterName - AssertedBoundNamesScope: inherits: AssertedBlockScope init: | @@ -850,8 +849,7 @@ FormalParameters: build: | auto result = items; if (rest) { - BINJS_TRY_DECL(spread, factory_.newSpread(start, rest)); - factory_.addList(result, spread); + return raiseError("Rest parameter is not supported in this preview release"); } ForStatement: diff --git a/js/src/frontend/binsource/src/main.rs b/js/src/frontend/binsource/src/main.rs index 0a03948ff92d..217a42e1ab12 100644 --- a/js/src/frontend/binsource/src/main.rs +++ b/js/src/frontend/binsource/src/main.rs @@ -58,6 +58,9 @@ struct FieldRules { #[derive(Clone, Default)] struct SumRules { after_arm: Option, + + // Disable this arm (false by default). + disabled: bool, } @@ -355,6 +358,15 @@ impl GlobalRules { update_rule(&mut sum_rule.after_arm, arm_config_entry) .unwrap_or_else(|()| panic!("Rule {}.sum-arms.{}.{} must be a string", node_key, sum_arm_key, arm_config_key)); } + "disabled" => { + if let Some(disabled) = arm_config_entry.as_bool() { + if disabled { + sum_rule.disabled = true; + } + } else { + panic!("Rule {}.sum-arms.{}.{} must be a bool", node_key, sum_arm_key, arm_config_key); + } + } _ => { panic!("Unexpected {}.sum-arms.{}.{}", node_key, sum_arm_key, arm_config_key); } @@ -1180,6 +1192,18 @@ impl CPPExporter { // Generate inner method let mut buffer_cases = String::new(); for node in nodes { + let rule_for_this_arm = rules_for_this_sum.by_sum.get(&node) + .cloned() + .unwrap_or_default(); + + if rule_for_this_arm.disabled { + buffer_cases.push_str(&format!(" + case BinKind::{variant_name}: + return raiseError(\"FIXME: Not implemented yet in this preview release ({variant_name})\");", + variant_name = node.to_cpp_enum_case())); + continue; + } + buffer_cases.push_str(&format!(" case BinKind::{variant_name}: {call} @@ -1190,9 +1214,7 @@ impl CPPExporter { MethodCallKind::AlwaysVar) .reindent(" "), variant_name = node.to_cpp_enum_case(), - arm_after = rules_for_this_sum.by_sum.get(&node) - .cloned() - .unwrap_or_default().after_arm.reindent(" ") + arm_after = rule_for_this_arm.after_arm.reindent(" ") .newline_if_not_empty())); } buffer.push_str(&format!("\n{first_line} @@ -1248,7 +1270,7 @@ impl CPPExporter { let rendered = format!(" {first_line} {{ - return raiseError(\"FIXME: Not implemented yet ({kind})\"); + return raiseError(\"FIXME: Not implemented yet in this preview release ({kind})\"); }}\n", first_line = first_line, kind = kind, @@ -1458,7 +1480,7 @@ impl CPPExporter { if build_result.len() == 0 { buffer.push_str(&format!("{first_line} {{ - return raiseError(\"FIXME: Not implemented yet ({kind})\"); + return raiseError(\"FIXME: Not implemented yet in this preview release ({kind})\"); }} ", @@ -1487,7 +1509,7 @@ impl CPPExporter { if build_result.len() == 0 { buffer.push_str(&format!("{first_line} {{ - return raiseError(\"FIXME: Not implemented yet ({kind})\"); + return raiseError(\"FIXME: Not implemented yet in this preview release ({kind})\"); }} ", @@ -1517,7 +1539,7 @@ impl CPPExporter { if build_result.len() == 0 { buffer.push_str(&format!("{first_line} {{ - return raiseError(\"FIXME: Not implemented yet ({kind})\"); + return raiseError(\"FIXME: Not implemented yet in this preview release ({kind})\"); }} ", @@ -1763,7 +1785,7 @@ impl CPPExporter { if build_result == "" { buffer.push_str(&format!("{first_line} {{ - return raiseError(\"FIXME: Not implemented yet ({class_name})\"); + return raiseError(\"FIXME: Not implemented yet in this preview release ({class_name})\"); }} ", From 7ca0f1b58df95ec23b59c890f88e1c7366350c9a Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 26 Sep 2018 00:13:30 +0000 Subject: [PATCH 19/22] Bug 1492563 - Enable blocking access to storage from tracking resources by default on all desktop platforms on Nightly r=baku Differential Revision: https://phabricator.services.mozilla.com/D6349 --- browser/app/profile/firefox.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 42a3da0f4c82..0ded12727188 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1509,6 +1509,11 @@ pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla. // Enable GMP support in the addon manager. pref("media.gmp-provider.enabled", true); +// Enable blocking access to storage from tracking resources by default on Nightly +#ifdef NIGHTLY_BUILD +pref("network.cookie.cookieBehavior", 4 /* BEHAVIOR_REJECT_TRACKER */); +#endif + pref("browser.contentblocking.allowlist.storage.enabled", true); #ifdef NIGHTLY_BUILD From db0cd81fb4c16a1661eafe8e755d1051bc00f27b Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 9 Oct 2018 15:01:52 +0200 Subject: [PATCH 20/22] Bug 1495669: Share bindgen flags globally; r=emilio, r=froydnj --HG-- extra : rebase_source : 83bfa2a61e523048d0e618ed5920c4aa143a2582 extra : histedit_source : cfc8de67959c5a2dffc5fea3ee5be172bfc370e1%2C53a6b4c0de444b4a7ee04cdd015568069bca893a --- build/moz.configure/android-ndk.configure | 10 +- build/moz.configure/bindgen.configure | 128 ++++++++++++++++++++++ build/moz.configure/toolchain.configure | 16 --- js/src/wasm/cranelift/build.rs | 70 ------------ layout/style/ServoBindings.toml | 58 ---------- servo/components/style/build_gecko.rs | 51 +-------- 6 files changed, 137 insertions(+), 196 deletions(-) diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure index 1078371a7a81..298995cebb6a 100644 --- a/build/moz.configure/android-ndk.configure +++ b/build/moz.configure/android-ndk.configure @@ -319,7 +319,7 @@ imply_option('--with-toolchain-prefix', android_toolchain_prefix, @depends(extra_toolchain_flags, android_toolchain, android_toolchain_prefix_base, '--help') @imports(_from='os.path', _import='isdir') -def bindgen_cflags_defaults(toolchain_flags, toolchain, toolchain_prefix, _): +def bindgen_cflags_android(toolchain_flags, toolchain, toolchain_prefix, _): if not toolchain_flags: return @@ -329,10 +329,10 @@ def bindgen_cflags_defaults(toolchain_flags, toolchain, toolchain_prefix, _): gcc_include = os.path.join( toolchain, 'lib', 'gcc', toolchain_prefix, '4.9') - cflags_format = "%s -I%s -I%s" - return cflags_format % (' '.join(toolchain_flags), - os.path.join(gcc_include, 'include'), - os.path.join(gcc_include, 'include-fixed')) + return toolchain_flags + [ + '-I%s' % os.path.join(gcc_include, 'include'), + '-I%s' % os.path.join(gcc_include, 'include-fixed'), + ] @depends(host, ndk) diff --git a/build/moz.configure/bindgen.configure b/build/moz.configure/bindgen.configure index 086219d4a012..f0b63060cb6a 100644 --- a/build/moz.configure/bindgen.configure +++ b/build/moz.configure/bindgen.configure @@ -212,3 +212,131 @@ def bindgen_config_paths(llvm_config, libclang_path, clang_path, set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path) set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path) + + +@depends(host, target, target_is_unix, c_compiler, bindgen_cflags_android) +def basic_bindgen_cflags(host, target, is_unix, compiler_info, android_cflags): + args = [ + '-x', 'c++', '-std=gnu++14', '-fno-sized-deallocation', + '-DTRACING=1', '-DIMPL_LIBXUL', '-DMOZILLA_INTERNAL_API', + '-DRUST_BINDGEN' + ] + + if is_unix: + args += ['-DOS_POSIX=1'] + + if target.os == 'Android': + args += android_cflags + + def handle_cpu(obj): + if 'cpu' in obj and target.cpu in obj['cpu']: + return obj['cpu'][target.cpu] + return [] + + if target.os == 'WINNT' and host.raw_os.startswith('gnu'): + args += handle_cpu({ + 'cpu': { + 'x86': ['--target=i686-pc-mingw32'], + 'x86_64': ['--target=x86_64-w64-mingw32'], + }, + }) + + os_dict = { + 'Android': { + 'default': ['-DOS_ANDROID=1'], + 'cpu': { + 'aarch64': ['--target=aarch64-linux-android'], + 'arm': ['--target=armv7-linux-androideabi'], + 'x86': ['--target=i686-linux-android'], + 'x86_64': ['--target=x86_64-linux-android'], + }, + }, + 'DragonFly': { + 'default': ['-DOS_BSD=1', '-DOS_DRAGONFLY=1'], + }, + 'FreeBSD': { + 'default': ['-DOS_BSD=1', '-DOS_FREEBSD=1'], + }, + 'GNU': { + 'default': ['-DOS_LINUX=1'], + 'cpu': { + 'x86': ['-m32'], + 'x86_64': ['-m64'], + }, + }, + 'NetBSD': { + 'default': ['-DOS_BSD=1', '-DOS_NETBSD=1'], + }, + 'OpenBSD': { + 'default': ['-DOS_BSD=1', '-DOS_OPENBSD=1'], + }, + 'OSX': { + 'default': [ + '-DOS_MACOSX=1', + '-stdlib=libc++', + # To disable the fixup bindgen applies which adds search + # paths from clang command line in order to avoid potential + # conflict with -stdlib=libc++. + '--target=x86_64-apple-darwin', + ], + }, + 'SunOS': { + 'default': ['-DOS_SOLARIS=1'], + }, + 'WINNT': { + 'default': [ + '-DOS_WIN=1', + '-DWIN32=1', + ], + 'compiler': { + 'msvc': { + 'default': [ + # For compatibility with MSVC 2015 + '-fms-compatibility-version=19', + # To enable the builtin __builtin_offsetof so that CRT wouldn't + # use reinterpret_cast in offsetof() which is not allowed inside + # static_assert(). + '-D_CRT_USE_BUILTIN_OFFSETOF', + # Enable hidden attribute (which is not supported by MSVC and + # thus not enabled by default with a MSVC-compatibile build) + # to exclude hidden symbols from the generated file. + '-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1', + ], + 'cpu': { + 'x86': ['--target=i686-pc-win32'], + 'x86_64': ['--target=x86_64-pc-win32'], + 'aarch64': ['--target=aarch64-pc-windows-msvc'], + }, + }, + }, + }, + }.get(target.os, {}) + + if 'default' in os_dict: + args += os_dict['default'] + + args += handle_cpu(os_dict) + if 'compiler' in os_dict and compiler_info and compiler_info in os_dict['compiler']: + compiler_dict = os_dict['compiler'].get(compiler_info) + if 'default' in compiler_dict: + args += compiler_dict['default'] + args += handle_cpu(compiler_dict) + + return args + + +js_option(env='BINDGEN_CFLAGS', + nargs=1, + help='Options bindgen should pass to the C/C++ parser') + + +@depends(basic_bindgen_cflags, 'BINDGEN_CFLAGS') +@checking('bindgen cflags', lambda s: s if s else 'no') +def bindgen_cflags(base_flags, extra_flags): + flags = base_flags + if extra_flags and len(extra_flags): + flags += extra_flags[0].split() + return ' '.join(flags) + + +add_old_configure_assignment('_BINDGEN_CFLAGS', bindgen_cflags) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 36b54e0982f0..e044f7771773 100755 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1126,22 +1126,6 @@ def check_have_64_bit(have_64_bit, compiler_have_64_bit): 'about the target bitness.') -js_option(env='BINDGEN_CFLAGS', - nargs=1, - default=bindgen_cflags_defaults, - help='Options bindgen should pass to the C/C++ parser') - - -@depends('BINDGEN_CFLAGS') -@checking('bindgen cflags', lambda s: s if s else 'no') -def bindgen_cflags(value): - if value and len(value): - return value[0].split() - - -add_old_configure_assignment('_BINDGEN_CFLAGS', bindgen_cflags) - - @depends(c_compiler) def default_debug_flags(compiler_info): # Debug info is ON by default. diff --git a/js/src/wasm/cranelift/build.rs b/js/src/wasm/cranelift/build.rs index 0d43b16cbf2d..a1f766108331 100644 --- a/js/src/wasm/cranelift/build.rs +++ b/js/src/wasm/cranelift/build.rs @@ -26,13 +26,6 @@ use std::fs::File; use std::io::prelude::*; use std::path::PathBuf; -enum Arch { - X86, - X64, - Arm, - Aarch64 -} - fn main() { // Tell Cargo to regenerate the bindings if the header file changes. println!("cargo:rerun-if-changed=baldrapi.h"); @@ -52,69 +45,6 @@ fn main() { .clang_args(&["-x", "c++", "-std=gnu++14", "-fno-sized-deallocation", "-DRUST_BINDGEN"]) .clang_arg("-I../.."); - let arch = { - let target_arch = env::var("CARGO_CFG_TARGET_ARCH"); - match target_arch.as_ref().map(|x| x.as_str()) { - Ok("aarch64") => Some(Arch::Aarch64), - Ok("arm") => Some(Arch::Arm), - Ok("x86") => Some(Arch::X86), - Ok("x86_64") => Some(Arch::X64), - _ => None - } - }; - - match env::var("CARGO_CFG_TARGET_OS").as_ref().map(|x| x.as_str()) { - Ok("android") => { - bindings = bindings.clang_arg("-DOS_ANDROID=1"); - bindings = match arch.expect("unknown android architecture") { - Arch::Aarch64 => { bindings.clang_arg("--target=aarch64-linux-android") } - Arch::Arm => { bindings.clang_arg("--target=armv7-linux-androideabi") } - Arch::X86 => { bindings.clang_arg("--target=i686-linux-android") } - Arch::X64 => { bindings.clang_arg("--target=x86_64-linux-android") } - }; - } - - Ok("linux") | Ok("freebsd") | Ok("dragonfly") | Ok("openbsd") | Ok("bitrig") | Ok("netbsd") - | Ok("ios") => { - // Nothing to do in particular for these OSes, until proven the contrary. - } - - Ok("macos") => { - bindings = bindings.clang_arg("-DOS_MACOSX=1"); - bindings = bindings.clang_arg("-stdlib=libc++"); - bindings = bindings.clang_arg("--target=x86_64-apple-darwin"); - } - - Ok("windows") => { - let arch = arch.expect("unknown Windows architecture"); - bindings = bindings.clang_arg("-DOS_WIN=1") - .clang_arg("-DWIN32=1"); - bindings = match env::var("CARGO_CFG_TARGET_ENV").as_ref().map(|x| x.as_str()) { - Ok("msvc") => { - bindings = bindings.clang_arg("-fms-compatibility-version=19"); - bindings = bindings.clang_arg("-D_CRT_USE_BUILTIN_OFFSETOF"); - bindings = bindings.clang_arg("-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1"); - match arch { - Arch::X86 => { bindings.clang_arg("--target=i686-pc-win32") }, - Arch::X64 => { bindings.clang_arg("--target=x86_64-pc-win32") }, - Arch::Aarch64 => { bindings.clang_arg("--target=aarch64-pc-windows-msvc") } - _ => panic!("unknown Windows architecture for msvc build") - } - } - Ok("gnu") => { - match arch { - Arch::X86 => { bindings.clang_arg("--target=i686-pc-mingw32") }, - Arch::X64 => { bindings.clang_arg("--target=x86_64-w64-mingw32") }, - _ => panic!("unknown Windows architecture for gnu build") - } - } - _ => panic!("unknown Windows build environment") - }; - } - - os => panic!("unknown target os {:?}!", os) - } - let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap()).join("js/src/rust/extra-bindgen-flags"); let mut extra_flags = String::new(); diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index 25cf372aa3bd..c88138bf8472 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -1,61 +1,3 @@ -[build] -args = [ - "-x", "c++", "-std=gnu++14", "-fno-sized-deallocation", - "-DTRACING=1", "-DIMPL_LIBXUL", "-DMOZ_STYLO_BINDINGS=1", - "-DMOZILLA_INTERNAL_API", "-DRUST_BINDGEN" -] -"family=unix" = ["-DOS_POSIX=1"] -"os=solaris" = ["-DOS_SOLARIS=1"] -"os=dragonfly" = ["-DOS_BSD=1", "-DOS_DRAGONFLY=1"] -"os=freebsd" = ["-DOS_BSD=1", "-DOS_FREEBSD=1"] -"os=netbsd" = ["-DOS_BSD=1", "-DOS_NETBSD=1"] -"os=openbsd" = ["-DOS_BSD=1", "-DOS_OPENBSD=1"] -"os=macos" = [ - "-DOS_MACOSX=1", "-stdlib=libc++", - # To disable the fixup bindgen applies which adds search - # paths from clang command line in order to avoid potential - # conflict with -stdlib=libc++. - "--target=x86_64-apple-darwin", -] - -[build."os=linux"] -args = ["-DOS_LINUX=1"] -"arch=x86" = ["-m32"] -"arch=x86_64" = ["-m64"] - -[build."os=android"] -args = ["-DOS_ANDROID=1"] -"arch=aarch64" = ["--target=aarch64-linux-android"] -"arch=arm" = ["--target=armv7-linux-androideabi"] -"arch=x86" = ["--target=i686-linux-android"] -"arch=x86_64" = ["--target=x86_64-linux-android"] - -[build."os=windows"] -args = [ - "-DOS_WIN=1", "-DWIN32=1", -] - -[build."os=windows"."env=msvc"] -args = [ - # For compatibility with MSVC 2015 - "-fms-compatibility-version=19", - # To enable the builtin __builtin_offsetof so that CRT wouldn't - # use reinterpret_cast in offsetof() which is not allowed inside - # static_assert(). - "-D_CRT_USE_BUILTIN_OFFSETOF", - # Enable hidden attribute (which is not supported by MSVC and - # thus not enabled by default with a MSVC-compatibile build) - # to exclude hidden symbols from the generated file. - "-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1", -] -"arch=x86" = ["--target=i686-pc-win32"] -"arch=x86_64" = ["--target=x86_64-pc-win32"] -"arch=aarch64" = ["--target=aarch64-pc-windows-msvc"] - -[build."os=windows"."env=gnu"] -"arch=x86" = ["--target=i686-pc-mingw32"] -"arch=x86_64" = ["--target=x86_64-w64-mingw32"] - [structs] headers = [ "nsStyleStruct.h", diff --git a/servo/components/style/build_gecko.rs b/servo/components/style/build_gecko.rs index c8e886c4b29e..9db123a422f6 100644 --- a/servo/components/style/build_gecko.rs +++ b/servo/components/style/build_gecko.rs @@ -58,22 +58,10 @@ mod bindings { }; static ref BUILD_CONFIG: Table = { // Load build-specific config overrides. - // FIXME: We should merge with CONFIG above instead of - // forcing callers to do it. let path = PathBuf::from(env::var_os("MOZ_TOPOBJDIR").unwrap()) .join("layout/style/bindgen.toml"); read_config(&path) }; - static ref TARGET_INFO: HashMap = { - const TARGET_PREFIX: &'static str = "CARGO_CFG_TARGET_"; - let mut result = HashMap::new(); - for (k, v) in env::vars() { - if k.starts_with(TARGET_PREFIX) { - result.insert(k[TARGET_PREFIX.len()..].to_lowercase(), v); - } - } - result - }; static ref INCLUDE_RE: Regex = Regex::new(r#"#include\s*"(.+?)""#).unwrap(); static ref DISTDIR_PATH: PathBuf = { let path = PathBuf::from(env::var_os("MOZ_DIST").unwrap()); @@ -145,35 +133,6 @@ mod bindings { fn mutable_borrowed_type(self, ty: &str) -> Builder; } - fn add_clang_args(mut builder: Builder, config: &Table, matched_os: &mut bool) -> Builder { - fn add_args(mut builder: Builder, values: &[toml::Value]) -> Builder { - for item in values.iter() { - builder = builder.clang_arg(item.as_str().expect("Expect string in list")); - } - builder - } - for (k, v) in config.iter() { - if k == "args" { - builder = add_args(builder, v.as_array().unwrap().as_slice()); - continue; - } - let equal_idx = k.find('=').expect(&format!("Invalid key: {}", k)); - let (target_type, target_value) = k.split_at(equal_idx); - if TARGET_INFO[target_type] != target_value[1..] { - continue; - } - if target_type == "os" { - *matched_os = true; - } - builder = match *v { - toml::Value::Table(ref table) => add_clang_args(builder, table, matched_os), - toml::Value::Array(ref array) => add_args(builder, array), - _ => panic!("Unknown type"), - }; - } - builder - } - impl BuilderExt for Builder { fn get_initial_builder() -> Builder { use bindgen::RustTarget; @@ -207,16 +166,14 @@ mod bindings { builder = builder.clang_arg("-DDEBUG=1").clang_arg("-DJS_DEBUG=1"); } - let mut matched_os = false; - let build_config = CONFIG["build"].as_table().expect("Malformed config file"); - builder = add_clang_args(builder, build_config, &mut matched_os); let build_config = BUILD_CONFIG["build"] .as_table() .expect("Malformed config file"); - builder = add_clang_args(builder, build_config, &mut matched_os); - if !matched_os { - panic!("Unknown platform"); + let extra_bindgen_flags = build_config["args"].as_array().unwrap().as_slice(); + for item in extra_bindgen_flags.iter() { + builder = builder.clang_arg(item.as_str().expect("Expect string in list")); } + builder } fn include>(self, file: T) -> Builder { From 9c477e78d3cdbc14eb253df5a016c9d7ca7b0964 Mon Sep 17 00:00:00 2001 From: Coroiu Cristina Date: Mon, 15 Oct 2018 19:00:20 +0300 Subject: [PATCH 21/22] Backed out changeset c3c3a9571f63 (bug 1363169) for Bmsvc build bustage at build/src/widget/windows/WindowsUIUtils.cpp --- browser/base/content/browser-pageActions.js | 14 +- browser/base/content/test/urlbar/browser.ini | 4 - .../browser_page_action_menu_share_win.html | 2 - .../browser_page_action_menu_share_win.js | 45 ------ browser/modules/PageActions.jsm | 15 -- browser/themes/windows/browser.css | 4 - browser/themes/windows/jar.mn | 1 - browser/themes/windows/share.svg | 7 - widget/nsIWindowsUIUtils.idl | 6 +- widget/windows/WindowsUIUtils.cpp | 131 ------------------ 10 files changed, 5 insertions(+), 224 deletions(-) delete mode 100644 browser/base/content/test/urlbar/browser_page_action_menu_share_win.html delete mode 100644 browser/base/content/test/urlbar/browser_page_action_menu_share_win.js delete mode 100644 browser/themes/windows/share.svg diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index c2d47527d5f9..3f604a151d32 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -1203,12 +1203,6 @@ BrowserPageActions.addSearchEngine = { // share URL BrowserPageActions.shareURL = { - onCommand(event, buttonNode) { - let browser = gBrowser.selectedBrowser; - let currentURI = gURLBar.makeURIReadable(browser.currentURI).displaySpec; - this._windowsUIUtils.shareUrl(currentURI, browser.contentTitle); - }, - onShowingInPanel(buttonNode) { this._cached = false; }, @@ -1270,7 +1264,7 @@ BrowserPageActions.shareURL = { }; // Attach sharingService here so tests can override the implementation -XPCOMUtils.defineLazyServiceGetters(BrowserPageActions.shareURL, { - _sharingService: ["@mozilla.org/widget/macsharingservice;1", "nsIMacSharingService"], - _windowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"], -}); +XPCOMUtils.defineLazyServiceGetter(BrowserPageActions.shareURL, + "_sharingService", + "@mozilla.org/widget/macsharingservice;1", + "nsIMacSharingService"); diff --git a/browser/base/content/test/urlbar/browser.ini b/browser/base/content/test/urlbar/browser.ini index edfbab3e05ae..4166c66650ee 100644 --- a/browser/base/content/test/urlbar/browser.ini +++ b/browser/base/content/test/urlbar/browser.ini @@ -57,10 +57,6 @@ support-files = subsuite = clipboard [browser_page_action_menu_share_mac.js] skip-if = os != "mac" # Mac only feature -[browser_page_action_menu_share_win.js] -support-files = - browser_page_action_menu_share_win.html -skip-if = os != "win" # Windows only feature [browser_pasteAndGo.js] subsuite = clipboard [browser_populateAfterPushState.js] diff --git a/browser/base/content/test/urlbar/browser_page_action_menu_share_win.html b/browser/base/content/test/urlbar/browser_page_action_menu_share_win.html deleted file mode 100644 index 6c47f98c7e24..000000000000 --- a/browser/base/content/test/urlbar/browser_page_action_menu_share_win.html +++ /dev/null @@ -1,2 +0,0 @@ - -Windows Sharing diff --git a/browser/base/content/test/urlbar/browser_page_action_menu_share_win.js b/browser/base/content/test/urlbar/browser_page_action_menu_share_win.js deleted file mode 100644 index f98602571578..000000000000 --- a/browser/base/content/test/urlbar/browser_page_action_menu_share_win.js +++ /dev/null @@ -1,45 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -/* global sinon */ -Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js"); - -const TEST_URL = getRootDirectory(gTestPath) + "browser_page_action_menu_share_win.html"; - -// Keep track of site details we are sharing -let sharedUrl, sharedTitle; - -let stub = sinon.stub(BrowserPageActions.shareURL, "_windowsUIUtils").get(() => { - return { - shareUrl(url, title) { - sharedUrl = url; - sharedTitle = title; - }, - }; -}); - -registerCleanupFunction(async function() { - stub.restore(); - delete window.sinon; -}); - -add_task(async function shareURL() { - await BrowserTestUtils.withNewTab(TEST_URL, async () => { - // Open the panel. - await promisePageActionPanelOpen(); - - // Click Share URL. - let shareURLButton = document.getElementById("pageAction-panel-shareURL"); - let hiddenPromise = promisePageActionPanelHidden(); - EventUtils.synthesizeMouseAtCenter(shareURLButton, {}); - - await hiddenPromise; - - Assert.equal(sharedUrl, TEST_URL, - "Shared correct URL"); - Assert.equal(sharedTitle, "Windows Sharing", - "Shared with the correct title"); - }); -}); diff --git a/browser/modules/PageActions.jsm b/browser/modules/PageActions.jsm index af682725f0e4..7f8455fe9068 100644 --- a/browser/modules/PageActions.jsm +++ b/browser/modules/PageActions.jsm @@ -1185,21 +1185,6 @@ if (AppConstants.platform == "macosx") { }); } -if (AppConstants.isPlatformAndVersionAtLeast("win", "6.4")) { - gBuiltInActions.push( - // Share URL - { - id: "shareURL", - title: "shareURL-title", - onBeforePlacedInWindow(buttonNode) { - browserPageActions(buttonNode).shareURL.onBeforePlacedInWindow(buttonNode); - }, - onCommand(event, buttonNode) { - browserPageActions(buttonNode).shareURL.onCommand(event, buttonNode); - }, - }); -} - /** * Gets a BrowserPageActions object in a browser window. * diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index 9de31faebd5d..ae3f43ffc188 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -597,10 +597,6 @@ html|*.urlbar-input:-moz-lwtheme::placeholder, color: GrayText; } -#pageAction-panel-shareURL { - list-style-image: url("chrome://browser/skin/share.svg"); -} - %include ../shared/urlbarSearchSuggestionsNotification.inc.css #search-container { diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn index 57e60ea7cbaa..e6ce8e18a498 100644 --- a/browser/themes/windows/jar.mn +++ b/browser/themes/windows/jar.mn @@ -41,7 +41,6 @@ browser.jar: * skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css) * skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css) skin/classic/browser/preferences/applications.css (preferences/applications.css) - skin/classic/browser/share.svg (share.svg) skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) skin/classic/browser/window-controls/close.svg (window-controls/close.svg) skin/classic/browser/window-controls/close-highcontrast.svg (window-controls/close-highcontrast.svg) diff --git a/browser/themes/windows/share.svg b/browser/themes/windows/share.svg deleted file mode 100644 index 3d5c2fe86f2b..000000000000 --- a/browser/themes/windows/share.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/widget/nsIWindowsUIUtils.idl b/widget/nsIWindowsUIUtils.idl index 779cc4ac9af5..331562a67245 100644 --- a/widget/nsIWindowsUIUtils.idl +++ b/widget/nsIWindowsUIUtils.idl @@ -20,9 +20,5 @@ interface nsIWindowsUIUtils : nsISupports * Update the tablet mode state */ void updateTabletModeState(); - - /** - * Share URL - */ - void shareUrl(in AString shareTitle, in AString urlToShare); }; + diff --git a/widget/windows/WindowsUIUtils.cpp b/widget/windows/WindowsUIUtils.cpp index e6630baf7aed..4d916d25cf1e 100644 --- a/widget/windows/WindowsUIUtils.cpp +++ b/widget/windows/WindowsUIUtils.cpp @@ -35,7 +35,6 @@ using namespace ABI::Windows::UI::ViewManagement; using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; using namespace ABI::Windows::Foundation; -using namespace ABI::Windows::ApplicationModel::DataTransfer; /* All of this is win10 stuff and we're compiling against win81 headers * for now, so we may need to do some legwork: */ @@ -91,21 +90,6 @@ public: }; #endif -#ifndef __IDataTransferManagerInterop_INTERFACE_DEFINED__ -#define __IDataTransferManagerInterop_INTERFACE_DEFINED__ - -typedef interface IDataTransferManagerInterop IDataTransferManagerInterop; - -MIDL_INTERFACE("3A3DCD6C-3EAB-43DC-BCDE-45671CE800C8") -IDataTransferManagerInterop : public IUnknown -{ -public: - virtual HRESULT STDMETHODCALLTYPE GetForWindow(HWND appWindow, REFIID riid, void **dataTransferManager) = 0; - virtual HRESULT STDMETHODCALLTYPE ShowShareUIForWindow(HWND appWindow) = 0; -}; - -#endif - #endif WindowsUIUtils::WindowsUIUtils() : @@ -194,118 +178,3 @@ WindowsUIUtils::UpdateTabletModeState() return NS_OK; } - -struct HStringDeleter -{ - typedef HSTRING pointer; - void operator()(pointer aString) - { - WindowsDeleteString(aString); - } -}; - -typedef mozilla::UniquePtr HStringUniquePtr; - -NS_IMETHODIMP -WindowsUIUtils::ShareUrl(const nsAString& aUrlToShare, - const nsAString& aShareTitle) -{ -#ifndef __MINGW32__ - if (!IsWin10OrLater()) { - return NS_OK; - } - - HSTRING rawTitle; - HRESULT hr = WindowsCreateString(PromiseFlatString(aShareTitle).get(), aShareTitle.Length(), &rawTitle); - if (FAILED(hr)) { - return NS_OK; - } - HStringUniquePtr title(rawTitle); - - HSTRING rawUrl; - hr = WindowsCreateString(PromiseFlatString(aUrlToShare).get(), aUrlToShare.Length(), &rawUrl); - if (FAILED(hr)) { - return NS_OK; - } - HStringUniquePtr url(rawUrl); - - ComPtr uriFactory; - hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Foundation_Uri).Get(), &uriFactory); - if (FAILED(hr)) { - return NS_OK; - } - - ComPtr uri; - hr = uriFactory->CreateUri(url.get(), &uri); - if (FAILED(hr)) { - return NS_OK; - } - - HWND hwnd = GetForegroundWindow(); - if (!hwnd) { - return NS_OK; - } - - ComPtr dtmInterop; - hr = RoGetActivationFactory(HStringReference( - RuntimeClass_Windows_ApplicationModel_DataTransfer_DataTransferManager) - .Get(), IID_PPV_ARGS(&dtmInterop)); - if (FAILED(hr)) { - return NS_OK; - } - - ComPtr dtm; - hr = dtmInterop->GetForWindow(hwnd, IID_PPV_ARGS(&dtm)); - if (FAILED(hr)) { - return NS_OK; - } - - auto callback = Callback < ITypedEventHandler> ( - [uri = std::move(uri), title = std::move(title)](IDataTransferManager*, IDataRequestedEventArgs* pArgs) -> HRESULT - { - ComPtr spDataRequest; - HRESULT hr = pArgs->get_Request(&spDataRequest); - if (FAILED(hr)) { - return hr; - } - - ComPtr spDataPackage; - hr = spDataRequest->get_Data(&spDataPackage); - if (FAILED(hr)) { - return hr; - } - - ComPtr spDataPackageProperties; - hr = spDataPackage->get_Properties(&spDataPackageProperties); - if (FAILED(hr)) { - return hr; - } - - hr = spDataPackageProperties->put_Title(title.get()); - if (FAILED(hr)) { - return hr; - } - - hr = spDataPackage->SetUri(uri.Get()); - if (FAILED(hr)) { - return hr; - } - - return S_OK; - }); - - EventRegistrationToken dataRequestedToken; - hr = dtm->add_DataRequested(callback.Get(), &dataRequestedToken); - if (FAILED(hr)) { - return NS_OK; - } - - hr = dtmInterop->ShowShareUIForWindow(hwnd); - if (FAILED(hr)) { - return NS_OK; - } - -#endif - - return NS_OK; -} From f1265a51160be6a66648b16b6da7c0d29d7a6d14 Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Mon, 15 Oct 2018 21:20:11 +0300 Subject: [PATCH 22/22] Backed out changeset ccf6f87d3430 (bug 1492563) for nsPermissionManager.cpp and test_cookie_fetch.html failures CLOSED TREE --- browser/app/profile/firefox.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 0ded12727188..42a3da0f4c82 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1509,11 +1509,6 @@ pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla. // Enable GMP support in the addon manager. pref("media.gmp-provider.enabled", true); -// Enable blocking access to storage from tracking resources by default on Nightly -#ifdef NIGHTLY_BUILD -pref("network.cookie.cookieBehavior", 4 /* BEHAVIOR_REJECT_TRACKER */); -#endif - pref("browser.contentblocking.allowlist.storage.enabled", true); #ifdef NIGHTLY_BUILD