зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to mozilla-central. a=merge
This commit is contained in:
Коммит
8ed22fcd56
|
@ -16,11 +16,9 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
|
|||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
"CrashSubmit",
|
||||
"resource://gre/modules/CrashSubmit.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
CrashSubmit: "resource://gre/modules/CrashSubmit.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(lazy, "gNavigatorBundle", function() {
|
||||
const url = "chrome://browser/locale/browser.properties";
|
||||
|
|
|
@ -2869,6 +2869,10 @@
|
|||
),
|
||||
},
|
||||
],
|
||||
// Make sure to store the userContextId associated to the lazy tab
|
||||
// otherwise it would be created as a default tab when recreated on a
|
||||
// session restore (See Bug 1819794).
|
||||
userContextId,
|
||||
});
|
||||
} else {
|
||||
this._insertBrowser(t, true);
|
||||
|
|
|
@ -123,7 +123,7 @@ if (
|
|||
|
||||
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||
startupPhases["before handling user events"].denylist.modules.add(
|
||||
"resource://gre/modules/CrashSubmit.jsm"
|
||||
"resource://gre/modules/CrashSubmit.sys.mjs"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ add_task(async function test_execute_sidebar_action() {
|
|||
default_panel: "sidebar.html",
|
||||
},
|
||||
},
|
||||
// We want to confirm that sidebar is not shown on every extension start,
|
||||
// so we use an explicit APP_STARTUP.
|
||||
startupReason: "APP_STARTUP",
|
||||
files: {
|
||||
"sidebar.html": `
|
||||
<!DOCTYPE html>
|
||||
|
@ -42,11 +45,9 @@ add_task(async function test_execute_sidebar_action() {
|
|||
|
||||
await extension.startup();
|
||||
await SimpleTest.promiseFocus(window);
|
||||
// Since we didn't set useAddonManager, the sidebar will not be automatically
|
||||
// opened for this test.
|
||||
ok(
|
||||
document.getElementById("sidebar-box").hidden,
|
||||
"sidebar box is not visible"
|
||||
`Sidebar box is not visible after "not-first" startup.`
|
||||
);
|
||||
// Send the key to open the sidebar.
|
||||
EventUtils.synthesizeKey("j", { altKey: true, shiftKey: true });
|
||||
|
|
|
@ -60,6 +60,81 @@ add_task(async function test_discarded() {
|
|||
BrowserTestUtils.removeTab(testTab);
|
||||
});
|
||||
|
||||
// Regression test for Bug 1819794.
|
||||
add_task(async function test_create_discarded_with_cookieStoreId() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: ["contextualIdentities", "cookies"],
|
||||
},
|
||||
async background() {
|
||||
const [{ cookieStoreId }] = await browser.contextualIdentities.query({});
|
||||
browser.test.assertEq(
|
||||
"firefox-container-1",
|
||||
cookieStoreId,
|
||||
"Got expected cookieStoreId"
|
||||
);
|
||||
await browser.tabs.create({
|
||||
url: `http://example.com/#${cookieStoreId}`,
|
||||
cookieStoreId,
|
||||
discarded: true,
|
||||
});
|
||||
await browser.tabs.create({
|
||||
url: `http://example.com/#no-container`,
|
||||
discarded: true,
|
||||
});
|
||||
},
|
||||
// Needed by ExtensionSettingsStore (as a side-effect of contextualIdentities permission).
|
||||
useAddonManager: "temporary",
|
||||
});
|
||||
|
||||
const tabContainerPromise = BrowserTestUtils.waitForEvent(
|
||||
window,
|
||||
"TabOpen",
|
||||
false,
|
||||
evt => {
|
||||
return evt.target.getAttribute("usercontextid", "1");
|
||||
}
|
||||
).then(evt => evt.target);
|
||||
const tabDefaultPromise = BrowserTestUtils.waitForEvent(
|
||||
window,
|
||||
"TabOpen",
|
||||
false,
|
||||
evt => {
|
||||
return !evt.target.hasAttribute("usercontextid");
|
||||
}
|
||||
).then(evt => evt.target);
|
||||
|
||||
await extension.startup();
|
||||
|
||||
const tabContainer = await tabContainerPromise;
|
||||
ok(
|
||||
tabContainer.hasAttribute("pending"),
|
||||
"new container tab should be discarded"
|
||||
);
|
||||
const tabContainerState = SessionStore.getTabState(tabContainer);
|
||||
is(
|
||||
JSON.parse(tabContainerState).userContextId,
|
||||
1,
|
||||
`Expect a userContextId associated to the new discarded container tab: ${tabContainerState}`
|
||||
);
|
||||
|
||||
const tabDefault = await tabDefaultPromise;
|
||||
ok(
|
||||
tabDefault.hasAttribute("pending"),
|
||||
"new non-container tab should be discarded"
|
||||
);
|
||||
const tabDefaultState = SessionStore.getTabState(tabDefault);
|
||||
is(
|
||||
JSON.parse(tabDefaultState).userContextId,
|
||||
0,
|
||||
`Expect userContextId 0 associated to the new discarded non-container tab: ${tabDefaultState}`
|
||||
);
|
||||
|
||||
BrowserTestUtils.removeTab(tabContainer);
|
||||
BrowserTestUtils.removeTab(tabDefault);
|
||||
await extension.unload();
|
||||
});
|
||||
|
||||
// If discard is called immediately after creating a new tab, the new tab may not have loaded,
|
||||
// and the sessionstore for that tab is not ready for discarding. The result was a corrupted
|
||||
// sessionstore for the tab, which when the tab was activated, resulted in a tab with partial
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "10cec1b311554f5fc51429bcaea26d8daab5ccf6"
|
||||
"revision": "4dcef9fde9c28efbf1606807481a58b899e7d76f"
|
||||
},
|
||||
"af": {
|
||||
"pin": false,
|
||||
|
@ -33,7 +33,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "2464536a688c02aae2dfac0bc0f754408ab01f30"
|
||||
"revision": "913a0d15758ecfd6d975f8e1f8e03bf79d4f9bc7"
|
||||
},
|
||||
"an": {
|
||||
"pin": false,
|
||||
|
@ -51,7 +51,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "27e2e38ca60bf912697b9d13ac3dacf325bc1dd8"
|
||||
"revision": "124061055606e35b554eacdf2e6c666529927d33"
|
||||
},
|
||||
"ar": {
|
||||
"pin": false,
|
||||
|
@ -69,7 +69,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "b4d862f7d8f70c79ea40249472b75a18901ced8a"
|
||||
"revision": "582d287b8e18f0476d5c7534f0665a9b88b4f057"
|
||||
},
|
||||
"ast": {
|
||||
"pin": false,
|
||||
|
@ -87,7 +87,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "e01e4677180ddb387533bc847ba1b32d84ae8db8"
|
||||
"revision": "b9a9ca2c98437209167a8401a6b39ea2e33c9aef"
|
||||
},
|
||||
"az": {
|
||||
"pin": false,
|
||||
|
@ -105,7 +105,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "d15e4f1b98d49a48f57039a0bd332ca47e158859"
|
||||
"revision": "1588ffcfcdaef151e47ff5dc0575d6f286e9d47d"
|
||||
},
|
||||
"be": {
|
||||
"pin": false,
|
||||
|
@ -123,7 +123,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "2b55ac65a8c306b0c7dc8c1611fd535d7705682c"
|
||||
"revision": "203b4258734ba722188a2f190dcb1906a5b05dcc"
|
||||
},
|
||||
"bg": {
|
||||
"pin": false,
|
||||
|
@ -141,7 +141,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "cd4a32db66fd302c3ef8f2e5462c9cb3101bfbe2"
|
||||
"revision": "c49041a6949b3c524f3660bbf232de46b1e0ea07"
|
||||
},
|
||||
"bn": {
|
||||
"pin": false,
|
||||
|
@ -159,7 +159,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "a30fa1bfcf5fcbc35e0b55ba285792b60837ac8c"
|
||||
"revision": "cd666ea938c8ca2204f508aed4e3aa5ee8c95c85"
|
||||
},
|
||||
"bo": {
|
||||
"pin": false,
|
||||
|
@ -177,7 +177,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "eb98ccdeb631d721a0671b5798fc0b2d652ad1ab"
|
||||
"revision": "75606a839b910a7ab102f2b42eda6a8fb463e6c0"
|
||||
},
|
||||
"br": {
|
||||
"pin": false,
|
||||
|
@ -195,7 +195,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "95bc8f88101eac1a034d17856c53027832751299"
|
||||
"revision": "1f2857dbc02ff46a57b0d3d69cda64a5da0acb09"
|
||||
},
|
||||
"brx": {
|
||||
"pin": false,
|
||||
|
@ -213,7 +213,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "af14cafc566adc6b5fa6449f718be54646dfd5ee"
|
||||
"revision": "c2b18479129e480365a179949f6d811186c9dbab"
|
||||
},
|
||||
"bs": {
|
||||
"pin": false,
|
||||
|
@ -231,7 +231,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "bcdac5c2fb8b71f788d06bcd7b8a6ec544b3c59d"
|
||||
"revision": "a8595cee977a83f4f68d9787c8000771a2684fae"
|
||||
},
|
||||
"ca": {
|
||||
"pin": false,
|
||||
|
@ -249,7 +249,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1ecf304ecc6c82c5a0a6c4fbc7ca97a59e7177b1"
|
||||
"revision": "75156ed0cb52483d6b07a99647e7f42ff2dc7177"
|
||||
},
|
||||
"ca-valencia": {
|
||||
"pin": false,
|
||||
|
@ -267,7 +267,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "9416377b81cc82a23a649121fec43db540d6d8fa"
|
||||
"revision": "6809d424fa291944c651f5ab40fa5864356368ee"
|
||||
},
|
||||
"cak": {
|
||||
"pin": false,
|
||||
|
@ -285,7 +285,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1037621f808dbc8db8d1e2f152522075e5318826"
|
||||
"revision": "ce970e993767c78535d2bf7fa2de8d4ed08ae443"
|
||||
},
|
||||
"ckb": {
|
||||
"pin": false,
|
||||
|
@ -303,7 +303,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "909ebfa0a2b48739fdf5ba9a9c18a43044a76b02"
|
||||
"revision": "c15fb6ef29ee45276360f41daac9a0c58900719a"
|
||||
},
|
||||
"cs": {
|
||||
"pin": false,
|
||||
|
@ -321,7 +321,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "d3426cf3b0277e4a48c47055a781fb710c4d45b3"
|
||||
"revision": "fcb23c297c9a489bb5fa2f661d4559030f5c2801"
|
||||
},
|
||||
"cy": {
|
||||
"pin": false,
|
||||
|
@ -339,7 +339,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "f608af20f398a517fb01a65efd469211673620d7"
|
||||
"revision": "09dd0e84a6e8dbd57dbbecadab64cf2b8acd0522"
|
||||
},
|
||||
"da": {
|
||||
"pin": false,
|
||||
|
@ -357,7 +357,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "318809f3d25b890d9b6a62f3d3b9128e9a945ce6"
|
||||
"revision": "82642e613f9f37ec6beb8397dc132512c5c78eba"
|
||||
},
|
||||
"de": {
|
||||
"pin": false,
|
||||
|
@ -375,7 +375,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "8d74351ed62814678863f5d443f01e8e07a32d9b"
|
||||
"revision": "9e64f62a2c33ad6aef1c498ed7561a5ff2140535"
|
||||
},
|
||||
"dsb": {
|
||||
"pin": false,
|
||||
|
@ -393,7 +393,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "395b472d5b1afccbf28634a20d9091e6b6405bdf"
|
||||
"revision": "ace8a293ebd9aaff70b8a994b6fe5f70c24bbd28"
|
||||
},
|
||||
"el": {
|
||||
"pin": false,
|
||||
|
@ -411,7 +411,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "a03f9806fdb4054989a46c2fe2ae1b1882e30d1c"
|
||||
"revision": "f213ddf7563059e2611fcf2146239ef9254ad3de"
|
||||
},
|
||||
"en-CA": {
|
||||
"pin": false,
|
||||
|
@ -429,7 +429,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "9a2fc1e74b318d213e384e21b3910a9c6ca71ed1"
|
||||
"revision": "61268c7871a798328f08051b5c412698269329fc"
|
||||
},
|
||||
"en-GB": {
|
||||
"pin": false,
|
||||
|
@ -447,7 +447,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1e5d7da54bb3739b6307924bff1306b126f2dbcc"
|
||||
"revision": "ea47a97afb48c7b7eb511a66381c92abd31b7a7c"
|
||||
},
|
||||
"eo": {
|
||||
"pin": false,
|
||||
|
@ -465,7 +465,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "acfe472711938b401b9fb27a7425fc29b171d53f"
|
||||
"revision": "4b68e9a4ab3385f9f02c6405c22bc30cc9924b43"
|
||||
},
|
||||
"es-AR": {
|
||||
"pin": false,
|
||||
|
@ -483,7 +483,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "7fe6b158fb40c50fe85b1ee760a7f6ad8fcc4cce"
|
||||
"revision": "a0ff7edc6018f1c078a1185f4f80569c54c5a6c5"
|
||||
},
|
||||
"es-CL": {
|
||||
"pin": false,
|
||||
|
@ -501,7 +501,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "29d8f1f205d4ff25492530ca8270e7f9132a1561"
|
||||
"revision": "cdbba70f3a8f5756b847f7e478aedf4843bcc67b"
|
||||
},
|
||||
"es-ES": {
|
||||
"pin": false,
|
||||
|
@ -519,7 +519,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "2ff0ff19edca1485bb701dd24412c2b0a5d1673e"
|
||||
"revision": "d3f35e48498abec3bbbdfbe61743bd4480be22e8"
|
||||
},
|
||||
"es-MX": {
|
||||
"pin": false,
|
||||
|
@ -537,7 +537,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "8364cad66d8d2da9bf5a0c24db6af9ef3b78a024"
|
||||
"revision": "d561a9c7cf0fd8355e11a344d4af1ca9904053db"
|
||||
},
|
||||
"et": {
|
||||
"pin": false,
|
||||
|
@ -555,7 +555,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "fc09dbd3e54982a544f26768f6b82be99fd3dda8"
|
||||
"revision": "fc4150780382b184b33c86cfd223e93da4ac6af6"
|
||||
},
|
||||
"eu": {
|
||||
"pin": false,
|
||||
|
@ -573,7 +573,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "d82b0f37d25705078db125be2abea0cd06d61ee0"
|
||||
"revision": "1249d363f995fa083291815d9d98addabc4d2119"
|
||||
},
|
||||
"fa": {
|
||||
"pin": false,
|
||||
|
@ -591,7 +591,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "e3b0e9ca5efca5a8538f772bb287664ddeabf112"
|
||||
"revision": "8aad252023ad59453fab9a8e0ddab40307821c87"
|
||||
},
|
||||
"ff": {
|
||||
"pin": false,
|
||||
|
@ -609,7 +609,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "de5688e760aa79389238739eaa913dfcd075dc26"
|
||||
"revision": "7ec66aeee9cc382c2f56995bb457fdd05db1b3ab"
|
||||
},
|
||||
"fi": {
|
||||
"pin": false,
|
||||
|
@ -627,7 +627,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "b3de66eed7f8ad4d822fbed87a51865dbaf45caf"
|
||||
"revision": "d2bdb72c657c66b9d97c2dfc74c479369b95b43a"
|
||||
},
|
||||
"fr": {
|
||||
"pin": false,
|
||||
|
@ -645,7 +645,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "353063dae24690d52ace14132ead22933ae95455"
|
||||
"revision": "e5f147445cb9abe473b7330136f937faf90adb5d"
|
||||
},
|
||||
"fur": {
|
||||
"pin": false,
|
||||
|
@ -663,7 +663,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "831b327152a57bb1b492feb985547a99344aa3bb"
|
||||
"revision": "3bc1ccfaeb63a69c7fc09b8adbe4ffb23dcb1d55"
|
||||
},
|
||||
"fy-NL": {
|
||||
"pin": false,
|
||||
|
@ -681,7 +681,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "642ebb46d26b045841cd923af482ca0db302081e"
|
||||
"revision": "e8e322dfae0f8686f9f4bae9ef222a7ec4898435"
|
||||
},
|
||||
"ga-IE": {
|
||||
"pin": false,
|
||||
|
@ -699,7 +699,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "47cc8acbc79bbe29611321efbe0ea7d2d566c8e0"
|
||||
"revision": "4695c27b841671a80dba98bd7f00a84b77bd336d"
|
||||
},
|
||||
"gd": {
|
||||
"pin": false,
|
||||
|
@ -717,7 +717,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "11eafbae1c48be53565d9de6d1742b3dad7447c2"
|
||||
"revision": "c5e9042c9c74e9b0f998c35a37f6d8e0b1b1a728"
|
||||
},
|
||||
"gl": {
|
||||
"pin": false,
|
||||
|
@ -735,7 +735,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "761c582b21067e2d82dbd4a12e55d4cbaaf4fae2"
|
||||
"revision": "65bf11d2c463eae9afd864923d380e3d42a484c5"
|
||||
},
|
||||
"gn": {
|
||||
"pin": false,
|
||||
|
@ -753,7 +753,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "95a6e012645b4176ff9d8c47c7c3d101a8c1065e"
|
||||
"revision": "d12c0b0952f3a175dfad255fb21a6d06dd81c994"
|
||||
},
|
||||
"gu-IN": {
|
||||
"pin": false,
|
||||
|
@ -771,7 +771,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "dae8b7a2957b8a18cfd4e961020ddc18dec78196"
|
||||
"revision": "d648295a49b2c5a291ea38f492c54d6c2fc4d298"
|
||||
},
|
||||
"he": {
|
||||
"pin": false,
|
||||
|
@ -789,7 +789,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "395f2d401290c5f6ca35487b4a42a852f7d11b13"
|
||||
"revision": "c23edad8a11c874a8d7ce62122b2856f5e225f4b"
|
||||
},
|
||||
"hi-IN": {
|
||||
"pin": false,
|
||||
|
@ -807,7 +807,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "c5d12bbc65a2105e5e11b4adbb0a23405412e755"
|
||||
"revision": "d8952d49dbb0b2a5387902cb1ecd2ba6d9be0cb5"
|
||||
},
|
||||
"hr": {
|
||||
"pin": false,
|
||||
|
@ -825,7 +825,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "9ff572dd0fc3b0eb1d1972f8820b850cacbdcc23"
|
||||
"revision": "1e3648a9e5b4e2b0119e1036f6d6f6793736ff74"
|
||||
},
|
||||
"hsb": {
|
||||
"pin": false,
|
||||
|
@ -843,7 +843,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "8e8209b40a2a7b4d32b201c8f3bc54e4ef4ced52"
|
||||
"revision": "ef48afdf51d04567f5ca2d5bd425143dc5f58ac7"
|
||||
},
|
||||
"hu": {
|
||||
"pin": false,
|
||||
|
@ -861,7 +861,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "6807f209dc6ddf98bf20eed314a430a805e04886"
|
||||
"revision": "f966b6fe28a375c18271d6f7ab02155c598c586a"
|
||||
},
|
||||
"hy-AM": {
|
||||
"pin": false,
|
||||
|
@ -879,7 +879,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "5fb1e76e2f18324c9fe07bfaa87326f6d22ec5a7"
|
||||
"revision": "de74a3f696f39d129aea291e362804438786e573"
|
||||
},
|
||||
"hye": {
|
||||
"pin": false,
|
||||
|
@ -897,7 +897,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "125a8b56b1d73f694dc3502b0c7e0508a19c9361"
|
||||
"revision": "8b790bffcec2bda84e06a5945d4e6156d6a352f2"
|
||||
},
|
||||
"ia": {
|
||||
"pin": false,
|
||||
|
@ -915,7 +915,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "9802203c9d4d3d821eeda6cd1c2851a4105dba8b"
|
||||
"revision": "437486e0c3447ee576aa29e29abb0b3c45942dac"
|
||||
},
|
||||
"id": {
|
||||
"pin": false,
|
||||
|
@ -933,7 +933,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1c8ff54eee1987bef496f0e9ee693fa6ca708d04"
|
||||
"revision": "cb37cc0c816564aaf116572e98fc615ef6b33998"
|
||||
},
|
||||
"is": {
|
||||
"pin": false,
|
||||
|
@ -951,7 +951,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "cc12873f223c53f647966458f2acd15e96bc43e9"
|
||||
"revision": "bb472da05e0ea8663910fc3c9f8f5e3a0355b7a0"
|
||||
},
|
||||
"it": {
|
||||
"pin": false,
|
||||
|
@ -969,7 +969,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "22d6340a1e6ef8ddf6a15d8bf271f9e654db7a57"
|
||||
"revision": "8a70f4de6dc0a552e720cabf5c372af19480d6d1"
|
||||
},
|
||||
"ja": {
|
||||
"pin": false,
|
||||
|
@ -985,7 +985,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "ab887affb5fd22dbebca8dd71780282d7ed4e827"
|
||||
"revision": "8d312267a06cbc283815d5d6bf6562092d464fb3"
|
||||
},
|
||||
"ja-JP-mac": {
|
||||
"pin": false,
|
||||
|
@ -993,7 +993,7 @@
|
|||
"macosx64",
|
||||
"macosx64-devedition"
|
||||
],
|
||||
"revision": "3f0b15eb476f09a539e3c44a638e724827835888"
|
||||
"revision": "a5be9d6cc42ed14cd9bf679b6d3d77cb85b63411"
|
||||
},
|
||||
"ka": {
|
||||
"pin": false,
|
||||
|
@ -1011,7 +1011,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "cc9cc538d0972d9f95b2985e928669aa7c03c58e"
|
||||
"revision": "d0b3400a739a0d52034367651f6d82ab539b9ef4"
|
||||
},
|
||||
"kab": {
|
||||
"pin": false,
|
||||
|
@ -1029,7 +1029,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "0c231f9473f339f1867504b01e012f836413dd98"
|
||||
"revision": "c2dbf3c9e1b0131fc7afa100fbfa0052e9067759"
|
||||
},
|
||||
"kk": {
|
||||
"pin": false,
|
||||
|
@ -1047,7 +1047,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1808cf73c2e3dbe6864aae4fe9a8c7540cdf0fa1"
|
||||
"revision": "1c841e81774ea705ce2db80d29f0702c65a9e6ef"
|
||||
},
|
||||
"km": {
|
||||
"pin": false,
|
||||
|
@ -1065,7 +1065,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "22787a33f53b1d03e7663324d35ba06410e0e7bb"
|
||||
"revision": "0d677e730119473f65a23f8b851daa47e1b53178"
|
||||
},
|
||||
"kn": {
|
||||
"pin": false,
|
||||
|
@ -1083,7 +1083,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "5785690d0f72850bcd973d7302217eddcaf9716e"
|
||||
"revision": "9b645a4e14c8109fd275dcdccedfa0005e02e5fc"
|
||||
},
|
||||
"ko": {
|
||||
"pin": false,
|
||||
|
@ -1101,7 +1101,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "56c06c390de4511971170922d69ddfdf96a5464e"
|
||||
"revision": "848ade3d003547c985e1948eafb1abeb3dd9ddc1"
|
||||
},
|
||||
"lij": {
|
||||
"pin": false,
|
||||
|
@ -1119,7 +1119,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "736163f6150eeb45377acf3946a664773c36fd12"
|
||||
"revision": "5da0a9ade26a1bddc167777136b7910a3175fa51"
|
||||
},
|
||||
"lo": {
|
||||
"pin": false,
|
||||
|
@ -1137,7 +1137,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "0a1d61db2bac08460213e806180868f8c52ff5e7"
|
||||
"revision": "4bc60eca7e5023dd6169930531a92ede82492354"
|
||||
},
|
||||
"lt": {
|
||||
"pin": false,
|
||||
|
@ -1155,7 +1155,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "5be3de1f80c9924231917c7b05bdca2b86bf4701"
|
||||
"revision": "79f8f5e47ca4737e44ad5b26df7dba35fb6a1053"
|
||||
},
|
||||
"ltg": {
|
||||
"pin": false,
|
||||
|
@ -1173,7 +1173,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "fa99c6b5ee5333a153b7d1d80188505ea48e6d9a"
|
||||
"revision": "cd143cc1e4e8eb7eb6a74ca3086f242f1b447b22"
|
||||
},
|
||||
"lv": {
|
||||
"pin": false,
|
||||
|
@ -1191,7 +1191,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "be97fdfa4a9094951259960bfa372442edb46899"
|
||||
"revision": "8bad605d4ccb2c13bbb476675e840184d1370d8e"
|
||||
},
|
||||
"meh": {
|
||||
"pin": false,
|
||||
|
@ -1209,7 +1209,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "a9e2ec814aebfa28369fd28a49daf6f9fdefb6ab"
|
||||
"revision": "f13ae6755879913366890c7b56b26360c6b863f0"
|
||||
},
|
||||
"mk": {
|
||||
"pin": false,
|
||||
|
@ -1227,7 +1227,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "c4ea25970ce282978720ea99d69cf86dc4136c27"
|
||||
"revision": "d40df8835053433797419677c9ea2addf37f9a26"
|
||||
},
|
||||
"mr": {
|
||||
"pin": false,
|
||||
|
@ -1245,7 +1245,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "5da11fdd463a66d93470d1dc5ec09938816a9591"
|
||||
"revision": "f7bf55487c6be112a91a49d4d829d6cc5802f357"
|
||||
},
|
||||
"ms": {
|
||||
"pin": false,
|
||||
|
@ -1263,7 +1263,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "0ba09b128c673309b192728b1ac1c297b7de1c13"
|
||||
"revision": "cf74d3b0e9f42d7d7200fee8f0fad0801d24a45e"
|
||||
},
|
||||
"my": {
|
||||
"pin": false,
|
||||
|
@ -1281,7 +1281,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "bedc003a34cf6fb91496fe147d7fab8ec022819c"
|
||||
"revision": "96363259ff7ac288edc6a21196d461a8a87bb8fc"
|
||||
},
|
||||
"nb-NO": {
|
||||
"pin": false,
|
||||
|
@ -1299,7 +1299,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "0c29eae42bd6506d5cd59e8e507036a9ed979a14"
|
||||
"revision": "86ace5c13462e688e496cc8f4d9f1564d46fe18d"
|
||||
},
|
||||
"ne-NP": {
|
||||
"pin": false,
|
||||
|
@ -1317,7 +1317,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "03e331ce58950ef9bbea1900f18e63dccd80abe7"
|
||||
"revision": "e423253cbb5e75727f5c76d270c8cdf9361fefe1"
|
||||
},
|
||||
"nl": {
|
||||
"pin": false,
|
||||
|
@ -1335,7 +1335,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "5739fce098c1c3e2e65f7971f64a4ea984b8fc93"
|
||||
"revision": "13f45bab2f6a159892a3bb63376e5ed3cd7ba9cf"
|
||||
},
|
||||
"nn-NO": {
|
||||
"pin": false,
|
||||
|
@ -1353,7 +1353,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "fb6bb5d151dbca355a79a2f93441d648d28ae549"
|
||||
"revision": "f4fedd34e70bbdaad5dde14acc23f6805cf8fcec"
|
||||
},
|
||||
"oc": {
|
||||
"pin": false,
|
||||
|
@ -1371,7 +1371,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "32b8d1bc29d4b1c34069e9874c2c94ccb9de0583"
|
||||
"revision": "daa43052266c7add6d70e268c136afe05112e1d3"
|
||||
},
|
||||
"pa-IN": {
|
||||
"pin": false,
|
||||
|
@ -1389,7 +1389,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "8a6fa63392586520dc594fbf75ca19e9a6d69a20"
|
||||
"revision": "ff84f0e9f365f2f27cb56becc44a9b607d1b2895"
|
||||
},
|
||||
"pl": {
|
||||
"pin": false,
|
||||
|
@ -1407,7 +1407,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "fe03bc5a66b396447adf9f940a32708386fc6798"
|
||||
"revision": "d4801837b060a975c67a8e6de9a31bd12d398b8f"
|
||||
},
|
||||
"pt-BR": {
|
||||
"pin": false,
|
||||
|
@ -1425,7 +1425,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "956953dcb4a7061e1361c0990dd5042636c16d5b"
|
||||
"revision": "156cf6348b1d2b2684a1ea84c63fc448f925bdae"
|
||||
},
|
||||
"pt-PT": {
|
||||
"pin": false,
|
||||
|
@ -1443,7 +1443,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "e7e1e3c4c97f2e7631c2e2a27fcb67e8dd68812c"
|
||||
"revision": "e78508e5ee6666e999d3633d3c2c638890f4d6e5"
|
||||
},
|
||||
"rm": {
|
||||
"pin": false,
|
||||
|
@ -1461,7 +1461,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "b9303b481cfb17a31101e7b0207aea758442f8e4"
|
||||
"revision": "af6fddba6b4a81fd823cd885ab94480ed69db9b7"
|
||||
},
|
||||
"ro": {
|
||||
"pin": false,
|
||||
|
@ -1479,7 +1479,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "005365f54f7ee7b83a508e51f5bf56d7f9a4d5b8"
|
||||
"revision": "1d2e393872b6b02fbfb6fb062fd0be6e53a00bd4"
|
||||
},
|
||||
"ru": {
|
||||
"pin": false,
|
||||
|
@ -1497,7 +1497,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1ef03b00b57d89fc34468a48321b971a73e78bca"
|
||||
"revision": "005c8a487481fd72066679edc07b40d0e90a89d5"
|
||||
},
|
||||
"sat": {
|
||||
"pin": false,
|
||||
|
@ -1515,7 +1515,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "6395f4e362204dcd4e79cf887b4e2be52a1a2e31"
|
||||
"revision": "3aa9beba6f55f17e5118e4a013b2fa4130d9ffdd"
|
||||
},
|
||||
"sc": {
|
||||
"pin": false,
|
||||
|
@ -1533,7 +1533,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "b299417011ab6fa3e383fe7def7258487f3378a7"
|
||||
"revision": "9126444366a5e416c80371bb1e41889863587867"
|
||||
},
|
||||
"scn": {
|
||||
"pin": false,
|
||||
|
@ -1551,7 +1551,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "1b0014105d935315076f3ba10ead040ea04ad6ff"
|
||||
"revision": "49fa22f3a3dc777753472a5b18c6725844028260"
|
||||
},
|
||||
"sco": {
|
||||
"pin": false,
|
||||
|
@ -1569,7 +1569,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "ce9681c3d1a8e60741489837eba9c30080a43476"
|
||||
"revision": "b7b517e3410dbefa49f80b6d325dc21f117a2414"
|
||||
},
|
||||
"si": {
|
||||
"pin": false,
|
||||
|
@ -1587,7 +1587,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "34a71d2517ba64995f3a840a0df98aa107244547"
|
||||
"revision": "b4605be1372d79627afba15bc91f8e0befe1a5c6"
|
||||
},
|
||||
"sk": {
|
||||
"pin": false,
|
||||
|
@ -1605,7 +1605,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "89bf2c43a45233ee4989f79e529bde2cc877f0c8"
|
||||
"revision": "b84ee5b52165e99b14977094c10ed355162eb236"
|
||||
},
|
||||
"skr": {
|
||||
"pin": false,
|
||||
|
@ -1623,7 +1623,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "cc61108cee5c42594dbd144a796e02dfe13b872d"
|
||||
"revision": "68139ecf60932b951dbd5ca572ad4968df8575a7"
|
||||
},
|
||||
"sl": {
|
||||
"pin": false,
|
||||
|
@ -1641,7 +1641,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "706316c29272428a369a138a833995c1cb6b2cff"
|
||||
"revision": "ef07d5d8155f1674e1b2be2b658046ce5f83afe9"
|
||||
},
|
||||
"son": {
|
||||
"pin": false,
|
||||
|
@ -1659,7 +1659,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "d459430680f0900a94956a10be1f9484eb37762f"
|
||||
"revision": "44c89214a3d628d44d23c38428e97a560c4f2be2"
|
||||
},
|
||||
"sq": {
|
||||
"pin": false,
|
||||
|
@ -1695,7 +1695,7 @@
|
|||
"win64-aarch64-devedition",
|
||||
"win64-devedition"
|
||||
],
|
||||
"revision": "f86872757959a4686b73a22e26879f2cae546ce8"
|
||||
"revision": "32c249fae84b7a6d374470e42665d3c181ecd008"
|
||||
},
|
||||
"sv-SE": {
|
||||
"pin": false,
|
||||
|
|
|
@ -16,6 +16,7 @@ const { AppConstants } = ChromeUtils.importESModule(
|
|||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
CrashSubmit: "resource://gre/modules/CrashSubmit.sys.mjs",
|
||||
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
|
||||
clearTimeout: "resource://gre/modules/Timer.sys.mjs",
|
||||
|
@ -24,7 +25,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
CrashSubmit: "resource://gre/modules/CrashSubmit.jsm",
|
||||
});
|
||||
|
||||
// We don't process crash reports older than 28 days, so don't bother
|
||||
|
|
|
@ -396,6 +396,7 @@
|
|||
|
||||
.urlbarView-row[type=tip] {
|
||||
padding-block: 18px;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.urlbarView-row[type=tip]:not(:last-child) {
|
||||
|
|
|
@ -6259,77 +6259,7 @@ var acorn = __webpack_require__(1103);
|
|||
|
||||
var sourceMap = __webpack_require__(632);
|
||||
|
||||
var SourceNode = sourceMap.SourceNode;
|
||||
/**
|
||||
* prettyFast is using SourceNode so we can generate a source map.
|
||||
* A SourceNode instance can have multiple children, which may be other SourceNodes or strings.
|
||||
* This means that to generate the source map, we need to traverse all the nodes recursively.
|
||||
* Furthermore, even adding a child SourceNode to a parent can be slower as some checks are
|
||||
* done on the argument (which can be a string, an array or a SourceNode)
|
||||
* These can be slow when we have a lot of mappings to handle (e.g. for big files).
|
||||
*
|
||||
* We are using SourceNode in a much more constrained way:
|
||||
* - we only have a root node
|
||||
* - which only has SourceNode children
|
||||
* - and those children SourceNode only have 1 string child
|
||||
*
|
||||
* So here we can build custom classes based on SourceNode, overriding expensive methods
|
||||
* which are much more straightforward ones given our constraints.
|
||||
*/
|
||||
|
||||
class RootSourceNode extends SourceNode {
|
||||
/**
|
||||
* Add a LeafSourceNode to the children list
|
||||
*
|
||||
* @override
|
||||
* @param {LeafSourceNode} leafSourceNode
|
||||
*/
|
||||
add(leafSourceNode) {
|
||||
this.children.push(leafSourceNode);
|
||||
}
|
||||
/**
|
||||
* Iterate through the node children
|
||||
*
|
||||
* @override
|
||||
* @param {Function} func
|
||||
*/
|
||||
|
||||
|
||||
walk(func) {
|
||||
for (let i = 0, len = this.children.length; i < len; i++) {
|
||||
const child = this.children[i];
|
||||
func(child.str, child);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
|
||||
walkSourceContents() {// this.sourceContents is never set, so don't do anything (the original method does
|
||||
// iterate over children and sourcesContents, which is wasteful in our case).
|
||||
}
|
||||
|
||||
} // We don't extend SourceNode as the constructor initializes an array and calls `add`,
|
||||
// which we don't need in our case.
|
||||
|
||||
|
||||
class LeafSourceNode {
|
||||
/**
|
||||
* @param {Integer} line
|
||||
* @param {Integer} column
|
||||
* @param {String} source
|
||||
* @param {String} str
|
||||
*/
|
||||
constructor(line, column, source, str) {
|
||||
this.str = str;
|
||||
this.line = line;
|
||||
this.column = column;
|
||||
this.source = source;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
} // If any of these tokens are seen before a "[" token, we know that "[" token
|
||||
const NEWLINE_CODE = 10; // If any of these tokens are seen before a "[" token, we know that "[" token
|
||||
// is the start of an array literal, rather than a property access.
|
||||
//
|
||||
// The only exception is "}", which would need to be disambiguated by
|
||||
|
@ -6338,7 +6268,6 @@ class LeafSourceNode {
|
|||
// the rug, and handle the ambiguity by always assuming that it will be an
|
||||
// array literal.
|
||||
|
||||
|
||||
const PRE_ARRAY_LITERAL_TOKENS = new Set(["typeof", "void", "delete", "case", "do", "=", "in", "{", "*", "/", "%", "else", ";", "++", "--", "+", "-", "~", "!", ":", "?", ">>", ">>>", "<<", "||", "&&", "<", ">", "<=", ">=", "instanceof", "&", "^", "|", "==", "!=", "===", "!==", ",", "}"]);
|
||||
/**
|
||||
* Determines if we think that the given token starts an array literal.
|
||||
|
@ -6473,7 +6402,7 @@ function isLineDelimiter(token, stack) {
|
|||
|
||||
function appendNewline(token, write, stack) {
|
||||
if (isLineDelimiter(token, stack)) {
|
||||
write("\n", token.loc.start.line, token.loc.start.column);
|
||||
write("\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6632,7 +6561,7 @@ function needsLineBreakBeforeClosingCurlyBracket(tokenTypeLabel) {
|
|||
* printed code. This only happens if an inline comment was printed
|
||||
* since the last token.
|
||||
* @param Function write
|
||||
* The function to write pretty printed code to the result SourceNode.
|
||||
* The function to write pretty printed code.
|
||||
* @param Object options
|
||||
* The options object.
|
||||
* @param Number indentLevel
|
||||
|
@ -6656,27 +6585,27 @@ function prependWhiteSpace(token, lastToken, addedNewline, addedSpace, write, op
|
|||
|
||||
if (lastToken && ltt == "}") {
|
||||
if (ttk == "while" && stack.at(-1) == "do" || needsSpaceBeforeClosingCurlyBracket(ttk)) {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
} else if (needsLineBreakBeforeClosingCurlyBracket(ttl)) {
|
||||
write("\n", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write("\n");
|
||||
newlineAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ttl == ":" && stack.at(-1) == "?" || ttl == "}" && stack.at(-1) == "${") {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
}
|
||||
|
||||
if (lastToken && ltt != "}" && ltt != "." && ttk == "else") {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
}
|
||||
|
||||
function ensureNewline() {
|
||||
if (!newlineAdded) {
|
||||
write("\n", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write("\n");
|
||||
newlineAdded = true;
|
||||
}
|
||||
}
|
||||
|
@ -6691,12 +6620,12 @@ function prependWhiteSpace(token, lastToken, addedNewline, addedSpace, write, op
|
|||
|
||||
if (newlineAdded) {
|
||||
if (ttk == "case" || ttk == "default") {
|
||||
write(options.indent.repeat(indentLevel - 1), token.loc.start.line, token.loc.start.column);
|
||||
write(options.indent.repeat(indentLevel - 1));
|
||||
} else {
|
||||
write(options.indent.repeat(indentLevel), token.loc.start.line, token.loc.start.column);
|
||||
write(options.indent.repeat(indentLevel));
|
||||
}
|
||||
} else if (!spaceAdded && needsSpaceAfter(token, lastToken)) {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
}
|
||||
}
|
||||
|
@ -6745,15 +6674,15 @@ function sanitize(str) {
|
|||
* @param Object token
|
||||
* The token to add.
|
||||
* @param Function write
|
||||
* The function to write pretty printed code to the result SourceNode.
|
||||
* The function to write pretty printed code.
|
||||
*/
|
||||
|
||||
|
||||
function addToken(token, write) {
|
||||
if (token.type.label == "string") {
|
||||
write(`'${sanitize(token.value)}'`, token.loc.start.line, token.loc.start.column);
|
||||
write(`'${sanitize(token.value)}'`, token.loc.start.line, token.loc.start.column, true);
|
||||
} else if (token.type.label == "regexp") {
|
||||
write(String(token.value.value), token.loc.start.line, token.loc.start.column);
|
||||
write(String(token.value.value), token.loc.start.line, token.loc.start.column, true);
|
||||
} else {
|
||||
let value;
|
||||
|
||||
|
@ -6767,7 +6696,7 @@ function addToken(token, write) {
|
|||
value = token.type.label;
|
||||
}
|
||||
|
||||
write(String(value), token.loc.start.line, token.loc.start.column);
|
||||
write(String(value), token.loc.start.line, token.loc.start.column, true);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -6814,7 +6743,7 @@ function incrementsIndent(token) {
|
|||
* Add a comment to the pretty printed code.
|
||||
*
|
||||
* @param Function write
|
||||
* The function to write pretty printed code to the result SourceNode.
|
||||
* The function to write pretty printed code.
|
||||
* @param Number indentLevel
|
||||
* The number of indents deep we are.
|
||||
* @param Object options
|
||||
|
@ -6837,27 +6766,16 @@ function incrementsIndent(token) {
|
|||
|
||||
function addComment(write, indentLevel, options, block, text, line, column, nextToken) {
|
||||
const indentString = options.indent.repeat(indentLevel);
|
||||
let needNewline = true;
|
||||
write(indentString, line, column);
|
||||
const needNewLineAfter = !block || !(nextToken && nextToken.loc.start.line == line);
|
||||
|
||||
if (block) {
|
||||
write("/*"); // We must pass ignoreNewline in case the comment happens to be "\n".
|
||||
|
||||
write(text.split(new RegExp(`/\n${indentString}/`, "g")).join(`\n${indentString}`), null, null, true);
|
||||
write("*/");
|
||||
needNewline = !(nextToken && nextToken.loc.start.line == line);
|
||||
const commentLinesText = text.split(new RegExp(`/\n${indentString}/`, "g")).join(`\n${indentString}`);
|
||||
write(`${indentString}/*${commentLinesText}*/${needNewLineAfter ? "\n" : " "}`);
|
||||
} else {
|
||||
write("//");
|
||||
write(text);
|
||||
write(`${indentString}//${text}\n`);
|
||||
}
|
||||
|
||||
if (needNewline) {
|
||||
write("\n");
|
||||
} else {
|
||||
write(" ");
|
||||
}
|
||||
|
||||
return needNewline;
|
||||
return needNewLineAfter;
|
||||
}
|
||||
/**
|
||||
* The main function.
|
||||
|
@ -6877,20 +6795,22 @@ function addComment(write, indentLevel, options, block, text, line, column, next
|
|||
*/
|
||||
|
||||
|
||||
function prettyFast(input, options) {
|
||||
function prettyFast(input, options = {}) {
|
||||
// The level of indents deep we are.
|
||||
let indentLevel = 0; // We will accumulate the pretty printed code in this RootSourceNode.
|
||||
let indentLevel = 0; // We will handle mappings between ugly and pretty printed code in this SourceMapGenerator.
|
||||
|
||||
const rootNode = new RootSourceNode();
|
||||
const {
|
||||
url: file
|
||||
} = options;
|
||||
const sourceMapGenerator = new sourceMap.SourceMapGenerator({
|
||||
file
|
||||
});
|
||||
let currentCode = "";
|
||||
let currentLine = 1;
|
||||
let currentColumn = 0;
|
||||
/**
|
||||
* Write a pretty printed string to the result SourceNode.
|
||||
*
|
||||
* We buffer our writes so that we only create one mapping for each line in
|
||||
* the source map. This enhances performance by avoiding extraneous mapping
|
||||
* serialization, and flattening the tree that
|
||||
* `SourceNode#toStringWithSourceMap` will have to recursively walk. When
|
||||
* timing how long it takes to pretty print jQuery, this optimization
|
||||
* brought the time down from ~390 ms to ~190ms!
|
||||
* Write a pretty printed string to the prettified string and for tokens, add their
|
||||
* mapping to the SourceMapGenerator.
|
||||
*
|
||||
* @param String str
|
||||
* The string to be added to the result.
|
||||
|
@ -6898,39 +6818,40 @@ function prettyFast(input, options) {
|
|||
* The line number the string came from in the ugly source.
|
||||
* @param Number column
|
||||
* The column number the string came from in the ugly source.
|
||||
* @param Boolean ignoreNewline
|
||||
* If true, a single "\n" won't result in an additional mapping.
|
||||
* @param Boolean isToken
|
||||
* Set to true when writing tokens, so we can differentiate them from the
|
||||
* whitespace we add.
|
||||
*/
|
||||
|
||||
const write = function () {
|
||||
const buffer = [];
|
||||
let bufferLine = -1;
|
||||
let bufferColumn = -1;
|
||||
return function innerWrite(str, line, column, ignoreNewline) {
|
||||
if (line != null && bufferLine === -1) {
|
||||
bufferLine = line;
|
||||
const write = (str, line, column, isToken) => {
|
||||
currentCode += str;
|
||||
|
||||
if (isToken) {
|
||||
sourceMapGenerator.addMapping({
|
||||
source: file,
|
||||
// We need to swap original and generated locations, as the prettified text should
|
||||
// be seen by the sourcemap service as the "original" one.
|
||||
generated: {
|
||||
line,
|
||||
column
|
||||
},
|
||||
original: {
|
||||
line: currentLine,
|
||||
column: currentColumn
|
||||
},
|
||||
name: null
|
||||
});
|
||||
}
|
||||
|
||||
for (let idx = 0, length = str.length; idx < length; idx++) {
|
||||
if (str.charCodeAt(idx) === NEWLINE_CODE) {
|
||||
currentLine++;
|
||||
currentColumn = 0;
|
||||
} else {
|
||||
currentColumn++;
|
||||
}
|
||||
|
||||
if (column != null && bufferColumn === -1) {
|
||||
bufferColumn = column;
|
||||
}
|
||||
|
||||
buffer.push(str);
|
||||
|
||||
if (str == "\n" && !ignoreNewline) {
|
||||
let lineStr = "";
|
||||
|
||||
for (let i = 0, len = buffer.length; i < len; i++) {
|
||||
lineStr += buffer[i];
|
||||
}
|
||||
|
||||
rootNode.add(new LeafSourceNode(bufferLine, bufferColumn, options.url, lineStr));
|
||||
buffer.splice(0, buffer.length);
|
||||
bufferLine = -1;
|
||||
bufferColumn = -1;
|
||||
}
|
||||
};
|
||||
}(); // Whether or not we added a newline on after we added the last token.
|
||||
}
|
||||
}; // Whether or not we added a newline on after we added the last token.
|
||||
|
||||
|
||||
let addedNewline = false; // Whether or not we added a space after we added the last token.
|
||||
|
@ -6979,7 +6900,7 @@ function prettyFast(input, options) {
|
|||
|
||||
const tokenQueue = getTokens(input, options);
|
||||
|
||||
for (let i = 0; i < tokenQueue.length; i++) {
|
||||
for (let i = 0, len = tokenQueue.length; i < len; i++) {
|
||||
var _lastToken2, _lastToken2$type;
|
||||
|
||||
const token = tokenQueue[i];
|
||||
|
@ -7079,9 +7000,10 @@ function prettyFast(input, options) {
|
|||
lastToken.isArrayLiteral = token.isArrayLiteral;
|
||||
}
|
||||
|
||||
return rootNode.toStringWithSourceMap({
|
||||
file: options.url
|
||||
});
|
||||
return {
|
||||
code: currentCode,
|
||||
map: sourceMapGenerator
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns the tokens computed with acorn.
|
||||
|
@ -10619,29 +10541,7 @@ function prettyPrint({
|
|||
} = (0, _prettyFast.prettyFast)(sourceText, {
|
||||
url,
|
||||
indent: " ".repeat(indent)
|
||||
}); // We need to swap original and generated locations, as the prettified text should
|
||||
// be seen by the sourcemap service as the "original" one.
|
||||
|
||||
const mappingLength = sourceMapGenerator._mappings._array.length;
|
||||
|
||||
for (let i = 0; i < mappingLength; i++) {
|
||||
const mapping = sourceMapGenerator._mappings._array[i];
|
||||
const {
|
||||
originalLine,
|
||||
originalColumn,
|
||||
generatedLine,
|
||||
generatedColumn
|
||||
} = mapping;
|
||||
mapping.originalLine = generatedLine;
|
||||
mapping.originalColumn = generatedColumn;
|
||||
mapping.generatedLine = originalLine;
|
||||
mapping.generatedColumn = originalColumn;
|
||||
} // Since we modified the location, the mappings might not be in the expected order,
|
||||
// which may cause issues when generating the sourceMap.
|
||||
// Flip the `_sorted` flag so the mappings will be sorted when the sourceMap is built.
|
||||
|
||||
|
||||
sourceMapGenerator._mappings._sorted = false;
|
||||
});
|
||||
return {
|
||||
code,
|
||||
sourceMap: sourceMapGenerator.toJSON()
|
||||
|
|
|
@ -4,74 +4,7 @@
|
|||
|
||||
var acorn = require("acorn");
|
||||
var sourceMap = require("source-map");
|
||||
var SourceNode = sourceMap.SourceNode;
|
||||
|
||||
/**
|
||||
* prettyFast is using SourceNode so we can generate a source map.
|
||||
* A SourceNode instance can have multiple children, which may be other SourceNodes or strings.
|
||||
* This means that to generate the source map, we need to traverse all the nodes recursively.
|
||||
* Furthermore, even adding a child SourceNode to a parent can be slower as some checks are
|
||||
* done on the argument (which can be a string, an array or a SourceNode)
|
||||
* These can be slow when we have a lot of mappings to handle (e.g. for big files).
|
||||
*
|
||||
* We are using SourceNode in a much more constrained way:
|
||||
* - we only have a root node
|
||||
* - which only has SourceNode children
|
||||
* - and those children SourceNode only have 1 string child
|
||||
*
|
||||
* So here we can build custom classes based on SourceNode, overriding expensive methods
|
||||
* which are much more straightforward ones given our constraints.
|
||||
*/
|
||||
class RootSourceNode extends SourceNode {
|
||||
/**
|
||||
* Add a LeafSourceNode to the children list
|
||||
*
|
||||
* @override
|
||||
* @param {LeafSourceNode} leafSourceNode
|
||||
*/
|
||||
add(leafSourceNode) {
|
||||
this.children.push(leafSourceNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through the node children
|
||||
*
|
||||
* @override
|
||||
* @param {Function} func
|
||||
*/
|
||||
walk(func) {
|
||||
for (let i = 0, len = this.children.length; i < len; i++) {
|
||||
const child = this.children[i];
|
||||
func(child.str, child);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
walkSourceContents() {
|
||||
// this.sourceContents is never set, so don't do anything (the original method does
|
||||
// iterate over children and sourcesContents, which is wasteful in our case).
|
||||
}
|
||||
}
|
||||
|
||||
// We don't extend SourceNode as the constructor initializes an array and calls `add`,
|
||||
// which we don't need in our case.
|
||||
class LeafSourceNode {
|
||||
/**
|
||||
* @param {Integer} line
|
||||
* @param {Integer} column
|
||||
* @param {String} source
|
||||
* @param {String} str
|
||||
*/
|
||||
constructor(line, column, source, str) {
|
||||
this.str = str;
|
||||
this.line = line;
|
||||
this.column = column;
|
||||
this.source = source;
|
||||
this.name = null;
|
||||
}
|
||||
}
|
||||
const NEWLINE_CODE = 10;
|
||||
|
||||
// If any of these tokens are seen before a "[" token, we know that "[" token
|
||||
// is the start of an array literal, rather than a property access.
|
||||
|
@ -342,7 +275,7 @@ function isLineDelimiter(token, stack) {
|
|||
*/
|
||||
function appendNewline(token, write, stack) {
|
||||
if (isLineDelimiter(token, stack)) {
|
||||
write("\n", token.loc.start.line, token.loc.start.column);
|
||||
write("\n");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -515,7 +448,7 @@ function needsLineBreakBeforeClosingCurlyBracket(tokenTypeLabel) {
|
|||
* printed code. This only happens if an inline comment was printed
|
||||
* since the last token.
|
||||
* @param Function write
|
||||
* The function to write pretty printed code to the result SourceNode.
|
||||
* The function to write pretty printed code.
|
||||
* @param Object options
|
||||
* The options object.
|
||||
* @param Number indentLevel
|
||||
|
@ -548,10 +481,10 @@ function prependWhiteSpace(
|
|||
(ttk == "while" && stack.at(-1) == "do") ||
|
||||
needsSpaceBeforeClosingCurlyBracket(ttk)
|
||||
) {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
} else if (needsLineBreakBeforeClosingCurlyBracket(ttl)) {
|
||||
write("\n", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write("\n");
|
||||
newlineAdded = true;
|
||||
}
|
||||
}
|
||||
|
@ -560,18 +493,18 @@ function prependWhiteSpace(
|
|||
(ttl == ":" && stack.at(-1) == "?") ||
|
||||
(ttl == "}" && stack.at(-1) == "${")
|
||||
) {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
}
|
||||
|
||||
if (lastToken && ltt != "}" && ltt != "." && ttk == "else") {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
}
|
||||
|
||||
function ensureNewline() {
|
||||
if (!newlineAdded) {
|
||||
write("\n", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write("\n");
|
||||
newlineAdded = true;
|
||||
}
|
||||
}
|
||||
|
@ -586,20 +519,12 @@ function prependWhiteSpace(
|
|||
|
||||
if (newlineAdded) {
|
||||
if (ttk == "case" || ttk == "default") {
|
||||
write(
|
||||
options.indent.repeat(indentLevel - 1),
|
||||
token.loc.start.line,
|
||||
token.loc.start.column
|
||||
);
|
||||
write(options.indent.repeat(indentLevel - 1));
|
||||
} else {
|
||||
write(
|
||||
options.indent.repeat(indentLevel),
|
||||
token.loc.start.line,
|
||||
token.loc.start.column
|
||||
);
|
||||
write(options.indent.repeat(indentLevel));
|
||||
}
|
||||
} else if (!spaceAdded && needsSpaceAfter(token, lastToken)) {
|
||||
write(" ", lastToken.loc.start.line, lastToken.loc.start.column);
|
||||
write(" ");
|
||||
spaceAdded = true;
|
||||
}
|
||||
}
|
||||
|
@ -649,20 +574,22 @@ function sanitize(str) {
|
|||
* @param Object token
|
||||
* The token to add.
|
||||
* @param Function write
|
||||
* The function to write pretty printed code to the result SourceNode.
|
||||
* The function to write pretty printed code.
|
||||
*/
|
||||
function addToken(token, write) {
|
||||
if (token.type.label == "string") {
|
||||
write(
|
||||
`'${sanitize(token.value)}'`,
|
||||
token.loc.start.line,
|
||||
token.loc.start.column
|
||||
token.loc.start.column,
|
||||
true
|
||||
);
|
||||
} else if (token.type.label == "regexp") {
|
||||
write(
|
||||
String(token.value.value),
|
||||
token.loc.start.line,
|
||||
token.loc.start.column
|
||||
token.loc.start.column,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
let value;
|
||||
|
@ -674,7 +601,7 @@ function addToken(token, write) {
|
|||
} else {
|
||||
value = token.type.label;
|
||||
}
|
||||
write(String(value), token.loc.start.line, token.loc.start.column);
|
||||
write(String(value), token.loc.start.line, token.loc.start.column, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -740,7 +667,7 @@ function incrementsIndent(token) {
|
|||
* Add a comment to the pretty printed code.
|
||||
*
|
||||
* @param Function write
|
||||
* The function to write pretty printed code to the result SourceNode.
|
||||
* The function to write pretty printed code.
|
||||
* @param Number indentLevel
|
||||
* The number of indents deep we are.
|
||||
* @param Object options
|
||||
|
@ -770,32 +697,22 @@ function addComment(
|
|||
nextToken
|
||||
) {
|
||||
const indentString = options.indent.repeat(indentLevel);
|
||||
let needNewline = true;
|
||||
const needNewLineAfter =
|
||||
!block || !(nextToken && nextToken.loc.start.line == line);
|
||||
|
||||
write(indentString, line, column);
|
||||
if (block) {
|
||||
write("/*");
|
||||
// We must pass ignoreNewline in case the comment happens to be "\n".
|
||||
const commentLinesText = text
|
||||
.split(new RegExp(`/\n${indentString}/`, "g"))
|
||||
.join(`\n${indentString}`);
|
||||
|
||||
write(
|
||||
text
|
||||
.split(new RegExp(`/\n${indentString}/`, "g"))
|
||||
.join(`\n${indentString}`),
|
||||
null,
|
||||
null,
|
||||
true
|
||||
`${indentString}/*${commentLinesText}*/${needNewLineAfter ? "\n" : " "}`
|
||||
);
|
||||
write("*/");
|
||||
needNewline = !(nextToken && nextToken.loc.start.line == line);
|
||||
} else {
|
||||
write("//");
|
||||
write(text);
|
||||
write(`${indentString}//${text}\n`);
|
||||
}
|
||||
if (needNewline) {
|
||||
write("\n");
|
||||
} else {
|
||||
write(" ");
|
||||
}
|
||||
return needNewline;
|
||||
|
||||
return needNewLineAfter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -814,22 +731,23 @@ function addComment(
|
|||
* - code: The pretty printed code string.
|
||||
* - map: A SourceMapGenerator instance.
|
||||
*/
|
||||
export function prettyFast(input, options) {
|
||||
export function prettyFast(input, options = {}) {
|
||||
// The level of indents deep we are.
|
||||
let indentLevel = 0;
|
||||
|
||||
// We will accumulate the pretty printed code in this RootSourceNode.
|
||||
const rootNode = new RootSourceNode();
|
||||
// We will handle mappings between ugly and pretty printed code in this SourceMapGenerator.
|
||||
const { url: file } = options;
|
||||
const sourceMapGenerator = new sourceMap.SourceMapGenerator({
|
||||
file,
|
||||
});
|
||||
|
||||
let currentCode = "";
|
||||
let currentLine = 1;
|
||||
let currentColumn = 0;
|
||||
|
||||
/**
|
||||
* Write a pretty printed string to the result SourceNode.
|
||||
*
|
||||
* We buffer our writes so that we only create one mapping for each line in
|
||||
* the source map. This enhances performance by avoiding extraneous mapping
|
||||
* serialization, and flattening the tree that
|
||||
* `SourceNode#toStringWithSourceMap` will have to recursively walk. When
|
||||
* timing how long it takes to pretty print jQuery, this optimization
|
||||
* brought the time down from ~390 ms to ~190ms!
|
||||
* Write a pretty printed string to the prettified string and for tokens, add their
|
||||
* mapping to the SourceMapGenerator.
|
||||
*
|
||||
* @param String str
|
||||
* The string to be added to the result.
|
||||
|
@ -837,36 +755,38 @@ export function prettyFast(input, options) {
|
|||
* The line number the string came from in the ugly source.
|
||||
* @param Number column
|
||||
* The column number the string came from in the ugly source.
|
||||
* @param Boolean ignoreNewline
|
||||
* If true, a single "\n" won't result in an additional mapping.
|
||||
* @param Boolean isToken
|
||||
* Set to true when writing tokens, so we can differentiate them from the
|
||||
* whitespace we add.
|
||||
*/
|
||||
const write = (function() {
|
||||
const buffer = [];
|
||||
let bufferLine = -1;
|
||||
let bufferColumn = -1;
|
||||
return function innerWrite(str, line, column, ignoreNewline) {
|
||||
if (line != null && bufferLine === -1) {
|
||||
bufferLine = line;
|
||||
}
|
||||
if (column != null && bufferColumn === -1) {
|
||||
bufferColumn = column;
|
||||
}
|
||||
buffer.push(str);
|
||||
const write = (str, line, column, isToken) => {
|
||||
currentCode += str;
|
||||
if (isToken) {
|
||||
sourceMapGenerator.addMapping({
|
||||
source: file,
|
||||
// We need to swap original and generated locations, as the prettified text should
|
||||
// be seen by the sourcemap service as the "original" one.
|
||||
generated: {
|
||||
line,
|
||||
column,
|
||||
},
|
||||
original: {
|
||||
line: currentLine,
|
||||
column: currentColumn,
|
||||
},
|
||||
name: null,
|
||||
});
|
||||
}
|
||||
|
||||
if (str == "\n" && !ignoreNewline) {
|
||||
let lineStr = "";
|
||||
for (let i = 0, len = buffer.length; i < len; i++) {
|
||||
lineStr += buffer[i];
|
||||
}
|
||||
rootNode.add(
|
||||
new LeafSourceNode(bufferLine, bufferColumn, options.url, lineStr)
|
||||
);
|
||||
buffer.splice(0, buffer.length);
|
||||
bufferLine = -1;
|
||||
bufferColumn = -1;
|
||||
for (let idx = 0, length = str.length; idx < length; idx++) {
|
||||
if (str.charCodeAt(idx) === NEWLINE_CODE) {
|
||||
currentLine++;
|
||||
currentColumn = 0;
|
||||
} else {
|
||||
currentColumn++;
|
||||
}
|
||||
};
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
// Whether or not we added a newline on after we added the last token.
|
||||
let addedNewline = false;
|
||||
|
@ -921,7 +841,7 @@ export function prettyFast(input, options) {
|
|||
// [ foo, '// a', '// b', bar]
|
||||
const tokenQueue = getTokens(input, options);
|
||||
|
||||
for (let i = 0; i < tokenQueue.length; i++) {
|
||||
for (let i = 0, len = tokenQueue.length; i < len; i++) {
|
||||
const token = tokenQueue[i];
|
||||
const nextToken = tokenQueue[i + 1];
|
||||
|
||||
|
@ -1029,7 +949,7 @@ export function prettyFast(input, options) {
|
|||
lastToken.isArrayLiteral = token.isArrayLiteral;
|
||||
}
|
||||
|
||||
return rootNode.toStringWithSourceMap({ file: options.url });
|
||||
return { code: currentCode, map: sourceMapGenerator };
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -11,27 +11,6 @@ function prettyPrint({ url, indent, sourceText }) {
|
|||
indent: " ".repeat(indent),
|
||||
});
|
||||
|
||||
// We need to swap original and generated locations, as the prettified text should
|
||||
// be seen by the sourcemap service as the "original" one.
|
||||
const mappingLength = sourceMapGenerator._mappings._array.length;
|
||||
for (let i = 0; i < mappingLength; i++) {
|
||||
const mapping = sourceMapGenerator._mappings._array[i];
|
||||
const {
|
||||
originalLine,
|
||||
originalColumn,
|
||||
generatedLine,
|
||||
generatedColumn,
|
||||
} = mapping;
|
||||
mapping.originalLine = generatedLine;
|
||||
mapping.originalColumn = generatedColumn;
|
||||
mapping.generatedLine = originalLine;
|
||||
mapping.generatedColumn = originalColumn;
|
||||
}
|
||||
// Since we modified the location, the mappings might not be in the expected order,
|
||||
// which may cause issues when generating the sourceMap.
|
||||
// Flip the `_sorted` flag so the mappings will be sorted when the sourceMap is built.
|
||||
sourceMapGenerator._mappings._sorted = false;
|
||||
|
||||
return {
|
||||
code,
|
||||
sourceMap: sourceMapGenerator.toJSON(),
|
||||
|
|
|
@ -171,8 +171,9 @@ skip-if = (verify && debug && (os == 'mac')) || (os == 'linux' && debug && bits
|
|||
[browser_dbg-no-duplicate-breakpoints-on-frame-reload.js]
|
||||
[browser_dbg-minified.js]
|
||||
[browser_dbg-pretty-print.js]
|
||||
[browser_dbg-pretty-print-breakpoints.js]
|
||||
[browser_dbg-pretty-print-breakpoints-columns.js]
|
||||
[browser_dbg-pretty-print-breakpoints-delete.js]
|
||||
[browser_dbg-pretty-print-breakpoints.js]
|
||||
[browser_dbg-pretty-print-console.js]
|
||||
[browser_dbg-pretty-print-paused.js]
|
||||
[browser_dbg-pretty-print-sourcemap.js]
|
||||
|
|
|
@ -57,10 +57,17 @@ add_task(async function testBreakableLinesOverReloads() {
|
|||
|
||||
info("Assert breakable lines of the simple first load of script.js");
|
||||
await assertBreakablePositions(dbg, "script.js", 3, [
|
||||
{ line: 1, columns: [] },
|
||||
{ line: 1, columns: [0, 8] },
|
||||
{ line: 3, columns: [] },
|
||||
]);
|
||||
|
||||
info("Pretty print first load of script.js and assert breakable lines");
|
||||
await prettyPrint(dbg);
|
||||
await assertBreakablePositions(dbg, "script.js:formatted", 3, [
|
||||
{ line: 1, columns: [0, 8] },
|
||||
]);
|
||||
await closeTab(dbg, "script.js:formatted");
|
||||
|
||||
info(
|
||||
"Reload the page, wait for sources and assert that breakable lines get updated"
|
||||
);
|
||||
|
@ -69,7 +76,7 @@ add_task(async function testBreakableLinesOverReloads() {
|
|||
|
||||
info("Assert breakable lines of the more complex second load of script.js");
|
||||
await assertBreakablePositions(dbg, "script.js", 23, [
|
||||
{ line: 2, columns: [] },
|
||||
{ line: 2, columns: [0, 8] },
|
||||
{ line: 13, columns: [4, 12] },
|
||||
{ line: 14, columns: [] },
|
||||
{ line: 15, columns: [] },
|
||||
|
@ -83,6 +90,23 @@ add_task(async function testBreakableLinesOverReloads() {
|
|||
{ line: 23, columns: [] },
|
||||
]);
|
||||
|
||||
info("Pretty print first load of script.js and assert breakable lines");
|
||||
await prettyPrint(dbg);
|
||||
await assertBreakablePositions(dbg, "script.js:formatted", 23, [
|
||||
{ line: 2, columns: [0, 8] },
|
||||
{ line: 13, columns: [4, 12] },
|
||||
{ line: 14, columns: [] },
|
||||
{ line: 15, columns: [] },
|
||||
{ line: 16, columns: [] },
|
||||
{ line: 17, columns: [] },
|
||||
{ line: 18, columns: [2, 10] },
|
||||
{ line: 19, columns: [] },
|
||||
{ line: 20, columns: [] },
|
||||
{ line: 21, columns: [] },
|
||||
{ line: 22, columns: [] },
|
||||
]);
|
||||
await closeTab(dbg, "script.js:formatted");
|
||||
|
||||
info("Assert breakable lines of the second html page load");
|
||||
await assertBreakablePositions(dbg, "index.html", 33, [
|
||||
{ line: 25, columns: [6, 14] },
|
||||
|
@ -168,7 +192,9 @@ async function assertBreakablePositions(
|
|||
);
|
||||
ok(
|
||||
columns.includes(selPos.location.column),
|
||||
`Selector breakable column has an expected column (${selPos.location.column} vs ${columns})`
|
||||
`Selector breakable column has an expected column (${
|
||||
selPos.location.column
|
||||
} in ${JSON.stringify(columns)}) for line ${line}`
|
||||
);
|
||||
is(
|
||||
selPos.location.sourceId,
|
||||
|
@ -182,7 +208,8 @@ async function assertBreakablePositions(
|
|||
);
|
||||
}
|
||||
|
||||
const lineElement = await getTokenFromPosition(dbg, { line, ch: -1 });
|
||||
const tokenElement = await getTokenFromPosition(dbg, { line, ch: -1 });
|
||||
const lineElement = tokenElement.closest(".CodeMirror-line");
|
||||
// Those are the breakpoint chevron we click on to set a breakpoint on a given column
|
||||
const columnMarkers = [
|
||||
...lineElement.querySelectorAll(".column-breakpoint"),
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
// Tests that breakpoints set in the pretty printed files display and paused
|
||||
// correctly.
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-pretty.html", "pretty.js");
|
||||
|
||||
await selectSource(dbg, "pretty.js");
|
||||
await prettyPrint(dbg);
|
||||
|
||||
info(
|
||||
"Add breakpoint in funcWithMultipleBreakableColumns, on the for-loop line"
|
||||
);
|
||||
const LINE_INDEX_TO_BREAK_ON = 15;
|
||||
const prettySourceFileName = "pretty.js:formatted";
|
||||
await addBreakpoint(dbg, prettySourceFileName, LINE_INDEX_TO_BREAK_ON);
|
||||
const prettySource = findSource(dbg, prettySourceFileName);
|
||||
|
||||
info("Check that multiple column breakpoints can be set");
|
||||
const columnBreakpointMarkers = await waitForAllElements(
|
||||
dbg,
|
||||
"columnBreakpoints"
|
||||
);
|
||||
/*
|
||||
* We're pausing on the following line, which should have those breakpoints (marked with ➤)
|
||||
*
|
||||
* for( ➤let i=0; ➤i < items.length; ➤i++ ) {
|
||||
*
|
||||
*/
|
||||
is(
|
||||
columnBreakpointMarkers.length,
|
||||
3,
|
||||
"We have the expected numbers of possible column breakpoints"
|
||||
);
|
||||
|
||||
info("Enable the second column breakpoint");
|
||||
columnBreakpointMarkers[1].click();
|
||||
await waitForBreakpointCount(dbg, 2);
|
||||
await waitForAllElements(dbg, "breakpointItems", 2);
|
||||
|
||||
info("Check that we do pause at expected locations");
|
||||
invokeInTab("funcWithMultipleBreakableColumns");
|
||||
|
||||
info("We pause on the first column breakpoint (before `i` init)");
|
||||
await waitForPaused(dbg);
|
||||
await assertPausedAtSourceAndLine(
|
||||
dbg,
|
||||
prettySource.id,
|
||||
LINE_INDEX_TO_BREAK_ON,
|
||||
15
|
||||
);
|
||||
await resume(dbg);
|
||||
|
||||
info(
|
||||
"We pause at the second column breakpoint, before the first loop iteration"
|
||||
);
|
||||
await waitForPaused(dbg);
|
||||
await assertPausedAtSourceAndLine(
|
||||
dbg,
|
||||
prettySource.id,
|
||||
LINE_INDEX_TO_BREAK_ON,
|
||||
18
|
||||
);
|
||||
const assertScopesForSecondColumnBreakpoint = topBlockItems =>
|
||||
assertScopes(dbg, [
|
||||
"Block",
|
||||
["<this>", "Window"],
|
||||
...topBlockItems,
|
||||
"funcWithMultipleBreakableColumns",
|
||||
["arguments", "Arguments"],
|
||||
["items", "(2) […]"],
|
||||
]);
|
||||
await assertScopesForSecondColumnBreakpoint([["i", "0"]]);
|
||||
await resume(dbg);
|
||||
|
||||
info(
|
||||
"We pause at the second column breakpoint, before the second loop iteration"
|
||||
);
|
||||
await waitForPaused(dbg);
|
||||
await assertPausedAtSourceAndLine(
|
||||
dbg,
|
||||
prettySource.id,
|
||||
LINE_INDEX_TO_BREAK_ON,
|
||||
18
|
||||
);
|
||||
await assertScopesForSecondColumnBreakpoint([["i", "1"]]);
|
||||
await resume(dbg);
|
||||
|
||||
info(
|
||||
"We pause at the second column breakpoint, before we exit the loop (`items.length` is 2, so the condition will fail)"
|
||||
);
|
||||
await waitForPaused(dbg);
|
||||
await assertPausedAtSourceAndLine(
|
||||
dbg,
|
||||
prettySource.id,
|
||||
LINE_INDEX_TO_BREAK_ON,
|
||||
18
|
||||
);
|
||||
await assertScopesForSecondColumnBreakpoint([["i", "2"]]);
|
||||
await resume(dbg);
|
||||
|
||||
info("Remove all breakpoints");
|
||||
await clickGutter(dbg, LINE_INDEX_TO_BREAK_ON);
|
||||
await waitForBreakpointCount(dbg, 0);
|
||||
|
||||
ok(
|
||||
!findAllElements(dbg, "columnBreakpoints").length,
|
||||
"There is no column breakpoints anymore after clicking on the gutter"
|
||||
);
|
||||
});
|
|
@ -34,7 +34,7 @@ add_task(async function() {
|
|||
const formattedLink = await waitForConsoleLink(
|
||||
dbg,
|
||||
"arithmetic",
|
||||
"math.min.js:formatted:22"
|
||||
"math.min.js:formatted:22:18"
|
||||
);
|
||||
ok(true, "Message location was updated as expected");
|
||||
|
||||
|
|
|
@ -4,4 +4,7 @@ function stuff() {
|
|||
a(); a();
|
||||
a(); a();
|
||||
debugger
|
||||
}
|
||||
function funcWithMultipleBreakableColumns() {
|
||||
const items = [1,2];for(let i=0;i<items.length;i++){items[i]=items[i]+1}
|
||||
}
|
|
@ -163,41 +163,48 @@ enum {
|
|||
// child's later siblings must also be restyled.
|
||||
NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS = NODE_FLAG_BIT(9),
|
||||
|
||||
// A child of this node might be matched by :nth-child(.. of <selector>) or
|
||||
// :nth-last-child(.. of <selector>). If a DOM mutation may have caused the
|
||||
// selector to either match or no longer match that child, the child's
|
||||
// siblings are restyled.
|
||||
NODE_HAS_SLOW_SELECTOR_NTH_OF = NODE_FLAG_BIT(10),
|
||||
|
||||
NODE_ALL_SELECTOR_FLAGS = NODE_HAS_EMPTY_SELECTOR | NODE_HAS_SLOW_SELECTOR |
|
||||
NODE_HAS_EDGE_CHILD_SELECTOR |
|
||||
NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS,
|
||||
NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS |
|
||||
NODE_HAS_SLOW_SELECTOR_NTH_OF,
|
||||
|
||||
// This node needs to go through frame construction to get a frame (or
|
||||
// undisplayed entry).
|
||||
NODE_NEEDS_FRAME = NODE_FLAG_BIT(10),
|
||||
NODE_NEEDS_FRAME = NODE_FLAG_BIT(11),
|
||||
|
||||
// At least one descendant in the flattened tree has NODE_NEEDS_FRAME set.
|
||||
// This should be set on every node on the flattened tree path between the
|
||||
// node(s) with NODE_NEEDS_FRAME and the root content.
|
||||
NODE_DESCENDANTS_NEED_FRAMES = NODE_FLAG_BIT(11),
|
||||
NODE_DESCENDANTS_NEED_FRAMES = NODE_FLAG_BIT(12),
|
||||
|
||||
// Set if the node has the accesskey attribute set.
|
||||
NODE_HAS_ACCESSKEY = NODE_FLAG_BIT(12),
|
||||
NODE_HAS_ACCESSKEY = NODE_FLAG_BIT(13),
|
||||
|
||||
// Set if the node has right-to-left directionality
|
||||
NODE_HAS_DIRECTION_RTL = NODE_FLAG_BIT(13),
|
||||
NODE_HAS_DIRECTION_RTL = NODE_FLAG_BIT(14),
|
||||
|
||||
// Set if the node has left-to-right directionality
|
||||
NODE_HAS_DIRECTION_LTR = NODE_FLAG_BIT(14),
|
||||
NODE_HAS_DIRECTION_LTR = NODE_FLAG_BIT(15),
|
||||
|
||||
NODE_ALL_DIRECTION_FLAGS = NODE_HAS_DIRECTION_LTR | NODE_HAS_DIRECTION_RTL,
|
||||
|
||||
NODE_HAS_BEEN_IN_UA_WIDGET = NODE_FLAG_BIT(15),
|
||||
NODE_HAS_BEEN_IN_UA_WIDGET = NODE_FLAG_BIT(16),
|
||||
|
||||
// Set if the node has a nonce value and a header delivered CSP.
|
||||
NODE_HAS_NONCE_AND_HEADER_CSP = NODE_FLAG_BIT(16),
|
||||
NODE_HAS_NONCE_AND_HEADER_CSP = NODE_FLAG_BIT(17),
|
||||
|
||||
NODE_KEEPS_DOMARENA = NODE_FLAG_BIT(17),
|
||||
NODE_KEEPS_DOMARENA = NODE_FLAG_BIT(18),
|
||||
|
||||
NODE_MAY_HAVE_ELEMENT_CHILDREN = NODE_FLAG_BIT(18),
|
||||
NODE_MAY_HAVE_ELEMENT_CHILDREN = NODE_FLAG_BIT(19),
|
||||
|
||||
// Remaining bits are node type specific.
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 19
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 20
|
||||
};
|
||||
|
||||
// Make sure we have space for our bits
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "modules/desktop_capture/desktop_frame.h"
|
||||
#include "modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "modules/video_capture/video_capture.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
|
@ -695,9 +694,8 @@ void DesktopCaptureImpl::InitOnThread(int aFramerate) {
|
|||
mCapturer->Start(this);
|
||||
|
||||
mCaptureTimer = NS_NewTimer();
|
||||
mRequestedCaptureInterval =
|
||||
TimeDuration::FromSeconds(1. / static_cast<double>(aFramerate));
|
||||
MOZ_ASSERT(!mRequestedCaptureInterval.IsZero());
|
||||
mRequestedCaptureInterval = mozilla::Some(
|
||||
TimeDuration::FromSeconds(1. / static_cast<double>(aFramerate)));
|
||||
|
||||
CaptureFrameOnThread();
|
||||
}
|
||||
|
@ -708,7 +706,7 @@ void DesktopCaptureImpl::ShutdownOnThread() {
|
|||
mCaptureTimer->Cancel();
|
||||
mCaptureTimer = nullptr;
|
||||
}
|
||||
mRequestedCaptureInterval = mozilla::TimeDuration();
|
||||
mRequestedCaptureInterval = mozilla::Nothing();
|
||||
}
|
||||
|
||||
void DesktopCaptureImpl::CaptureFrameOnThread() {
|
||||
|
@ -720,7 +718,7 @@ void DesktopCaptureImpl::CaptureFrameOnThread() {
|
|||
|
||||
// Calculate next capture time.
|
||||
const auto duration = end - start;
|
||||
const auto timeUntilRequestedCapture = mRequestedCaptureInterval - duration;
|
||||
const auto timeUntilRequestedCapture = *mRequestedCaptureInterval - duration;
|
||||
|
||||
// Use at most x% CPU or limit framerate
|
||||
constexpr float sleepTimeFactor =
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "desktop_device_info.h"
|
||||
#include "mozilla/DataMutex.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "PerformanceRecorder.h"
|
||||
|
@ -226,8 +227,8 @@ class DesktopCaptureImpl : public DesktopCapturer::Callback,
|
|||
// TODO(Bug 1806646): Drive capture with vsync instead.
|
||||
nsCOMPtr<nsITimer> mCaptureTimer;
|
||||
// Interval between captured frames, based on the framerate in
|
||||
// mRequestedCapability.
|
||||
mozilla::TimeDuration mRequestedCaptureInterval;
|
||||
// mRequestedCapability. mCaptureThread only.
|
||||
mozilla::Maybe<mozilla::TimeDuration> mRequestedCaptureInterval;
|
||||
// Used to make sure incoming timestamp is increasing for every frame.
|
||||
// mCaptureThread only.
|
||||
webrtc::Timestamp mNextFrameMinimumTime;
|
||||
|
|
|
@ -205,10 +205,10 @@ struct Engine {
|
|||
|
||||
MOZ_UNROLL(2)
|
||||
for (unsigned i = 0; i < aSize * 2;
|
||||
i += 2 * xsimd::batch<std::complex<float>>::size) {
|
||||
auto in1 = xsimd::batch<std::complex<float>>::load_aligned(
|
||||
i += 2 * xsimd::batch<std::complex<float>, Arch>::size) {
|
||||
auto in1 = xsimd::batch<std::complex<float>, Arch>::load_aligned(
|
||||
reinterpret_cast<const std::complex<float>*>(&aInput[i]));
|
||||
auto in2 = xsimd::batch<std::complex<float>>::load_aligned(
|
||||
auto in2 = xsimd::batch<std::complex<float>, Arch>::load_aligned(
|
||||
reinterpret_cast<const std::complex<float>*>(&aScale[i]));
|
||||
auto out = in1 * in2;
|
||||
out.store_aligned(reinterpret_cast<std::complex<float>*>(&aOutput[i]));
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<html class="reftest-wait">
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
try {
|
||||
(await navigator.mediaDevices.getDisplayMedia({
|
||||
"video": {
|
||||
"frameRate": 2147483647,
|
||||
},
|
||||
})).stop();
|
||||
} finally {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -4,3 +4,4 @@ load 1770075.html
|
|||
load 1789908.html
|
||||
load 1799168.html
|
||||
load 1816708.html
|
||||
load 1821477.html
|
||||
|
|
|
@ -185,6 +185,15 @@ class FakeSocketTransportProvider : public nsISocketTransport {
|
|||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetEffectiveTRRMode(
|
||||
nsIRequest::TRRMode* aEffectiveTRRMode) override {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetTrrSkipReason(nsITRRSkipReason::value* aSkipReason) override {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetRetryDnsIfPossible(bool* aRetryDns) override {
|
||||
MOZ_ASSERT(false);
|
||||
return NS_OK;
|
||||
|
|
|
@ -39,11 +39,24 @@ static double WSSDistance(const Face* aFace, const gfxFontStyle& aStyle) {
|
|||
weightDist * kWeightFactor;
|
||||
}
|
||||
|
||||
void* Pointer::ToPtr(FontList* aFontList) const {
|
||||
void* Pointer::ToPtr(FontList* aFontList) const MOZ_NO_THREAD_SAFETY_ANALYSIS {
|
||||
if (IsNull()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Ensure the list doesn't get replaced out from under us. Font-list rebuild
|
||||
// happens on the main thread, so only non-main-thread callers need to lock
|
||||
// it here.
|
||||
bool isMainThread = NS_IsMainThread();
|
||||
if (!isMainThread) {
|
||||
gfxPlatformFontList::PlatformFontList()->Lock();
|
||||
}
|
||||
|
||||
// On failure, we'll return null; callers need to handle this appropriately
|
||||
// (e.g. via fallback).
|
||||
void* result = nullptr;
|
||||
uint32_t block = Block();
|
||||
|
||||
// If the Pointer refers to a block we have not yet mapped in this process,
|
||||
// we first need to retrieve new block handle(s) from the parent and update
|
||||
// our mBlocks list.
|
||||
|
@ -51,7 +64,7 @@ void* Pointer::ToPtr(FontList* aFontList) const {
|
|||
if (block >= blocks.Length()) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
// Shouldn't happen! A content process tried to pass a bad Pointer?
|
||||
return nullptr;
|
||||
goto cleanup;
|
||||
}
|
||||
// UpdateShmBlocks can fail, if the parent has replaced the font list with
|
||||
// a new generation. In that case we just return null, and whatever font
|
||||
|
@ -61,8 +74,8 @@ void* Pointer::ToPtr(FontList* aFontList) const {
|
|||
// failure of this font will be forgotten.
|
||||
// We also return null if we're not on the main thread, as we cannot safely
|
||||
// do the IPC messaging needed here.
|
||||
if (!NS_IsMainThread() || !aFontList->UpdateShmBlocks()) {
|
||||
return nullptr;
|
||||
if (!isMainThread || !aFontList->UpdateShmBlocks()) {
|
||||
goto cleanup;
|
||||
}
|
||||
MOZ_ASSERT(block < blocks.Length(), "failure in UpdateShmBlocks?");
|
||||
// This is wallpapering bug 1667977; it's unclear if we will always survive
|
||||
|
@ -72,10 +85,17 @@ void* Pointer::ToPtr(FontList* aFontList) const {
|
|||
// font list is being rebuilt by the parent; content will then be notified
|
||||
// that the list has changed, and should refresh everything successfully.
|
||||
if (block >= blocks.Length()) {
|
||||
return nullptr;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
return static_cast<char*>(blocks[block]->Memory()) + Offset();
|
||||
result = static_cast<char*>(blocks[block]->Memory()) + Offset();
|
||||
|
||||
cleanup:
|
||||
if (!isMainThread) {
|
||||
gfxPlatformFontList::PlatformFontList()->Unlock();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void String::Assign(const nsACString& aString, FontList* aList) {
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include "build/build_config.h"
|
||||
#include "chrome/common/ipc_message.h"
|
||||
#include "chrome/common/ipc_message_utils.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/ipc/IPCCore.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
|
||||
class PickleIterator;
|
||||
|
||||
|
|
|
@ -454,11 +454,12 @@ void Zone::prepareForCompacting() {
|
|||
}
|
||||
|
||||
void GCRuntime::sweepZoneAfterCompacting(MovingTracer* trc, Zone* zone) {
|
||||
MOZ_ASSERT(zone->isCollecting());
|
||||
traceWeakFinalizationObserverEdges(trc, zone);
|
||||
MOZ_ASSERT(zone->isGCCompacting());
|
||||
|
||||
zone->traceWeakMaps(trc);
|
||||
|
||||
traceWeakFinalizationObserverEdges(trc, zone);
|
||||
|
||||
for (auto* cache : zone->weakCaches()) {
|
||||
cache->traceWeak(trc, nullptr);
|
||||
}
|
||||
|
|
|
@ -3362,6 +3362,23 @@ void RestyleManager::ElementStateChanged(Element* aElement,
|
|||
ServoElementSnapshot& snapshot = SnapshotFor(*aElement);
|
||||
ElementState previousState = aElement->StyleState() ^ aChangedBits;
|
||||
snapshot.AddState(previousState);
|
||||
|
||||
MaybeRestyleForNthOfState(*StyleSet(), aElement, aChangedBits);
|
||||
}
|
||||
|
||||
void RestyleManager::MaybeRestyleForNthOfState(ServoStyleSet& aStyleSet,
|
||||
Element* aChild,
|
||||
ElementState aChangedBits) {
|
||||
const auto* parentNode = aChild->GetParentNode();
|
||||
MOZ_ASSERT(parentNode);
|
||||
const auto parentFlags = parentNode->GetFlags();
|
||||
if (!(parentFlags & NODE_HAS_SLOW_SELECTOR_NTH_OF)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aStyleSet.HasNthOfStateDependency(*aChild, aChangedBits)) {
|
||||
RestyleSiblings(aChild, parentFlags);
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool AttributeInfluencesOtherPseudoClassState(
|
||||
|
@ -3492,6 +3509,8 @@ void RestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
|||
|
||||
changeHint |= aElement->GetAttributeChangeHint(aAttribute, aModType);
|
||||
|
||||
MaybeRestyleForNthOfAttribute(aElement, aAttribute, aOldValue);
|
||||
|
||||
if (aAttribute == nsGkAtoms::style) {
|
||||
restyleHint |= RestyleHint::RESTYLE_STYLE_ATTRIBUTE;
|
||||
} else if (AttributeChangeRequiresSubtreeRestyle(*aElement, aAttribute)) {
|
||||
|
@ -3539,6 +3558,59 @@ void RestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
|||
}
|
||||
}
|
||||
|
||||
void RestyleManager::RestyleSiblings(
|
||||
Element* aChild, nsBaseContentList::FlagsType aParentFlags) {
|
||||
const DebugOnly<nsINode*> parentNode = aChild->GetParentNode();
|
||||
MOZ_ASSERT(parentNode->IsElement() || parentNode->IsShadowRoot());
|
||||
|
||||
DebugOnly<bool> restyledSiblings = false;
|
||||
// NODE_HAS_SLOW_SELECTOR typically indicates restyling the parent, but since
|
||||
// we know we're restyling for :nth-last-child(.. of <selector>), we can
|
||||
// restyle only previous siblings without under-invalidating.
|
||||
if (aParentFlags & NODE_HAS_SLOW_SELECTOR) {
|
||||
RestylePreviousSiblings(aChild->GetPreviousSibling());
|
||||
restyledSiblings = true;
|
||||
}
|
||||
if (aParentFlags & NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS) {
|
||||
RestyleSiblingsStartingWith(aChild->GetNextSibling());
|
||||
restyledSiblings = true;
|
||||
}
|
||||
MOZ_ASSERT(restyledSiblings,
|
||||
"How can we restyle siblings without a slow selector flag?");
|
||||
}
|
||||
|
||||
void RestyleManager::MaybeRestyleForNthOfAttribute(
|
||||
Element* aChild, nsAtom* aAttribute, const nsAttrValue* aOldValue) {
|
||||
const auto* parentNode = aChild->GetParentNode();
|
||||
MOZ_ASSERT(parentNode);
|
||||
const auto parentFlags = parentNode->GetFlags();
|
||||
if (!(parentFlags & NODE_HAS_SLOW_SELECTOR_NTH_OF)) {
|
||||
return;
|
||||
}
|
||||
if (!aChild->HasServoData()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool mightHaveNthOfDependency;
|
||||
auto& styleSet = *StyleSet();
|
||||
if (aAttribute == nsGkAtoms::id) {
|
||||
auto* const oldAtom = aOldValue->Type() == nsAttrValue::eAtom
|
||||
? aOldValue->GetAtomValue()
|
||||
: nullptr;
|
||||
mightHaveNthOfDependency =
|
||||
styleSet.MightHaveNthOfIDDependency(*aChild, oldAtom, aChild->GetID());
|
||||
} else if (aAttribute == nsGkAtoms::_class) {
|
||||
mightHaveNthOfDependency = styleSet.MightHaveNthOfClassDependency(*aChild);
|
||||
} else {
|
||||
mightHaveNthOfDependency =
|
||||
styleSet.MightHaveNthOfAttributeDependency(*aChild, aAttribute);
|
||||
}
|
||||
|
||||
if (mightHaveNthOfDependency) {
|
||||
RestyleSiblings(aChild, parentFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void RestyleManager::ReparentComputedStyleForFirstLine(nsIFrame* aFrame) {
|
||||
// This is only called when moving frames in or out of the first-line
|
||||
// pseudo-element (or one of its descendants). We can't say much about
|
||||
|
|
|
@ -360,6 +360,15 @@ class RestyleManager {
|
|||
void ProcessAllPendingAttributeAndStateInvalidations();
|
||||
|
||||
void ElementStateChanged(Element*, dom::ElementState);
|
||||
|
||||
/**
|
||||
* Posts restyle hints for siblings of an element and their descendants if the
|
||||
* element's parent has NODE_HAS_SLOW_SELECTOR_NTH_OF and the element has a
|
||||
* relevant state dependency.
|
||||
*/
|
||||
void MaybeRestyleForNthOfState(ServoStyleSet& aStyleSet, dom::Element* aChild,
|
||||
dom::ElementState aChangedBits);
|
||||
|
||||
void AttributeWillChange(Element* aElement, int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute, int32_t aModType);
|
||||
void ClassAttributeWillBeChangedBySMIL(dom::Element* aElement);
|
||||
|
@ -367,6 +376,20 @@ class RestyleManager {
|
|||
nsAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aOldValue);
|
||||
|
||||
/**
|
||||
* Restyle an element's previous and/or next siblings.
|
||||
*/
|
||||
void RestyleSiblings(dom::Element* aChild,
|
||||
nsBaseContentList::FlagsType aParentFlags);
|
||||
|
||||
/**
|
||||
* Posts restyle hints for siblings of an element and their descendants if the
|
||||
* element's parent has NODE_HAS_SLOW_SELECTOR_NTH_OF and the element has a
|
||||
* relevant attribute dependency.
|
||||
*/
|
||||
void MaybeRestyleForNthOfAttribute(dom::Element* aChild, nsAtom* aAttribute,
|
||||
const nsAttrValue* aOldValue);
|
||||
|
||||
// This is only used to reparent things when moving them in/out of the
|
||||
// ::first-line.
|
||||
void ReparentComputedStyleForFirstLine(nsIFrame*);
|
||||
|
|
|
@ -1395,12 +1395,36 @@ bool ServoStyleSet::MightHaveAttributeDependency(const Element& aElement,
|
|||
aAttribute);
|
||||
}
|
||||
|
||||
bool ServoStyleSet::MightHaveNthOfIDDependency(const Element& aElement,
|
||||
nsAtom* aOldID,
|
||||
nsAtom* aNewID) const {
|
||||
return Servo_StyleSet_MightHaveNthOfIDDependency(mRawSet.get(), &aElement,
|
||||
aOldID, aNewID);
|
||||
}
|
||||
|
||||
bool ServoStyleSet::MightHaveNthOfClassDependency(const Element& aElement) {
|
||||
return Servo_StyleSet_MightHaveNthOfClassDependency(mRawSet.get(), &aElement,
|
||||
&Snapshots());
|
||||
}
|
||||
|
||||
bool ServoStyleSet::MightHaveNthOfAttributeDependency(
|
||||
const Element& aElement, nsAtom* aAttribute) const {
|
||||
return Servo_StyleSet_MightHaveNthOfAttributeDependency(
|
||||
mRawSet.get(), &aElement, aAttribute);
|
||||
}
|
||||
|
||||
bool ServoStyleSet::HasStateDependency(const Element& aElement,
|
||||
dom::ElementState aState) const {
|
||||
return Servo_StyleSet_HasStateDependency(mRawSet.get(), &aElement,
|
||||
aState.GetInternalValue());
|
||||
}
|
||||
|
||||
bool ServoStyleSet::HasNthOfStateDependency(const Element& aElement,
|
||||
dom::ElementState aState) const {
|
||||
return Servo_StyleSet_HasNthOfStateDependency(mRawSet.get(), &aElement,
|
||||
aState.GetInternalValue());
|
||||
}
|
||||
|
||||
bool ServoStyleSet::HasDocumentStateDependency(
|
||||
dom::DocumentState aState) const {
|
||||
return Servo_StyleSet_HasDocumentStateDependency(mRawSet.get(),
|
||||
|
|
|
@ -461,6 +461,26 @@ class ServoStyleSet {
|
|||
bool MightHaveAttributeDependency(const dom::Element&,
|
||||
nsAtom* aAttribute) const;
|
||||
|
||||
/**
|
||||
* Returns true if a modification to an attribute with the specified local
|
||||
* name might require us to restyle the element's siblings.
|
||||
*/
|
||||
bool MightHaveNthOfAttributeDependency(const dom::Element&,
|
||||
nsAtom* aAttribute) const;
|
||||
|
||||
/**
|
||||
* Returns true if a modification to a class might require us to restyle the
|
||||
* element's siblings.
|
||||
*/
|
||||
bool MightHaveNthOfClassDependency(const dom::Element&);
|
||||
|
||||
/**
|
||||
* Returns true if a modification to an ID might require us to restyle the
|
||||
* element's siblings.
|
||||
*/
|
||||
bool MightHaveNthOfIDDependency(const dom::Element&, nsAtom* aOldID,
|
||||
nsAtom* aNewID) const;
|
||||
|
||||
/**
|
||||
* Returns true if a change in event state on an element might require
|
||||
* us to restyle the element.
|
||||
|
@ -471,6 +491,12 @@ class ServoStyleSet {
|
|||
*/
|
||||
bool HasStateDependency(const dom::Element&, dom::ElementState) const;
|
||||
|
||||
/**
|
||||
* Returns true if a change in event state on an element might require
|
||||
* us to restyle the element's siblings.
|
||||
*/
|
||||
bool HasNthOfStateDependency(const dom::Element&, dom::ElementState) const;
|
||||
|
||||
/**
|
||||
* Returns true if a change in document state might require us to restyle the
|
||||
* document.
|
||||
|
|
|
@ -60,6 +60,4 @@ DisableStlWrapping()
|
|||
if CONFIG["CC_TYPE"] == "clang-cl":
|
||||
AllowCompilerWarnings() # workaround for bug 1090497
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
||||
TEST_DIRS += ["test"]
|
||||
|
|
|
@ -21,5 +21,3 @@ if CONFIG["CC_TYPE"] == "clang":
|
|||
CXXFLAGS += ["-Wno-inconsistent-missing-override"]
|
||||
|
||||
FINAL_LIBRARY = "xul-gtest"
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -39,11 +39,7 @@ static struct {
|
|||
#endif
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::DebugOnly;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::MutexAutoLock;
|
||||
using mozilla::Nothing;
|
||||
using mozilla::Some;
|
||||
using namespace mozilla;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBufferedStream
|
||||
|
@ -68,6 +64,7 @@ nsresult nsBufferedStream::Init(nsISupports* aStream, uint32_t bufferSize) {
|
|||
mCursor = 0;
|
||||
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mStream);
|
||||
mSeekable = seekable;
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
mBuffer = new (mozilla::fallible) char[bufferSize];
|
||||
if (mBuffer == nullptr) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -78,6 +75,7 @@ nsresult nsBufferedStream::Init(nsISupports* aStream, uint32_t bufferSize) {
|
|||
void nsBufferedStream::Close() {
|
||||
// Drop the reference from nsBufferedStream::Init()
|
||||
mStream = nullptr;
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
if (mBuffer) {
|
||||
delete[] mBuffer;
|
||||
mBuffer = nullptr;
|
||||
|
@ -432,6 +430,7 @@ nsBufferedInputStream::ReadSegments(nsWriteSegmentFun writer, void* closure,
|
|||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
while (count > 0) {
|
||||
uint32_t amt = std::min(count, mFillPoint - mCursor);
|
||||
if (amt > 0) {
|
||||
|
@ -471,6 +470,8 @@ nsBufferedInputStream::Fill() {
|
|||
}
|
||||
NS_ENSURE_TRUE(mStream, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
|
||||
nsresult rv;
|
||||
int32_t rem = int32_t(mFillPoint - mCursor);
|
||||
if (rem > 0) {
|
||||
|
@ -508,6 +509,7 @@ nsBufferedInputStream::GetBuffer(uint32_t aLength, uint32_t aAlignMask) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
char* buf = mBuffer + mCursor;
|
||||
uint32_t rem = mFillPoint - mCursor;
|
||||
if (rem == 0) {
|
||||
|
@ -717,6 +719,8 @@ NS_IMETHODIMP
|
|||
nsBufferedInputStream::GetCloneable(bool* aCloneable) {
|
||||
*aCloneable = false;
|
||||
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
|
||||
// If we don't have the buffer, the inputStream has been already closed.
|
||||
// If mBufferStartOffset is not 0, the stream has been seeked or read.
|
||||
// In both case the cloning is not supported.
|
||||
|
@ -734,6 +738,8 @@ nsBufferedInputStream::GetCloneable(bool* aCloneable) {
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsBufferedInputStream::Clone(nsIInputStream** aResult) {
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
|
||||
if (!mBuffer || mBufferStartOffset) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -907,6 +913,7 @@ nsBufferedOutputStream::Write(const char* buf, uint32_t count,
|
|||
return NS_BASE_STREAM_CLOSED;
|
||||
}
|
||||
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
while (count > 0) {
|
||||
uint32_t amt = std::min(count, mBufferSize - mCursor);
|
||||
if (amt > 0) {
|
||||
|
@ -943,6 +950,7 @@ nsBufferedOutputStream::Flush() {
|
|||
if (mFillPoint == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
rv = Sink()->Write(mBuffer, mFillPoint, &amt);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
@ -1017,6 +1025,7 @@ nsBufferedOutputStream::WriteSegments(nsReadSegmentFun reader, void* closure,
|
|||
uint32_t count, uint32_t* _retval) {
|
||||
*_retval = 0;
|
||||
nsresult rv;
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
while (count > 0) {
|
||||
uint32_t left = std::min(count, mBufferSize - mCursor);
|
||||
if (left == 0) {
|
||||
|
@ -1061,6 +1070,7 @@ nsBufferedOutputStream::GetBuffer(uint32_t aLength, uint32_t aAlignMask) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RecursiveMutexAutoLock lock(mBufferMutex);
|
||||
char* buf = mBuffer + mCursor;
|
||||
uint32_t rem = mBufferSize - mCursor;
|
||||
if (rem == 0) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "nsICloneableInputStream.h"
|
||||
#include "nsIInputStreamLength.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/RecursiveMutex.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -40,7 +41,9 @@ class nsBufferedStream : public nsISeekableStream {
|
|||
NS_IMETHOD Flush() = 0;
|
||||
|
||||
uint32_t mBufferSize{0};
|
||||
char* mBuffer{nullptr};
|
||||
char* mBuffer MOZ_GUARDED_BY(mBufferMutex){nullptr};
|
||||
|
||||
mozilla::RecursiveMutex mBufferMutex{"nsBufferedStream::mBufferMutex"};
|
||||
|
||||
// mBufferStartOffset is the offset relative to the start of mStream.
|
||||
int64_t mBufferStartOffset{0};
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "nsITransport.idl"
|
||||
#include "nsIRequest.idl"
|
||||
#include "nsITRRSkipReason.idl"
|
||||
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsINetAddr;
|
||||
|
@ -345,6 +346,16 @@ interface nsISocketTransport : nsITransport
|
|||
*/
|
||||
bool resolvedByTRR();
|
||||
|
||||
/**
|
||||
* Returns the effectiveTRRMode used for the DNS resolution.
|
||||
*/
|
||||
readonly attribute nsIRequest_TRRMode effectiveTRRMode;
|
||||
|
||||
/**
|
||||
* Returns the TRR skip reason used for the DNS resolution.
|
||||
*/
|
||||
readonly attribute nsITRRSkipReason_value trrSkipReason;
|
||||
|
||||
/**
|
||||
* Indicate whether this socket is created from a private window. If yes,
|
||||
* this socket will be closed when the last private window is closed.
|
||||
|
|
|
@ -700,6 +700,9 @@ nsresult nsSocketTransport::Init(const nsTArray<nsCString>& types,
|
|||
if (dnsRecord) {
|
||||
mExternalDNSResolution = true;
|
||||
mDNSRecord = do_QueryInterface(dnsRecord);
|
||||
mDNSRecord->IsTRR(&mResolvedByTRR);
|
||||
mDNSRecord->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
mDNSRecord->GetTrrSkipReason(&mTRRSkipReason);
|
||||
}
|
||||
|
||||
// init socket type info
|
||||
|
@ -1684,6 +1687,8 @@ bool nsSocketTransport::RecoverFromError() {
|
|||
if (mState == STATE_CONNECTING && mDNSRecord) {
|
||||
nsresult rv = mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
|
||||
mDNSRecord->IsTRR(&mResolvedByTRR);
|
||||
mDNSRecord->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
mDNSRecord->GetTrrSkipReason(&mTRRSkipReason);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
SOCKET_LOG((" trying again with next ip address\n"));
|
||||
tryAgain = true;
|
||||
|
@ -1988,6 +1993,8 @@ void nsSocketTransport::OnSocketEvent(uint32_t type, nsresult status,
|
|||
if (mDNSRecord) {
|
||||
mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
|
||||
mDNSRecord->IsTRR(&mResolvedByTRR);
|
||||
mDNSRecord->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
mDNSRecord->GetTrrSkipReason(&mTRRSkipReason);
|
||||
}
|
||||
// status contains DNS lookup status
|
||||
if (NS_FAILED(status)) {
|
||||
|
@ -2717,6 +2724,12 @@ nsSocketTransport::OnLookupComplete(nsICancelable* request, nsIDNSRecord* rec,
|
|||
MOZ_ASSERT(mDNSRecord);
|
||||
}
|
||||
|
||||
if (nsCOMPtr<nsIDNSAddrRecord> addrRecord = do_QueryInterface(rec)) {
|
||||
addrRecord->IsTRR(&mResolvedByTRR);
|
||||
addrRecord->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
addrRecord->GetTrrSkipReason(&mTRRSkipReason);
|
||||
}
|
||||
|
||||
// flag host lookup complete for the benefit of the ResolveHost method.
|
||||
mResolving = false;
|
||||
nsresult rv = PostEvent(MSG_DNS_LOOKUP_COMPLETE, status, nullptr);
|
||||
|
@ -3313,6 +3326,18 @@ nsSocketTransport::ResolvedByTRR(bool* aResolvedByTRR) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSocketTransport::GetEffectiveTRRMode(
|
||||
nsIRequest::TRRMode* aEffectiveTRRMode) {
|
||||
*aEffectiveTRRMode = mEffectiveTRRMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSocketTransport::GetTrrSkipReason(
|
||||
nsITRRSkipReason::value* aSkipReason) {
|
||||
*aSkipReason = mTRRSkipReason;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::GetRetryDnsIfPossible(bool* aRetryDns) {
|
||||
*aRetryDns = mRetryDnsIfPossible;
|
||||
|
|
|
@ -326,6 +326,8 @@ class nsSocketTransport final : public nsASocketHandler,
|
|||
nsCString mEchConfig;
|
||||
bool mEchConfigUsed = false;
|
||||
bool mResolvedByTRR{false};
|
||||
nsIRequest::TRRMode mEffectiveTRRMode{nsIRequest::TRR_DEFAULT_MODE};
|
||||
nsITRRSkipReason::value mTRRSkipReason{nsITRRSkipReason::TRR_UNSET};
|
||||
|
||||
// mNetAddr/mSelfAddr is valid from GetPeerAddr()/GetSelfAddr() once we have
|
||||
// reached STATE_TRANSFERRING. It must not change after that.
|
||||
|
|
|
@ -420,6 +420,16 @@ DnsAndConnectSocket::OnLookupComplete(nsICancelable* request, nsIDNSRecord* rec,
|
|||
LOG(("DnsAndConnectSocket::OnLookupComplete: this=%p status %" PRIx32 ".",
|
||||
this, static_cast<uint32_t>(status)));
|
||||
|
||||
if (nsCOMPtr<nsIDNSAddrRecord> addrRecord = do_QueryInterface((rec))) {
|
||||
nsIRequest::TRRMode effectivemode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
addrRecord->GetEffectiveTRRMode(&effectivemode);
|
||||
nsITRRSkipReason::value skipReason = nsITRRSkipReason::TRR_UNSET;
|
||||
addrRecord->GetTrrSkipReason(&skipReason);
|
||||
if (mTransaction) {
|
||||
mTransaction->SetTRRInfo(effectivemode, skipReason);
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(request);
|
||||
RefPtr<DnsAndConnectSocket> deleteProtector(this);
|
||||
|
||||
|
@ -1281,11 +1291,12 @@ nsresult DnsAndConnectSocket::TransportSetup::ResolveHost(
|
|||
|
||||
nsresult rv = NS_OK;
|
||||
do {
|
||||
rv = dns->AsyncResolveNative(mHost, nsIDNSService::RESOLVE_TYPE_DEFAULT,
|
||||
mDnsFlags, nullptr, dnsAndSock,
|
||||
gSocketTransportService,
|
||||
dnsAndSock->mConnInfo->GetOriginAttributes(),
|
||||
getter_AddRefs(mDNSRequest));
|
||||
rv = dns->AsyncResolveNative(
|
||||
mHost, nsIDNSService::RESOLVE_TYPE_DEFAULT,
|
||||
mDnsFlags | nsIDNSService::RESOLVE_WANT_RECORD_ON_ERROR, nullptr,
|
||||
dnsAndSock, gSocketTransportService,
|
||||
dnsAndSock->mConnInfo->GetOriginAttributes(),
|
||||
getter_AddRefs(mDNSRequest));
|
||||
} while (NS_FAILED(rv) && ShouldRetryDNS());
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -181,6 +181,16 @@ Http2StreamTunnel::ResolvedByTRR(bool* aResolvedByTRR) {
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Http2StreamTunnel::GetEffectiveTRRMode(
|
||||
nsIRequest::TRRMode* aEffectiveTRRMode) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Http2StreamTunnel::GetTrrSkipReason(
|
||||
nsITRRSkipReason::value* aTrrSkipReason) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Http2StreamTunnel::IsAlive(bool* aAlive) {
|
||||
RefPtr<Http2Session> session = Session();
|
||||
|
|
|
@ -143,6 +143,8 @@ class HttpConnectionBase : public nsSupportsWeakReference {
|
|||
virtual nsresult GetSelfAddr(NetAddr* addr) = 0;
|
||||
virtual nsresult GetPeerAddr(NetAddr* addr) = 0;
|
||||
virtual bool ResolvedByTRR() = 0;
|
||||
virtual nsIRequest::TRRMode EffectiveTRRMode() = 0;
|
||||
virtual TRRSkippedReason TRRSkipReason() = 0;
|
||||
virtual bool GetEchConfigUsed() = 0;
|
||||
virtual PRIntervalTime LastWriteTime() = 0;
|
||||
|
||||
|
|
|
@ -77,6 +77,8 @@ nsresult HttpConnectionUDP::Init(nsHttpConnectionInfo* info,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
dnsAddrRecord->IsTRR(&mResolvedByTRR);
|
||||
dnsAddrRecord->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
dnsAddrRecord->GetTrrSkipReason(&mTRRSkipReason);
|
||||
NetAddr peerAddr;
|
||||
nsresult rv = dnsAddrRecord->GetNextAddr(mConnInfo->GetRoutedHost().IsEmpty()
|
||||
? mConnInfo->OriginPort()
|
||||
|
@ -675,5 +677,11 @@ nsresult HttpConnectionUDP::GetPeerAddr(NetAddr* addr) {
|
|||
|
||||
bool HttpConnectionUDP::ResolvedByTRR() { return mResolvedByTRR; }
|
||||
|
||||
nsIRequest::TRRMode HttpConnectionUDP::EffectiveTRRMode() {
|
||||
return mEffectiveTRRMode;
|
||||
}
|
||||
|
||||
TRRSkippedReason HttpConnectionUDP::TRRSkipReason() { return mTRRSkipReason; }
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -84,6 +84,8 @@ class HttpConnectionUDP final : public HttpConnectionBase,
|
|||
nsresult GetSelfAddr(NetAddr* addr) override;
|
||||
nsresult GetPeerAddr(NetAddr* addr) override;
|
||||
bool ResolvedByTRR() override;
|
||||
nsIRequest::TRRMode EffectiveTRRMode() override;
|
||||
TRRSkippedReason TRRSkipReason() override;
|
||||
bool GetEchConfigUsed() override { return false; }
|
||||
|
||||
private:
|
||||
|
@ -116,6 +118,8 @@ class HttpConnectionUDP final : public HttpConnectionBase,
|
|||
nsCOMPtr<nsINetAddr> mSelfAddr;
|
||||
nsCOMPtr<nsINetAddr> mPeerAddr;
|
||||
bool mResolvedByTRR = false;
|
||||
nsIRequest::TRRMode mEffectiveTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
TRRSkippedReason mTRRSkipReason = nsITRRSkipReason::TRR_UNSET;
|
||||
|
||||
private:
|
||||
// Http3
|
||||
|
|
|
@ -470,12 +470,25 @@ HttpTransactionChild::OnStartRequest(nsIRequest* aRequest) {
|
|||
int32_t proxyConnectResponseCode =
|
||||
mTransaction->GetProxyConnectResponseCode();
|
||||
|
||||
nsIRequest::TRRMode mode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
TRRSkippedReason reason = nsITRRSkipReason::TRR_UNSET;
|
||||
{
|
||||
NetAddr selfAddr;
|
||||
NetAddr peerAddr;
|
||||
bool isTrr = false;
|
||||
bool echConfigUsed = false;
|
||||
if (mTransaction) {
|
||||
mTransaction->GetNetworkAddresses(selfAddr, peerAddr, isTrr, mode, reason,
|
||||
echConfigUsed);
|
||||
}
|
||||
}
|
||||
|
||||
Unused << SendOnStartRequest(
|
||||
status, optionalHead, securityInfo, mTransaction->ProxyConnectFailed(),
|
||||
ToTimingStructArgs(mTransaction->Timings()), proxyConnectResponseCode,
|
||||
dataForSniffer, optionalAltSvcUsed, !!mDataBridgeParent,
|
||||
mTransaction->TakeRestartedState(), mTransaction->HTTPSSVCReceivedStage(),
|
||||
mTransaction->GetSupportsHTTP3());
|
||||
mTransaction->GetSupportsHTTP3(), mode, reason);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -582,8 +595,10 @@ HttpTransactionChild::OnTransportStatus(nsITransport* aTransport,
|
|||
NetAddr peerAddr;
|
||||
bool isTrr = false;
|
||||
bool echConfigUsed = false;
|
||||
nsIRequest::TRRMode mode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
TRRSkippedReason reason = nsITRRSkipReason::TRR_UNSET;
|
||||
if (mTransaction) {
|
||||
mTransaction->GetNetworkAddresses(selfAddr, peerAddr, isTrr,
|
||||
mTransaction->GetNetworkAddresses(selfAddr, peerAddr, isTrr, mode, reason,
|
||||
echConfigUsed);
|
||||
} else {
|
||||
nsCOMPtr<nsISocketTransport> socketTransport =
|
||||
|
@ -592,10 +607,12 @@ HttpTransactionChild::OnTransportStatus(nsITransport* aTransport,
|
|||
socketTransport->GetSelfAddr(&selfAddr);
|
||||
socketTransport->GetPeerAddr(&peerAddr);
|
||||
socketTransport->ResolvedByTRR(&isTrr);
|
||||
socketTransport->GetEffectiveTRRMode(&mode);
|
||||
socketTransport->GetTrrSkipReason(&reason);
|
||||
socketTransport->GetEchConfigUsed(&echConfigUsed);
|
||||
}
|
||||
}
|
||||
arg.emplace(selfAddr, peerAddr, isTrr, echConfigUsed);
|
||||
arg.emplace(selfAddr, peerAddr, isTrr, mode, reason, echConfigUsed);
|
||||
}
|
||||
|
||||
Unused << SendOnTransportStatus(aStatus, aProgress, aProgressMax, arg);
|
||||
|
|
|
@ -266,12 +266,15 @@ void HttpTransactionParent::SetDNSWasRefreshed() {
|
|||
Unused << SendSetDNSWasRefreshed();
|
||||
}
|
||||
|
||||
void HttpTransactionParent::GetNetworkAddresses(NetAddr& self, NetAddr& peer,
|
||||
bool& aResolvedByTRR,
|
||||
bool& aEchConfigUsed) {
|
||||
void HttpTransactionParent::GetNetworkAddresses(
|
||||
NetAddr& self, NetAddr& peer, bool& aResolvedByTRR,
|
||||
nsIRequest::TRRMode& aEffectiveTRRMode, TRRSkippedReason& aSkipReason,
|
||||
bool& aEchConfigUsed) {
|
||||
self = mSelfAddr;
|
||||
peer = mPeerAddr;
|
||||
aResolvedByTRR = mResolvedByTRR;
|
||||
aEffectiveTRRMode = mEffectiveTRRMode;
|
||||
aSkipReason = mTRRSkipReason;
|
||||
aEchConfigUsed = mEchConfigUsed;
|
||||
}
|
||||
|
||||
|
@ -410,19 +413,21 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStartRequest(
|
|||
const TimingStructArgs& aTimings, const int32_t& aProxyConnectResponseCode,
|
||||
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed,
|
||||
const bool& aDataToChildProcess, const bool& aRestarted,
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3) {
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3,
|
||||
const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aTrrSkipReason) {
|
||||
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
|
||||
this, [self = UnsafePtr<HttpTransactionParent>(this), aStatus,
|
||||
aResponseHead, securityInfo = nsCOMPtr{aSecurityInfo},
|
||||
aProxyConnectFailed, aTimings, aProxyConnectResponseCode,
|
||||
aDataForSniffer = CopyableTArray{std::move(aDataForSniffer)},
|
||||
aAltSvcUsed, aDataToChildProcess, aRestarted,
|
||||
aHTTPSSVCReceivedStage, aSupportsHttp3]() mutable {
|
||||
this,
|
||||
[self = UnsafePtr<HttpTransactionParent>(this), aStatus, aResponseHead,
|
||||
securityInfo = nsCOMPtr{aSecurityInfo}, aProxyConnectFailed, aTimings,
|
||||
aProxyConnectResponseCode,
|
||||
aDataForSniffer = CopyableTArray{std::move(aDataForSniffer)},
|
||||
aAltSvcUsed, aDataToChildProcess, aRestarted, aHTTPSSVCReceivedStage,
|
||||
aSupportsHttp3, aMode, aTrrSkipReason]() mutable {
|
||||
self->DoOnStartRequest(
|
||||
aStatus, aResponseHead, securityInfo, aProxyConnectFailed, aTimings,
|
||||
aProxyConnectResponseCode, std::move(aDataForSniffer), aAltSvcUsed,
|
||||
aDataToChildProcess, aRestarted, aHTTPSSVCReceivedStage,
|
||||
aSupportsHttp3);
|
||||
aSupportsHttp3, aMode, aTrrSkipReason);
|
||||
}));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -451,7 +456,8 @@ void HttpTransactionParent::DoOnStartRequest(
|
|||
const TimingStructArgs& aTimings, const int32_t& aProxyConnectResponseCode,
|
||||
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed,
|
||||
const bool& aDataToChildProcess, const bool& aRestarted,
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3) {
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3,
|
||||
const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason) {
|
||||
LOG(("HttpTransactionParent::DoOnStartRequest [this=%p aStatus=%" PRIx32
|
||||
"]\n",
|
||||
this, static_cast<uint32_t>(aStatus)));
|
||||
|
@ -466,6 +472,8 @@ void HttpTransactionParent::DoOnStartRequest(
|
|||
mDataSentToChildProcess = aDataToChildProcess;
|
||||
mHTTPSSVCReceivedStage = aHTTPSSVCReceivedStage;
|
||||
mSupportsHTTP3 = aSupportsHttp3;
|
||||
mEffectiveTRRMode = aMode;
|
||||
mTRRSkipReason = aSkipReason;
|
||||
|
||||
mSecurityInfo = aSecurityInfo;
|
||||
|
||||
|
@ -505,6 +513,8 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnTransportStatus(
|
|||
mSelfAddr = aNetworkAddressArg->selfAddr();
|
||||
mPeerAddr = aNetworkAddressArg->peerAddr();
|
||||
mResolvedByTRR = aNetworkAddressArg->resolvedByTRR();
|
||||
mEffectiveTRRMode = aNetworkAddressArg->mode();
|
||||
mTRRSkipReason = aNetworkAddressArg->trrSkipReason();
|
||||
mEchConfigUsed = aNetworkAddressArg->echConfigUsed();
|
||||
}
|
||||
mEventsink->OnTransportStatus(nullptr, aStatus, aProgress, aProgressMax);
|
||||
|
|
|
@ -54,7 +54,8 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
const int32_t& aProxyConnectResponseCode,
|
||||
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed,
|
||||
const bool& aDataToChildProcess, const bool& aRestarted,
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3);
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3,
|
||||
const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason);
|
||||
mozilla::ipc::IPCResult RecvOnTransportStatus(
|
||||
const nsresult& aStatus, const int64_t& aProgress,
|
||||
const int64_t& aProgressMax,
|
||||
|
@ -103,7 +104,8 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
const int32_t& aProxyConnectResponseCode,
|
||||
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed,
|
||||
const bool& aDataToChildProcess, const bool& aRestarted,
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3);
|
||||
const uint32_t& aHTTPSSVCReceivedStage, const bool& aSupportsHttp3,
|
||||
const nsIRequest::TRRMode& aMode, const TRRSkippedReason& aSkipReason);
|
||||
void DoOnDataAvailable(const nsCString& aData, const uint64_t& aOffset,
|
||||
const uint32_t& aCount);
|
||||
void DoOnStopRequest(
|
||||
|
@ -143,6 +145,8 @@ class HttpTransactionParent final : public PHttpTransactionParent,
|
|||
bool mOnStartRequestCalled{false};
|
||||
bool mOnStopRequestCalled{false};
|
||||
bool mResolvedByTRR{false};
|
||||
nsIRequest::TRRMode mEffectiveTRRMode{nsIRequest::TRR_DEFAULT_MODE};
|
||||
TRRSkippedReason mTRRSkipReason{nsITRRSkipReason::TRR_UNSET};
|
||||
bool mEchConfigUsed = false;
|
||||
int32_t mProxyConnectResponseCode{0};
|
||||
uint64_t mChannelId{0};
|
||||
|
|
|
@ -112,6 +112,8 @@ class HttpTransactionShell : public nsISupports {
|
|||
|
||||
virtual void GetNetworkAddresses(NetAddr& self, NetAddr& peer,
|
||||
bool& aResolvedByTRR,
|
||||
nsIRequest::TRRMode& aEffectiveTRRMode,
|
||||
TRRSkippedReason& aSkipReason,
|
||||
bool& aEchConfigUsed) = 0;
|
||||
|
||||
// Functions for Timing interface
|
||||
|
@ -192,9 +194,10 @@ NS_DEFINE_STATIC_IID_ACCESSOR(HttpTransactionShell, HTTPTRANSACTIONSHELL_IID)
|
|||
virtual already_AddRefed<nsITransportSecurityInfo> SecurityInfo() override; \
|
||||
virtual void SetSecurityCallbacks(nsIInterfaceRequestor* aCallbacks) \
|
||||
override; \
|
||||
virtual void GetNetworkAddresses(NetAddr& self, NetAddr& peer, \
|
||||
bool& aResolvedByTRR, bool& aEchConfigUsed) \
|
||||
override; \
|
||||
virtual void GetNetworkAddresses( \
|
||||
NetAddr& self, NetAddr& peer, bool& aResolvedByTRR, \
|
||||
nsIRequest::TRRMode& aEffectiveTRRMode, TRRSkippedReason& aSkipReason, \
|
||||
bool& aEchConfigUsed) override; \
|
||||
virtual mozilla::TimeStamp GetDomainLookupStart() override; \
|
||||
virtual mozilla::TimeStamp GetDomainLookupEnd() override; \
|
||||
virtual mozilla::TimeStamp GetConnectStart() override; \
|
||||
|
|
|
@ -20,6 +20,8 @@ using class mozilla::net::nsHttpHeaderArray from "nsHttpHeaderArray.h";
|
|||
using mozilla::net::NetAddr from "mozilla/net/DNS.h";
|
||||
using mozilla::net::ClassOfService from "mozilla/net/ClassOfService.h";
|
||||
[RefCounted] using class nsITransportSecurityInfo from "nsITransportSecurityInfo.h";
|
||||
using mozilla::net::TRRSkippedReason from "nsITRRSkipReason.h";
|
||||
using nsIRequest::TRRMode from "nsIRequest.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -33,6 +35,8 @@ struct NetworkAddressArg {
|
|||
NetAddr selfAddr;
|
||||
NetAddr peerAddr;
|
||||
bool resolvedByTRR;
|
||||
TRRMode mode;
|
||||
TRRSkippedReason trrSkipReason;
|
||||
bool echConfigUsed;
|
||||
};
|
||||
|
||||
|
@ -52,7 +56,9 @@ parent:
|
|||
bool dataToChildProcess,
|
||||
bool restarted,
|
||||
uint32_t HTTPSSVCReceivedStage,
|
||||
bool supportsHttp3);
|
||||
bool supportsHttp3,
|
||||
TRRMode trrMode,
|
||||
TRRSkippedReason trrSkipReason);
|
||||
async OnTransportStatus(nsresult status,
|
||||
int64_t progress,
|
||||
int64_t progressMax,
|
||||
|
|
|
@ -535,6 +535,22 @@ TLSTransportLayer::ResolvedByTRR(bool* aResolvedByTRR) {
|
|||
return mSocketTransport->ResolvedByTRR(aResolvedByTRR);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TLSTransportLayer::GetEffectiveTRRMode(
|
||||
nsIRequest::TRRMode* aEffectiveTRRMode) {
|
||||
if (!mSocketTransport) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mSocketTransport->GetEffectiveTRRMode(aEffectiveTRRMode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TLSTransportLayer::GetTrrSkipReason(
|
||||
nsITRRSkipReason::value* aTrrSkipReason) {
|
||||
if (!mSocketTransport) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return mSocketTransport->GetTrrSkipReason(aTrrSkipReason);
|
||||
}
|
||||
|
||||
#define FWD_TS_PTR(fx, ts) \
|
||||
NS_IMETHODIMP \
|
||||
TLSTransportLayer::fx(ts* arg) { \
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsAHttpTransaction.h"
|
||||
#include "Http3WebTransportSession.h"
|
||||
#include "HttpTrafficAnalyzer.h"
|
||||
#include "nsIRequest.h"
|
||||
|
||||
class nsIAsyncInputStream;
|
||||
class nsIAsyncOutputStream;
|
||||
|
@ -168,6 +169,8 @@ class nsAHttpConnection : public nsISupports {
|
|||
virtual nsresult GetSelfAddr(NetAddr* addr) = 0;
|
||||
virtual nsresult GetPeerAddr(NetAddr* addr) = 0;
|
||||
virtual bool ResolvedByTRR() = 0;
|
||||
virtual nsIRequest::TRRMode EffectiveTRRMode() = 0;
|
||||
virtual nsITRRSkipReason::value TRRSkipReason() = 0;
|
||||
virtual bool GetEchConfigUsed() = 0;
|
||||
virtual PRIntervalTime LastWriteTime() = 0;
|
||||
};
|
||||
|
@ -263,6 +266,14 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsAHttpConnection, NS_AHTTPCONNECTION_IID)
|
|||
bool ResolvedByTRR() override { \
|
||||
return (!(fwdObject)) ? false : (fwdObject)->ResolvedByTRR(); \
|
||||
} \
|
||||
nsIRequest::TRRMode EffectiveTRRMode() override { \
|
||||
return (!(fwdObject)) ? nsIRequest::TRR_DEFAULT_MODE \
|
||||
: (fwdObject)->EffectiveTRRMode(); \
|
||||
} \
|
||||
nsITRRSkipReason::value TRRSkipReason() override { \
|
||||
return (!(fwdObject)) ? nsITRRSkipReason::TRR_UNSET \
|
||||
: (fwdObject)->TRRSkipReason(); \
|
||||
} \
|
||||
bool GetEchConfigUsed() override { \
|
||||
return (!(fwdObject)) ? false : (fwdObject)->GetEchConfigUsed(); \
|
||||
} \
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "nsTArray.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIRequest.h"
|
||||
#include "nsITRRSkipReason.h"
|
||||
|
||||
#ifdef Status
|
||||
/* Xlib headers insist on this for some reason... Nuke it because
|
||||
|
@ -181,6 +183,8 @@ class nsAHttpTransaction : public nsSupportsWeakReference {
|
|||
virtual void ReuseConnectionOnRestartOK(bool) {}
|
||||
virtual void SetIsHttp2Websocket(bool) {}
|
||||
virtual bool IsHttp2Websocket() { return false; }
|
||||
virtual void SetTRRInfo(nsIRequest::TRRMode aMode,
|
||||
TRRSkippedReason aSkipReason){};
|
||||
|
||||
// We call this function if we want to use alt-svc host again on the next
|
||||
// restart. If this function is not called on the next restart the
|
||||
|
|
|
@ -356,6 +356,20 @@ void nsHttpChannel::ReleaseMainThreadOnlyReferences() {
|
|||
arrayToRelease.AppendElement(mPreflightChannel.forget());
|
||||
arrayToRelease.AppendElement(mDNSPrefetch.forget());
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
!mEarlyHintObserver,
|
||||
"Early hint observer should have been released in ReleaseListeners()");
|
||||
arrayToRelease.AppendElement(mEarlyHintObserver.forget());
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
!mChannelClassifier,
|
||||
"Channel classifier should have been released in ReleaseListeners()");
|
||||
arrayToRelease.AppendElement(
|
||||
mChannelClassifier.forget().downcast<nsIURIClassifierCallback>());
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
!mWarningReporter,
|
||||
"Warning reporter should have been released in ReleaseListeners()");
|
||||
arrayToRelease.AppendElement(mWarningReporter.forget());
|
||||
|
||||
NS_DispatchToMainThread(new ProxyReleaseRunnable(std::move(arrayToRelease)));
|
||||
}
|
||||
|
||||
|
@ -6455,8 +6469,7 @@ nsresult nsHttpChannel::MaybeStartDNSPrefetch() {
|
|||
mDNSPrefetch =
|
||||
new nsDNSPrefetch(mURI, originAttributes, nsIRequest::GetTRRMode(),
|
||||
this, LoadTimingEnabled());
|
||||
nsIDNSService::DNSFlags dnsFlags =
|
||||
nsIDNSService::RESOLVE_WANT_RECORD_ON_ERROR;
|
||||
nsIDNSService::DNSFlags dnsFlags = nsIDNSService::RESOLVE_DEFAULT_FLAGS;
|
||||
if (mCaps & NS_HTTP_REFRESH_DNS) {
|
||||
dnsFlags |= nsIDNSService::RESOLVE_BYPASS_CACHE;
|
||||
}
|
||||
|
@ -7112,6 +7125,12 @@ nsHttpChannel::OnStartRequest(nsIRequest* request) {
|
|||
|
||||
StoreLoadedBySocketProcess(mTransaction->AsHttpTransactionParent() !=
|
||||
nullptr);
|
||||
|
||||
bool isTrr;
|
||||
bool echConfigUsed;
|
||||
mTransaction->GetNetworkAddresses(mSelfAddr, mPeerAddr, isTrr,
|
||||
mEffectiveTRRMode, mTRRSkipReason,
|
||||
echConfigUsed);
|
||||
}
|
||||
|
||||
// don't enter this block if we're reading from the cache...
|
||||
|
@ -8166,6 +8185,7 @@ nsHttpChannel::OnTransportStatus(nsITransport* trans, nsresult status,
|
|||
bool echConfigUsed = false;
|
||||
if (mTransaction) {
|
||||
mTransaction->GetNetworkAddresses(mSelfAddr, mPeerAddr, isTrr,
|
||||
mEffectiveTRRMode, mTRRSkipReason,
|
||||
echConfigUsed);
|
||||
} else {
|
||||
nsCOMPtr<nsISocketTransport> socketTransport = do_QueryInterface(trans);
|
||||
|
@ -8173,9 +8193,12 @@ nsHttpChannel::OnTransportStatus(nsITransport* trans, nsresult status,
|
|||
socketTransport->GetSelfAddr(&mSelfAddr);
|
||||
socketTransport->GetPeerAddr(&mPeerAddr);
|
||||
socketTransport->ResolvedByTRR(&isTrr);
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
socketTransport->GetEffectiveTRRMode(&mEffectiveTRRMode));
|
||||
socketTransport->GetEchConfigUsed(&echConfigUsed);
|
||||
}
|
||||
}
|
||||
|
||||
StoreResolvedByTRR(isTrr);
|
||||
StoreEchConfigUsed(echConfigUsed);
|
||||
}
|
||||
|
@ -8697,11 +8720,6 @@ nsHttpChannel::OnLookupComplete(nsICancelable* request, nsIDNSRecord* rec,
|
|||
nsresult status) {
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Expecting DNS callback on main thread.");
|
||||
|
||||
if (nsCOMPtr<nsIDNSAddrRecord> r = do_QueryInterface(rec)) {
|
||||
r->GetEffectiveTRRMode(&mEffectiveTRRMode);
|
||||
r->GetTrrSkipReason(&mTRRSkipReason);
|
||||
}
|
||||
|
||||
LOG(
|
||||
("nsHttpChannel::OnLookupComplete [this=%p] prefetch complete%s: "
|
||||
"%s status[0x%" PRIx32 "]\n",
|
||||
|
|
|
@ -2326,6 +2326,22 @@ bool nsHttpConnection::ResolvedByTRR() {
|
|||
return val;
|
||||
}
|
||||
|
||||
nsIRequest::TRRMode nsHttpConnection::EffectiveTRRMode() {
|
||||
nsIRequest::TRRMode mode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
if (mSocketTransport) {
|
||||
mSocketTransport->GetEffectiveTRRMode(&mode);
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
TRRSkippedReason nsHttpConnection::TRRSkipReason() {
|
||||
TRRSkippedReason reason = nsITRRSkipReason::TRR_UNSET;
|
||||
if (mSocketTransport) {
|
||||
mSocketTransport->GetTrrSkipReason(&reason);
|
||||
}
|
||||
return reason;
|
||||
}
|
||||
|
||||
bool nsHttpConnection::GetEchConfigUsed() {
|
||||
bool val = false;
|
||||
if (mSocketTransport) {
|
||||
|
|
|
@ -184,7 +184,8 @@ class nsHttpConnection final : public HttpConnectionBase,
|
|||
nsresult GetPeerAddr(NetAddr* addr) override;
|
||||
bool ResolvedByTRR() override;
|
||||
bool GetEchConfigUsed() override;
|
||||
|
||||
nsIRequest::TRRMode EffectiveTRRMode() override;
|
||||
TRRSkippedReason TRRSkipReason() override;
|
||||
bool IsForWebSocket() { return mForWebSocket; }
|
||||
|
||||
// The following functions are related to setting up a tunnel.
|
||||
|
|
|
@ -579,6 +579,8 @@ void nsHttpTransaction::OnTransportStatus(nsITransport* transport,
|
|||
mConnection->GetSelfAddr(&mSelfAddr);
|
||||
mConnection->GetPeerAddr(&mPeerAddr);
|
||||
mResolvedByTRR = mConnection->ResolvedByTRR();
|
||||
mEffectiveTRRMode = mConnection->EffectiveTRRMode();
|
||||
mTRRSkipReason = mConnection->TRRSkipReason();
|
||||
mEchConfigUsed = mConnection->GetEchConfigUsed();
|
||||
}
|
||||
}
|
||||
|
@ -2953,13 +2955,16 @@ nsHttpTransaction::OnOutputStreamReady(nsIAsyncOutputStream* out) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHttpTransaction::GetNetworkAddresses(NetAddr& self, NetAddr& peer,
|
||||
bool& aResolvedByTRR,
|
||||
bool& aEchConfigUsed) {
|
||||
void nsHttpTransaction::GetNetworkAddresses(
|
||||
NetAddr& self, NetAddr& peer, bool& aResolvedByTRR,
|
||||
nsIRequest::TRRMode& aEffectiveTRRMode, TRRSkippedReason& aSkipReason,
|
||||
bool& aEchConfigUsed) {
|
||||
MutexAutoLock lock(mLock);
|
||||
self = mSelfAddr;
|
||||
peer = mPeerAddr;
|
||||
aResolvedByTRR = mResolvedByTRR;
|
||||
aEffectiveTRRMode = mEffectiveTRRMode;
|
||||
aSkipReason = mTRRSkipReason;
|
||||
aEchConfigUsed = mEchConfigUsed;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,12 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
void SetIsHttp2Websocket(bool h2ws) override { mIsHttp2Websocket = h2ws; }
|
||||
bool IsHttp2Websocket() override { return mIsHttp2Websocket; }
|
||||
|
||||
void SetTRRInfo(nsIRequest::TRRMode aMode,
|
||||
TRRSkippedReason aSkipReason) override {
|
||||
mEffectiveTRRMode = aMode;
|
||||
mTRRSkipReason = aSkipReason;
|
||||
}
|
||||
|
||||
bool WaitingForHTTPSRR() const { return mCaps & NS_HTTP_FORCE_WAIT_HTTP_RR; }
|
||||
void MakeDontWaitHTTPSRR() { mCaps &= ~NS_HTTP_FORCE_WAIT_HTTP_RR; }
|
||||
|
||||
|
@ -530,6 +536,9 @@ class nsHttpTransaction final : public nsAHttpTransaction,
|
|||
NetAddr mSelfAddr;
|
||||
NetAddr mPeerAddr;
|
||||
bool mResolvedByTRR{false};
|
||||
Atomic<nsIRequest::TRRMode, Relaxed> mEffectiveTRRMode{
|
||||
nsIRequest::TRR_DEFAULT_MODE};
|
||||
Atomic<TRRSkippedReason, Relaxed> mTRRSkipReason{nsITRRSkipReason::TRR_UNSET};
|
||||
bool mEchConfigUsed = false;
|
||||
|
||||
bool m0RTTInProgress{false};
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
let trrServer = null;
|
||||
add_setup(async function setup() {
|
||||
if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
trr_test_setup();
|
||||
Services.prefs.setBoolPref("network.dns.disablePrefetch", true);
|
||||
registerCleanupFunction(async () => {
|
||||
Services.prefs.clearUserPref("network.dns.disablePrefetch");
|
||||
trr_clear_prefs();
|
||||
});
|
||||
|
||||
trrServer = new TRRServer();
|
||||
registerCleanupFunction(async () => {
|
||||
await trrServer.stop();
|
||||
});
|
||||
await trrServer.start();
|
||||
|
||||
Services.prefs.setCharPref(
|
||||
"network.trr.uri",
|
||||
`https://foo.example.com:${trrServer.port}/dns-query`
|
||||
);
|
||||
Services.prefs.setIntPref("network.trr.mode", Ci.nsIDNSService.MODE_TRRONLY);
|
||||
|
||||
let certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(
|
||||
Ci.nsIX509CertDB
|
||||
);
|
||||
addCertFromFile(certdb, "http2-ca.pem", "CTu,u,u");
|
||||
|
||||
await trrServer.registerDoHAnswers(`myfoo.test`, "A", {
|
||||
answers: [],
|
||||
});
|
||||
|
||||
await trrServer.registerDoHAnswers(`alt1.example.com`, "A", {
|
||||
answers: [
|
||||
{
|
||||
name: "alt1.example.com",
|
||||
ttl: 55,
|
||||
type: "A",
|
||||
flush: false,
|
||||
data: "127.0.0.1",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_failure() {
|
||||
let req = await new Promise(resolve => {
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: `http://myfoo.test/`,
|
||||
loadUsingSystemPrincipal: true,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE));
|
||||
});
|
||||
|
||||
equal(req.status, Cr.NS_ERROR_UNKNOWN_HOST);
|
||||
equal(
|
||||
req.QueryInterface(Ci.nsIHttpChannelInternal).effectiveTRRMode,
|
||||
Ci.nsIRequest.TRR_ONLY_MODE
|
||||
);
|
||||
equal(
|
||||
req.QueryInterface(Ci.nsIHttpChannelInternal).trrSkipReason,
|
||||
Ci.nsITRRSkipReason.TRR_NO_ANSWERS
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_success() {
|
||||
let httpServer = new NodeHTTP2Server();
|
||||
await httpServer.start();
|
||||
await httpServer.registerPathHandler("/", (req, resp) => {
|
||||
resp.writeHead(200);
|
||||
resp.end("done");
|
||||
});
|
||||
registerCleanupFunction(async () => {
|
||||
await httpServer.stop();
|
||||
});
|
||||
|
||||
let req = await new Promise(resolve => {
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: `https://alt1.example.com:${httpServer.port()}/`,
|
||||
loadUsingSystemPrincipal: true,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
||||
});
|
||||
|
||||
equal(req.status, Cr.NS_OK);
|
||||
equal(
|
||||
req.QueryInterface(Ci.nsIHttpChannelInternal).effectiveTRRMode,
|
||||
Ci.nsIRequest.TRR_ONLY_MODE
|
||||
);
|
||||
equal(
|
||||
req.QueryInterface(Ci.nsIHttpChannelInternal).trrSkipReason,
|
||||
Ci.nsITRRSkipReason.TRR_OK
|
||||
);
|
||||
|
||||
// Another request to check connection reuse
|
||||
req = await new Promise(resolve => {
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: `https://alt1.example.com:${httpServer.port()}/second`,
|
||||
loadUsingSystemPrincipal: true,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.asyncOpen(new ChannelListener(resolve, null, CL_ALLOW_UNKNOWN_CL));
|
||||
});
|
||||
|
||||
equal(req.status, Cr.NS_OK);
|
||||
equal(
|
||||
req.QueryInterface(Ci.nsIHttpChannelInternal).effectiveTRRMode,
|
||||
Ci.nsIRequest.TRR_ONLY_MODE
|
||||
);
|
||||
equal(
|
||||
req.QueryInterface(Ci.nsIHttpChannelInternal).trrSkipReason,
|
||||
Ci.nsITRRSkipReason.TRR_OK
|
||||
);
|
||||
});
|
|
@ -757,3 +757,4 @@ run-sequentially = http3server
|
|||
[test_websocket_500k.js]
|
||||
skip-if = verify
|
||||
run-sequentially = node server exceptions dont replay well
|
||||
[test_trr_noPrefetch.js]
|
||||
|
|
|
@ -90,5 +90,3 @@ FINAL_LIBRARY = "xul"
|
|||
LOCAL_INCLUDES += [
|
||||
"/dom/base",
|
||||
]
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#ifndef nsHtml5AutoPauseUpdate_h
|
||||
#define nsHtml5AutoPauseUpdate_h
|
||||
|
||||
#include "nsHtml5DocumentBuilder.h"
|
||||
|
||||
class MOZ_RAII nsHtml5AutoPauseUpdate final {
|
||||
private:
|
||||
RefPtr<nsHtml5DocumentBuilder> mBuilder;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "nsHtml5Parser.h"
|
||||
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsContentUtils.h" // for kLoadAsData
|
||||
#include "nsHtml5AtomTable.h"
|
||||
|
@ -410,10 +411,11 @@ nsresult nsHtml5Parser::Parse(const nsAString& aSourceBuffer, void* aKey,
|
|||
if (!mDocWriteSpeculativeTreeBuilder) {
|
||||
// Lazily initialize if uninitialized
|
||||
mDocWriteSpeculativeTreeBuilder =
|
||||
MakeUnique<nsHtml5TreeBuilder>(nullptr, executor->GetStage(), true);
|
||||
mozilla::MakeUnique<nsHtml5TreeBuilder>(nullptr,
|
||||
executor->GetStage(), true);
|
||||
mDocWriteSpeculativeTreeBuilder->setScriptingEnabled(
|
||||
mTreeBuilder->isScriptingEnabled());
|
||||
mDocWriteSpeculativeTokenizer = MakeUnique<nsHtml5Tokenizer>(
|
||||
mDocWriteSpeculativeTokenizer = mozilla::MakeUnique<nsHtml5Tokenizer>(
|
||||
mDocWriteSpeculativeTreeBuilder.get(), false);
|
||||
mDocWriteSpeculativeTokenizer->setInterner(&mAtomTable);
|
||||
mDocWriteSpeculativeTokenizer->start();
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "nsAtom.h"
|
||||
#include "nsHtml5AtomTable.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5String.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsIContent.h"
|
||||
|
|
|
@ -150,7 +150,8 @@ nsHtml5String nsHtml5String::FromLiteral(const char* aLiteral) {
|
|||
MOZ_CRASH("Out of memory.");
|
||||
}
|
||||
char16_t* data = reinterpret_cast<char16_t*>(buffer->Data());
|
||||
ConvertAsciitoUtf16(Span(aLiteral, length), Span(data, length));
|
||||
ConvertAsciitoUtf16(mozilla::Span(aLiteral, length),
|
||||
mozilla::Span(data, length));
|
||||
data[length] = 0;
|
||||
return nsHtml5String(reinterpret_cast<uintptr_t>(buffer.forget().take()) |
|
||||
eStringBuffer);
|
||||
|
|
|
@ -79,7 +79,7 @@ void nsHtml5Tokenizer::StartPlainText() {
|
|||
}
|
||||
|
||||
void nsHtml5Tokenizer::EnableViewSource(nsHtml5Highlighter* aHighlighter) {
|
||||
mViewSource = WrapUnique(aHighlighter);
|
||||
mViewSource = mozilla::WrapUnique(aHighlighter);
|
||||
}
|
||||
|
||||
bool nsHtml5Tokenizer::ShouldFlushViewSource() {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
|
||||
nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsHtml5OplessBuilder* aBuilder)
|
||||
: mode(0),
|
||||
|
@ -179,7 +180,7 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
|
|||
if (nsGkAtoms::img == aName) {
|
||||
nsHtml5String loading =
|
||||
aAttributes->getValue(nsHtml5AttributeName::ATTR_LOADING);
|
||||
if (!StaticPrefs::dom_image_lazy_loading_enabled() ||
|
||||
if (!mozilla::StaticPrefs::dom_image_lazy_loading_enabled() ||
|
||||
!loading.LowerCaseEqualsASCII("lazy")) {
|
||||
nsHtml5String url =
|
||||
aAttributes->getValue(nsHtml5AttributeName::ATTR_SRC);
|
||||
|
@ -281,7 +282,7 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
|
|||
mSpeculativeLoadQueue.AppendElement()->InitPreconnect(
|
||||
url, crossOrigin);
|
||||
}
|
||||
} else if (StaticPrefs::network_preload() &&
|
||||
} else if (mozilla::StaticPrefs::network_preload() &&
|
||||
rel.LowerCaseEqualsASCII("preload")) {
|
||||
nsHtml5String url =
|
||||
aAttributes->getValue(nsHtml5AttributeName::ATTR_HREF);
|
||||
|
@ -760,7 +761,8 @@ void nsHtml5TreeBuilder::appendCharacters(nsIContentHandle* aParent,
|
|||
memcpy(bufferCopy.get(), aBuffer, aLength * sizeof(char16_t));
|
||||
|
||||
if (mImportScanner.ShouldScan()) {
|
||||
nsTArray<nsString> imports = mImportScanner.Scan(Span(aBuffer, aLength));
|
||||
nsTArray<nsString> imports =
|
||||
mImportScanner.Scan(mozilla::Span(aBuffer, aLength));
|
||||
for (nsString& url : imports) {
|
||||
mSpeculativeLoadQueue.AppendElement()->InitImportStyle(std::move(url));
|
||||
}
|
||||
|
@ -1232,7 +1234,7 @@ mozilla::Result<bool, nsresult> nsHtml5TreeBuilder::Flush(bool aDiscretionary) {
|
|||
"as broken.");
|
||||
}
|
||||
if (!mOpSink->MoveOpsFrom(mOpQueue)) {
|
||||
return Err(NS_ERROR_OUT_OF_MEMORY);
|
||||
return mozilla::Err(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
return hasOps;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsINestedURI.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
@ -221,7 +222,7 @@ nsHtml5TreeOpExecutor::DidBuildModel(bool aTerminated) {
|
|||
// Gather telemetry only for top-level content navigations in order to
|
||||
// avoid noise from ad iframes.
|
||||
bool topLevel = false;
|
||||
if (BrowsingContext* bc = mDocument->GetBrowsingContext()) {
|
||||
if (mozilla::dom::BrowsingContext* bc = mDocument->GetBrowsingContext()) {
|
||||
topLevel = bc->IsTopContent();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/dom/Comment.h"
|
||||
#include "mozilla/dom/CustomElementRegistry.h"
|
||||
#include "mozilla/dom/DocGroup.h"
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/LinkStyle.h"
|
||||
|
|
|
@ -15,10 +15,10 @@ nsHtml5HtmlAttributes* nsHtml5ViewSourceUtils::NewBodyAttributes() {
|
|||
bodyAttrs->addAttribute(nsHtml5AttributeName::ATTR_ID, id, -1);
|
||||
|
||||
nsString klass;
|
||||
if (StaticPrefs::view_source_wrap_long_lines()) {
|
||||
if (mozilla::StaticPrefs::view_source_wrap_long_lines()) {
|
||||
klass.AppendLiteral(u"wrap ");
|
||||
}
|
||||
if (StaticPrefs::view_source_syntax_highlight()) {
|
||||
if (mozilla::StaticPrefs::view_source_syntax_highlight()) {
|
||||
klass.AppendLiteral(u"highlight");
|
||||
}
|
||||
if (!klass.IsEmpty()) {
|
||||
|
@ -26,7 +26,7 @@ nsHtml5HtmlAttributes* nsHtml5ViewSourceUtils::NewBodyAttributes() {
|
|||
nsHtml5String::FromString(klass), -1);
|
||||
}
|
||||
|
||||
int32_t tabSize = StaticPrefs::view_source_tab_size();
|
||||
int32_t tabSize = mozilla::StaticPrefs::view_source_tab_size();
|
||||
if (tabSize > 0) {
|
||||
nsString style;
|
||||
style.AssignLiteral("tab-size: ");
|
||||
|
|
|
@ -18,5 +18,3 @@ Library("dummy")
|
|||
UNIFIED_SOURCES += ["test1.c"]
|
||||
|
||||
AllowCompilerWarnings()
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -25,5 +25,3 @@ UNIFIED_SOURCES += ["test1.c"]
|
|||
|
||||
DisableStlWrapping()
|
||||
NoVisibilityFlags()
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -18,5 +18,3 @@ Library("dummy")
|
|||
UNIFIED_SOURCES += ["test1.c"]
|
||||
|
||||
DisableCompilerWarnings()
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -19,5 +19,3 @@ def DisableStlWrapping():
|
|||
UNIFIED_SOURCES += ["test1.c"]
|
||||
|
||||
DisableStlWrapping()
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -19,5 +19,3 @@ def NoVisibilityFlags():
|
|||
UNIFIED_SOURCES += ["test1.c"]
|
||||
|
||||
NoVisibilityFlags()
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -13,12 +13,16 @@
|
|||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozpkix/pkixder.h"
|
||||
#include "mozpkix/pkixtypes.h"
|
||||
#include "mozpkix/pkixutil.h"
|
||||
|
||||
#include "nsDependentString.h"
|
||||
#include "nsString.h"
|
||||
#include "pk11pub.h"
|
||||
#include "mozpkix/pkixtypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace psm {
|
||||
|
||||
struct EVInfo {
|
||||
|
@ -1171,14 +1175,14 @@ static const struct EVInfo kEVInfos[] = {
|
|||
// clang-format on
|
||||
};
|
||||
|
||||
static CertPolicyId sEVInfoIds[ArrayLength(kEVInfos)];
|
||||
static pkix::CertPolicyId sEVInfoIds[ArrayLength(kEVInfos)];
|
||||
static_assert(
|
||||
ArrayLength(sEVInfoIds) == ArrayLength(kEVInfos),
|
||||
"These arrays are used in parallel and must have the same length.");
|
||||
static CertPolicyId sCABForumEVId = {};
|
||||
static pkix::CertPolicyId sCABForumEVId = {};
|
||||
|
||||
bool CertIsAuthoritativeForEVPolicy(const nsTArray<uint8_t>& certBytes,
|
||||
const mozilla::pkix::CertPolicyId& policy) {
|
||||
const pkix::CertPolicyId& policy) {
|
||||
nsTArray<uint8_t> fingerprint;
|
||||
nsresult rv = Digest::DigestBuf(SEC_OID_SHA256, certBytes.Elements(),
|
||||
certBytes.Length(), fingerprint);
|
||||
|
@ -1216,7 +1220,7 @@ nsresult LoadExtendedValidationInfo() {
|
|||
SECSuccess) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (cabforumOIDItem.len > CertPolicyId::MAX_BYTES) {
|
||||
if (cabforumOIDItem.len > pkix::CertPolicyId::MAX_BYTES) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1293,7 @@ nsresult LoadExtendedValidationInfo() {
|
|||
if (srv != SECSuccess) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (evOIDItem.len > CertPolicyId::MAX_BYTES) {
|
||||
if (evOIDItem.len > pkix::CertPolicyId::MAX_BYTES) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
sEVInfoIds[i].numBytes = evOIDItem.len;
|
||||
|
@ -1301,72 +1305,73 @@ nsresult LoadExtendedValidationInfo() {
|
|||
|
||||
// Helper function for GetKnownEVPolicies(): reads an EV Policy if there is one,
|
||||
// and appends it to the given list of CertPolicyIds.
|
||||
void FindMatchingEVPolicy(Reader& idReader,
|
||||
nsTArray<mozilla::pkix::CertPolicyId>& policies) {
|
||||
Input cabForumEVIdBytes;
|
||||
Result rv =
|
||||
void FindMatchingEVPolicy(pkix::Reader& idReader,
|
||||
nsTArray<pkix::CertPolicyId>& policies) {
|
||||
pkix::Input cabForumEVIdBytes;
|
||||
pkix::Result rv =
|
||||
cabForumEVIdBytes.Init(sCABForumEVId.bytes, sCABForumEVId.numBytes);
|
||||
if (rv == Success && idReader.MatchRest(cabForumEVIdBytes)) {
|
||||
if (rv == pkix::Success && idReader.MatchRest(cabForumEVIdBytes)) {
|
||||
policies.AppendElement(sCABForumEVId);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const CertPolicyId& id : sEVInfoIds) {
|
||||
Input idBytes;
|
||||
for (const pkix::CertPolicyId& id : sEVInfoIds) {
|
||||
pkix::Input idBytes;
|
||||
rv = idBytes.Init(id.bytes, id.numBytes);
|
||||
if (rv == Success && idReader.MatchRest(idBytes)) {
|
||||
if (rv == pkix::Success && idReader.MatchRest(idBytes)) {
|
||||
policies.AppendElement(id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetKnownEVPolicies(
|
||||
const nsTArray<uint8_t>& certBytes,
|
||||
/*out*/ nsTArray<mozilla::pkix::CertPolicyId>& policies) {
|
||||
Input certInput;
|
||||
Result rv = certInput.Init(certBytes.Elements(), certBytes.Length());
|
||||
if (rv != Success) {
|
||||
void GetKnownEVPolicies(const nsTArray<uint8_t>& certBytes,
|
||||
/*out*/ nsTArray<pkix::CertPolicyId>& policies) {
|
||||
pkix::Input certInput;
|
||||
pkix::Result rv = certInput.Init(certBytes.Elements(), certBytes.Length());
|
||||
if (rv != pkix::Success) {
|
||||
return;
|
||||
}
|
||||
// we don't use the certificate for path building, so this parameter
|
||||
// doesn't matter
|
||||
EndEntityOrCA notUsedForPaths = EndEntityOrCA::MustBeEndEntity;
|
||||
BackCert cert(certInput, notUsedForPaths, nullptr);
|
||||
pkix::EndEntityOrCA notUsedForPaths = pkix::EndEntityOrCA::MustBeEndEntity;
|
||||
pkix::BackCert cert(certInput, notUsedForPaths, nullptr);
|
||||
rv = cert.Init();
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Input* extensionInput = cert.GetCertificatePolicies();
|
||||
const pkix::Input* extensionInput = cert.GetCertificatePolicies();
|
||||
if (!extensionInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reader extension(*extensionInput);
|
||||
Reader certificatePolicies;
|
||||
pkix::Reader extension(*extensionInput);
|
||||
pkix::Reader certificatePolicies;
|
||||
// certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
|
||||
// PolicyInformation ::= SEQUENCE {
|
||||
// policyIdentifier CertPolicyId,
|
||||
// ...
|
||||
// }
|
||||
// CertPolicyId ::= OBJECT IDENTIFIER
|
||||
rv = der::ExpectTagAndGetValue(extension, der::SEQUENCE, certificatePolicies);
|
||||
if (rv != Success || !extension.AtEnd()) {
|
||||
rv = pkix::der::ExpectTagAndGetValue(extension, pkix::der::SEQUENCE,
|
||||
certificatePolicies);
|
||||
if (rv != pkix::Success || !extension.AtEnd()) {
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
Reader policyInformation;
|
||||
rv = der::ExpectTagAndGetValue(certificatePolicies, der::SEQUENCE,
|
||||
policyInformation);
|
||||
if (rv != Success) {
|
||||
pkix::Reader policyInformation;
|
||||
rv = pkix::der::ExpectTagAndGetValue(
|
||||
certificatePolicies, pkix::der::SEQUENCE, policyInformation);
|
||||
if (rv != pkix::Success) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reader policyOid;
|
||||
rv = der::ExpectTagAndGetValue(policyInformation, der::OIDTag, policyOid);
|
||||
if (rv != Success) {
|
||||
pkix::Reader policyOid;
|
||||
rv = pkix::der::ExpectTagAndGetValue(policyInformation, pkix::der::OIDTag,
|
||||
policyOid);
|
||||
if (rv != pkix::Success) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
|
@ -33,6 +34,7 @@
|
|||
#include "nsCRTGlue.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNSSCallbacks.h"
|
||||
#include "nsNSSCertHelper.h"
|
||||
#include "nsNSSCertificate.h"
|
||||
#include "nsNSSCertificateDB.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "NSSCertDBTrustDomain.h"
|
||||
#include "pk11pub.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozpkix/pkixnss.h"
|
||||
#include "ScopedNSSTypes.h"
|
||||
|
|
|
@ -52,5 +52,3 @@ FINAL_LIBRARY = "xul"
|
|||
|
||||
if CONFIG["CC_TYPE"] == "clang-cl":
|
||||
AllowCompilerWarnings() # workaround for bug 1090497
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace mozilla {
|
||||
namespace ct {
|
||||
|
||||
typedef mozilla::pkix::Result Result;
|
||||
typedef pkix::Result Result;
|
||||
|
||||
void GetCTLogOperatorsFromVerifiedSCTList(const VerifiedSCTList& list,
|
||||
CTLogOperatorList& operators) {
|
||||
|
@ -32,7 +32,7 @@ void GetCTLogOperatorsFromVerifiedSCTList(const VerifiedSCTList& list,
|
|||
Result CTDiversityPolicy::GetDependentOperators(
|
||||
const nsTArray<nsTArray<uint8_t>>& builtChain,
|
||||
const CTLogOperatorList& operators, CTLogOperatorList& dependentOperators) {
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
} // namespace ct
|
||||
|
|
|
@ -38,65 +38,11 @@ static const size_t kTbsCertificateLengthBytes = 3;
|
|||
static const size_t kSCTListLengthBytes = 2;
|
||||
static const size_t kSerializedSCTLengthBytes = 2;
|
||||
|
||||
// Length of sha256RootHash buffer of SignedTreeHead
|
||||
static const size_t kSthRootHashLength = 32;
|
||||
|
||||
enum class SignatureType {
|
||||
CertificateTimestamp = 0,
|
||||
TreeHash = 1,
|
||||
};
|
||||
|
||||
// Reads a TLS-encoded variable length unsigned integer from |in|.
|
||||
// The integer is expected to be in big-endian order, which is used by TLS.
|
||||
// Note: does not check if the output parameter overflows while reading.
|
||||
// |length| indicates the size (in bytes) of the serialized integer.
|
||||
static Result UncheckedReadUint(size_t length, Reader& in, uint64_t& out) {
|
||||
uint64_t result = 0;
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
uint8_t value;
|
||||
Result rv = in.Read(value);
|
||||
if (rv != Success) {
|
||||
return rv;
|
||||
}
|
||||
result = (result << 8) | value;
|
||||
}
|
||||
out = result;
|
||||
return Success;
|
||||
}
|
||||
|
||||
// Performs overflow sanity checks and calls UncheckedReadUint.
|
||||
template <size_t length, typename T>
|
||||
Result ReadUint(Reader& in, T& out) {
|
||||
uint64_t value;
|
||||
static_assert(std::is_unsigned<T>::value, "T must be unsigned");
|
||||
static_assert(length <= 8, "At most 8 byte integers can be read");
|
||||
static_assert(sizeof(T) >= length, "T must be able to hold <length> bytes");
|
||||
Result rv = UncheckedReadUint(length, in, value);
|
||||
if (rv != Success) {
|
||||
return rv;
|
||||
}
|
||||
out = static_cast<T>(value);
|
||||
return Success;
|
||||
}
|
||||
|
||||
// Reads |length| bytes from |in|.
|
||||
static Result ReadFixedBytes(size_t length, Reader& in, Input& out) {
|
||||
return in.Skip(length, out);
|
||||
}
|
||||
|
||||
// Reads a length-prefixed variable amount of bytes from |in|, updating |out|
|
||||
// on success. |prefixLength| indicates the number of bytes needed to represent
|
||||
// the length.
|
||||
template <size_t prefixLength>
|
||||
Result ReadVariableBytes(Reader& in, Input& out) {
|
||||
size_t length;
|
||||
Result rv = ReadUint<prefixLength>(in, length);
|
||||
if (rv != Success) {
|
||||
return rv;
|
||||
}
|
||||
return ReadFixedBytes(length, in, out);
|
||||
}
|
||||
|
||||
// Reads a serialized hash algorithm.
|
||||
static Result ReadHashAlgorithm(Reader& in,
|
||||
DigitallySigned::HashAlgorithm& out) {
|
||||
|
|
|
@ -54,17 +54,56 @@ namespace ct {
|
|||
|
||||
// Reads a TLS-encoded variable length unsigned integer from |in|.
|
||||
// The integer is expected to be in big-endian order, which is used by TLS.
|
||||
// Note: checks if the output parameter overflows while reading.
|
||||
// Note: does not check if the output parameter overflows while reading.
|
||||
// |length| indicates the size (in bytes) of the serialized integer.
|
||||
inline static pkix::Result UncheckedReadUint(size_t length, pkix::Reader& in,
|
||||
uint64_t& out) {
|
||||
uint64_t result = 0;
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
uint8_t value;
|
||||
pkix::Result rv = in.Read(value);
|
||||
if (rv != pkix::Success) {
|
||||
return rv;
|
||||
}
|
||||
result = (result << 8) | value;
|
||||
}
|
||||
out = result;
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
// Performs overflow sanity checks and calls UncheckedReadUint.
|
||||
template <size_t length, typename T>
|
||||
mozilla::pkix::Result ReadUint(mozilla::pkix::Reader& in, T& out);
|
||||
pkix::Result ReadUint(pkix::Reader& in, T& out) {
|
||||
uint64_t value;
|
||||
static_assert(std::is_unsigned<T>::value, "T must be unsigned");
|
||||
static_assert(length <= 8, "At most 8 byte integers can be read");
|
||||
static_assert(sizeof(T) >= length, "T must be able to hold <length> bytes");
|
||||
pkix::Result rv = UncheckedReadUint(length, in, value);
|
||||
if (rv != pkix::Success) {
|
||||
return rv;
|
||||
}
|
||||
out = static_cast<T>(value);
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
// Reads |length| bytes from |in|.
|
||||
static inline pkix::Result ReadFixedBytes(size_t length, pkix::Reader& in,
|
||||
pkix::Input& out) {
|
||||
return in.Skip(length, out);
|
||||
}
|
||||
|
||||
// Reads a length-prefixed variable amount of bytes from |in|, updating |out|
|
||||
// on success. |prefixLength| indicates the number of bytes needed to represent
|
||||
// the length.
|
||||
template <size_t prefixLength>
|
||||
mozilla::pkix::Result ReadVariableBytes(mozilla::pkix::Reader& in,
|
||||
mozilla::pkix::Input& out);
|
||||
pkix::Result ReadVariableBytes(pkix::Reader& in, pkix::Input& out) {
|
||||
size_t length;
|
||||
pkix::Result rv = ReadUint<prefixLength>(in, length);
|
||||
if (rv != pkix::Success) {
|
||||
return rv;
|
||||
}
|
||||
return ReadFixedBytes(length, in, out);
|
||||
}
|
||||
|
||||
} // namespace ct
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -51,5 +51,3 @@ FINAL_LIBRARY = "xul"
|
|||
|
||||
if CONFIG["CC_TYPE"] == "clang-cl":
|
||||
AllowCompilerWarnings() # workaround for bug 1090497
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -54,5 +54,3 @@ if not CONFIG["MOZ_DEBUG"]:
|
|||
DEFINES["NDEBUG"] = True
|
||||
|
||||
FINAL_LIBRARY = "xul-gtest"
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -8,11 +8,17 @@
|
|||
|
||||
#include "MainThreadUtils.h"
|
||||
#include "cert_storage/src/cert_storage.h"
|
||||
// FIXME: these two must be included before certdb.h {
|
||||
#include "seccomon.h"
|
||||
#include "certt.h"
|
||||
// }
|
||||
#include "certdb.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozpkix/pkixnss.h"
|
||||
#include "NSSCertDBTrustDomain.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsIContentSignatureVerifier.h"
|
||||
|
@ -87,16 +93,17 @@ nsresult AppTrustDomain::SetTrustedRoot(AppTrustedRoot trustedRoot) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::FindIssuer(Input encodedIssuerName,
|
||||
IssuerChecker& checker, Time) {
|
||||
pkix::Result AppTrustDomain::FindIssuer(Input encodedIssuerName,
|
||||
IssuerChecker& checker, Time) {
|
||||
MOZ_ASSERT(!mTrustedRoot.IsEmpty());
|
||||
if (mTrustedRoot.IsEmpty()) {
|
||||
return Result::FATAL_ERROR_INVALID_STATE;
|
||||
return pkix::Result::FATAL_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
nsTArray<Input> candidates;
|
||||
Input rootInput;
|
||||
Result rv = rootInput.Init(mTrustedRoot.Elements(), mTrustedRoot.Length());
|
||||
pkix::Result rv =
|
||||
rootInput.Init(mTrustedRoot.Elements(), mTrustedRoot.Length());
|
||||
// This should never fail, since the possible roots are all hard-coded and
|
||||
// they should never be too long.
|
||||
if (rv != Success) {
|
||||
|
@ -146,7 +153,8 @@ Result AppTrustDomain::FindIssuer(Input encodedIssuerName,
|
|||
for (CERTCertListNode* n = CERT_LIST_HEAD(nssCandidates);
|
||||
!CERT_LIST_END(n, nssCandidates); n = CERT_LIST_NEXT(n)) {
|
||||
Input certDER;
|
||||
Result rv = certDER.Init(n->cert->derCert.data, n->cert->derCert.len);
|
||||
pkix::Result rv =
|
||||
certDER.Init(n->cert->derCert.data, n->cert->derCert.len);
|
||||
if (rv != Success) {
|
||||
continue; // probably too big
|
||||
}
|
||||
|
@ -166,17 +174,17 @@ Result AppTrustDomain::FindIssuer(Input encodedIssuerName,
|
|||
return Success;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA,
|
||||
const CertPolicyId& policy,
|
||||
Input candidateCertDER,
|
||||
/*out*/ TrustLevel& trustLevel) {
|
||||
pkix::Result AppTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA,
|
||||
const CertPolicyId& policy,
|
||||
Input candidateCertDER,
|
||||
/*out*/ TrustLevel& trustLevel) {
|
||||
MOZ_ASSERT(policy.IsAnyPolicy());
|
||||
MOZ_ASSERT(!mTrustedRoot.IsEmpty());
|
||||
if (!policy.IsAnyPolicy()) {
|
||||
return Result::FATAL_ERROR_INVALID_ARGS;
|
||||
return pkix::Result::FATAL_ERROR_INVALID_ARGS;
|
||||
}
|
||||
if (mTrustedRoot.IsEmpty()) {
|
||||
return Result::FATAL_ERROR_INVALID_STATE;
|
||||
return pkix::Result::FATAL_ERROR_INVALID_STATE;
|
||||
}
|
||||
|
||||
nsTArray<uint8_t> issuerBytes;
|
||||
|
@ -184,7 +192,7 @@ Result AppTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA,
|
|||
nsTArray<uint8_t> subjectBytes;
|
||||
nsTArray<uint8_t> pubKeyBytes;
|
||||
|
||||
Result result =
|
||||
pkix::Result result =
|
||||
BuildRevocationCheckArrays(candidateCertDER, endEntityOrCA, issuerBytes,
|
||||
serialBytes, subjectBytes, pubKeyBytes);
|
||||
if (result != Success) {
|
||||
|
@ -195,11 +203,11 @@ Result AppTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA,
|
|||
nsresult nsrv = mCertBlocklist->GetRevocationState(
|
||||
issuerBytes, serialBytes, subjectBytes, pubKeyBytes, &revocationState);
|
||||
if (NS_FAILED(nsrv)) {
|
||||
return Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
return pkix::Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
}
|
||||
|
||||
if (revocationState == nsICertStorage::STATE_ENFORCE) {
|
||||
return Result::ERROR_REVOKED_CERTIFICATE;
|
||||
return pkix::Result::ERROR_REVOKED_CERTIFICATE;
|
||||
}
|
||||
|
||||
// mTrustedRoot is the only trust anchor for this validation.
|
||||
|
@ -214,67 +222,65 @@ Result AppTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA,
|
|||
return Success;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::DigestBuf(Input item, DigestAlgorithm digestAlg,
|
||||
/*out*/ uint8_t* digestBuf,
|
||||
size_t digestBufLen) {
|
||||
pkix::Result AppTrustDomain::DigestBuf(Input item, DigestAlgorithm digestAlg,
|
||||
/*out*/ uint8_t* digestBuf,
|
||||
size_t digestBufLen) {
|
||||
return DigestBufNSS(item, digestAlg, digestBuf, digestBufLen);
|
||||
}
|
||||
|
||||
Result AppTrustDomain::CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||
Duration,
|
||||
/*optional*/ const Input*,
|
||||
/*optional*/ const Input*,
|
||||
/*optional*/ const Input*) {
|
||||
pkix::Result AppTrustDomain::CheckRevocation(EndEntityOrCA, const CertID&, Time,
|
||||
Duration,
|
||||
/*optional*/ const Input*,
|
||||
/*optional*/ const Input*,
|
||||
/*optional*/ const Input*) {
|
||||
// We don't currently do revocation checking. If we need to distrust an Apps
|
||||
// certificate, we will use the active distrust mechanism.
|
||||
return Success;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::IsChainValid(const DERArray& certChain, Time time,
|
||||
const CertPolicyId& requiredPolicy) {
|
||||
pkix::Result AppTrustDomain::IsChainValid(const DERArray& certChain, Time time,
|
||||
const CertPolicyId& requiredPolicy) {
|
||||
MOZ_ASSERT(requiredPolicy.IsAnyPolicy());
|
||||
return Success;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::CheckSignatureDigestAlgorithm(DigestAlgorithm digestAlg,
|
||||
EndEntityOrCA, Time) {
|
||||
pkix::Result AppTrustDomain::CheckSignatureDigestAlgorithm(
|
||||
DigestAlgorithm digestAlg, EndEntityOrCA, Time) {
|
||||
switch (digestAlg) {
|
||||
case DigestAlgorithm::sha256: // fall through
|
||||
case DigestAlgorithm::sha384: // fall through
|
||||
case DigestAlgorithm::sha512:
|
||||
return Success;
|
||||
case DigestAlgorithm::sha1:
|
||||
return Result::ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED;
|
||||
return pkix::Result::ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED;
|
||||
}
|
||||
return Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
return pkix::Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::CheckRSAPublicKeyModulusSizeInBits(
|
||||
pkix::Result AppTrustDomain::CheckRSAPublicKeyModulusSizeInBits(
|
||||
EndEntityOrCA /*endEntityOrCA*/, unsigned int modulusSizeInBits) {
|
||||
if (modulusSizeInBits < 2048u) {
|
||||
return Result::ERROR_INADEQUATE_KEY_SIZE;
|
||||
return pkix::Result::ERROR_INADEQUATE_KEY_SIZE;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::VerifyRSAPKCS1SignedData(Input data,
|
||||
DigestAlgorithm digestAlgorithm,
|
||||
Input signature,
|
||||
Input subjectPublicKeyInfo) {
|
||||
pkix::Result AppTrustDomain::VerifyRSAPKCS1SignedData(
|
||||
Input data, DigestAlgorithm digestAlgorithm, Input signature,
|
||||
Input subjectPublicKeyInfo) {
|
||||
// TODO: We should restrict signatures to SHA-256 or better.
|
||||
return VerifyRSAPKCS1SignedDataNSS(data, digestAlgorithm, signature,
|
||||
subjectPublicKeyInfo, nullptr);
|
||||
}
|
||||
|
||||
Result AppTrustDomain::VerifyRSAPSSSignedData(Input data,
|
||||
DigestAlgorithm digestAlgorithm,
|
||||
Input signature,
|
||||
Input subjectPublicKeyInfo) {
|
||||
pkix::Result AppTrustDomain::VerifyRSAPSSSignedData(
|
||||
Input data, DigestAlgorithm digestAlgorithm, Input signature,
|
||||
Input subjectPublicKeyInfo) {
|
||||
return VerifyRSAPSSSignedDataNSS(data, digestAlgorithm, signature,
|
||||
subjectPublicKeyInfo, nullptr);
|
||||
}
|
||||
|
||||
Result AppTrustDomain::CheckECDSACurveIsAcceptable(
|
||||
pkix::Result AppTrustDomain::CheckECDSACurveIsAcceptable(
|
||||
EndEntityOrCA /*endEntityOrCA*/, NamedCurve curve) {
|
||||
switch (curve) {
|
||||
case NamedCurve::secp256r1: // fall through
|
||||
|
@ -283,25 +289,25 @@ Result AppTrustDomain::CheckECDSACurveIsAcceptable(
|
|||
return Success;
|
||||
}
|
||||
|
||||
return Result::ERROR_UNSUPPORTED_ELLIPTIC_CURVE;
|
||||
return pkix::Result::ERROR_UNSUPPORTED_ELLIPTIC_CURVE;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::VerifyECDSASignedData(Input data,
|
||||
DigestAlgorithm digestAlgorithm,
|
||||
Input signature,
|
||||
Input subjectPublicKeyInfo) {
|
||||
pkix::Result AppTrustDomain::VerifyECDSASignedData(
|
||||
Input data, DigestAlgorithm digestAlgorithm, Input signature,
|
||||
Input subjectPublicKeyInfo) {
|
||||
return VerifyECDSASignedDataNSS(data, digestAlgorithm, signature,
|
||||
subjectPublicKeyInfo, nullptr);
|
||||
}
|
||||
|
||||
Result AppTrustDomain::CheckValidityIsAcceptable(
|
||||
pkix::Result AppTrustDomain::CheckValidityIsAcceptable(
|
||||
Time /*notBefore*/, Time /*notAfter*/, EndEntityOrCA /*endEntityOrCA*/,
|
||||
KeyPurposeId /*keyPurpose*/) {
|
||||
return Success;
|
||||
}
|
||||
|
||||
Result AppTrustDomain::NetscapeStepUpMatchesServerAuth(Time /*notBefore*/,
|
||||
/*out*/ bool& matches) {
|
||||
pkix::Result AppTrustDomain::NetscapeStepUpMatchesServerAuth(
|
||||
Time /*notBefore*/,
|
||||
/*out*/ bool& matches) {
|
||||
matches = false;
|
||||
return Success;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsITlsHandshakeListener.h"
|
||||
#include "nsNSSComponent.h"
|
||||
#include "nsNSSHelper.h"
|
||||
#include "secerr.h"
|
||||
#include "ssl.h"
|
||||
#include "sslt.h"
|
||||
|
||||
|
@ -254,23 +255,23 @@ CommonSocketControl::IsAcceptableForHost(const nsACString& hostname,
|
|||
// CertVerifier::VerifySSLServerCert. We are doing the same hostname-specific
|
||||
// checks here. If any hostname-specific checks are added to
|
||||
// CertVerifier::VerifySSLServerCert we need to add them here too.
|
||||
Input serverCertInput;
|
||||
pkix::Input serverCertInput;
|
||||
mozilla::pkix::Result rv =
|
||||
serverCertInput.Init(certDER.Elements(), certDER.Length());
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Input hostnameInput;
|
||||
pkix::Input hostnameInput;
|
||||
rv = hostnameInput.Init(
|
||||
BitwiseCast<const uint8_t*, const char*>(hostname.BeginReading()),
|
||||
hostname.Length());
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
rv = CheckCertHostname(serverCertInput, hostnameInput);
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -286,7 +287,7 @@ CommonSocketControl::IsAcceptableForHost(const nsACString& hostname,
|
|||
}
|
||||
bool chainHasValidPins;
|
||||
nsresult nsrv = mozilla::psm::PublicKeyPinningService::ChainHasValidPins(
|
||||
derCertSpanList, PromiseFlatCString(hostname).BeginReading(), Now(),
|
||||
derCertSpanList, PromiseFlatCString(hostname).BeginReading(), pkix::Now(),
|
||||
mIsBuiltCertChainRootBuiltInRoot, chainHasValidPins, nullptr);
|
||||
if (NS_FAILED(nsrv)) {
|
||||
return NS_OK;
|
||||
|
@ -459,13 +460,15 @@ CommonSocketControl::GetSecurityInfo(nsITransportSecurityInfo** aSecurityInfo) {
|
|||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsITransportSecurityInfo> securityInfo(new TransportSecurityInfo(
|
||||
mSecurityState, mErrorCode, mFailedCertChain.Clone(), mServerCert,
|
||||
mSucceededCertChain.Clone(), mCipherSuite, mKeaGroupName,
|
||||
mSignatureSchemeName, mProtocolVersion, mCertificateTransparencyStatus,
|
||||
mIsAcceptedEch, mIsDelegatedCredential, mOverridableErrorCategory,
|
||||
mMadeOCSPRequests, mUsedPrivateDNS, mIsEV, mNPNCompleted, mNegotiatedNPN,
|
||||
mResumed, mIsBuiltCertChainRootBuiltInRoot, mPeerId));
|
||||
nsCOMPtr<nsITransportSecurityInfo> securityInfo(
|
||||
new psm::TransportSecurityInfo(
|
||||
mSecurityState, mErrorCode, mFailedCertChain.Clone(), mServerCert,
|
||||
mSucceededCertChain.Clone(), mCipherSuite, mKeaGroupName,
|
||||
mSignatureSchemeName, mProtocolVersion,
|
||||
mCertificateTransparencyStatus, mIsAcceptedEch,
|
||||
mIsDelegatedCredential, mOverridableErrorCategory, mMadeOCSPRequests,
|
||||
mUsedPrivateDNS, mIsEV, mNPNCompleted, mNegotiatedNPN, mResumed,
|
||||
mIsBuiltCertChainRootBuiltInRoot, mPeerId));
|
||||
securityInfo.forget(aSecurityInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
|
||||
#include "ContentSignatureVerifier.h"
|
||||
|
||||
#include "AppTrustDomain.h"
|
||||
#include "CryptoTask.h"
|
||||
#include "ScopedNSSTypes.h"
|
||||
#include "SharedCertVerifier.h"
|
||||
#include "cryptohi.h"
|
||||
#include "keyhi.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsPromiseFlatString.h"
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include "DataStorage.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/AppShutdown.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -22,9 +22,10 @@
|
|||
#include "nsIFileStreams.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISafeOutputStream.h"
|
||||
#include "nsISerialEventTarget.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsStreamUtils.h"
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "IPCClientCertsParent.h"
|
||||
#include "ScopedNSSTypes.h"
|
||||
#include "nsNSSComponent.h"
|
||||
#include "nsNSSIOLayer.h"
|
||||
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <memory>
|
||||
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "prlink.h"
|
||||
|
||||
// This is the implementation of LibSecret, an instantiation of OSKeyStore for
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
|
||||
#include "NSSKeyStore.h"
|
||||
|
||||
#include "mozilla/AbstractThread.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsNSSComponent.h"
|
||||
#include "nsPK11TokenDB.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
|
||||
#include "ssl.h"
|
||||
#include "sslexp.h"
|
||||
#include "nsISocketProvider.h"
|
||||
#include "secerr.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "nsNSSCallbacks.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::psm;
|
||||
|
||||
extern LazyLogModule gPIPNSSLog;
|
||||
|
||||
NSSSocketControl::NSSSocketControl(const nsCString& aHostName, int32_t aPort,
|
||||
SharedSSLState& aState,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "ScopedNSSTypes.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef SECURITY_MANAGER_SSL_SELECTTLSCLIENTAUTHCERTPARENT_H_
|
||||
#define SECURITY_MANAGER_SSL_SELECTTLSCLIENTAUTHCERTPARENT_H_
|
||||
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "mozilla/psm/PSelectTLSClientAuthCertParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "nsClientAuthRemember.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsICertOverrideService.h"
|
||||
#include "mozilla/OriginAttributes.h"
|
||||
#include "nsNSSComponent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "TLSClientAuthCertSelection.h"
|
||||
#include "cert_storage/src/cert_storage.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
|
@ -33,9 +34,25 @@
|
|||
#include "mozilla/psm/SelectTLSClientAuthCertParent.h"
|
||||
#include "nsArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsNSSComponent.h"
|
||||
#include "nsIClientAuthDialogs.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsINSSComponent.h"
|
||||
#include "NSSCertDBTrustDomain.h"
|
||||
#include "nsIClientAuthRememberService.h"
|
||||
#include "nsIX509CertDB.h"
|
||||
#include "nsNSSHelper.h"
|
||||
#include "mozpkix/pkixnss.h"
|
||||
#include "mozpkix/pkixutil.h"
|
||||
#include "mozpkix/pkix.h"
|
||||
#include "secerr.h"
|
||||
#include "sslerr.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::pkix;
|
||||
using namespace mozilla::psm;
|
||||
|
||||
extern LazyLogModule gPIPNSSLog;
|
||||
|
||||
// Possible behaviors for choosing a cert for client auth.
|
||||
enum class UserCertChoice {
|
||||
|
@ -169,71 +186,74 @@ class ClientAuthCertNonverifyingTrustDomain final : public TrustDomain {
|
|||
mThirdPartyCertificates(thirdPartyCertificates) {}
|
||||
|
||||
virtual mozilla::pkix::Result GetCertTrust(
|
||||
EndEntityOrCA endEntityOrCA, const CertPolicyId& policy,
|
||||
Input candidateCertDER,
|
||||
/*out*/ TrustLevel& trustLevel) override;
|
||||
virtual mozilla::pkix::Result FindIssuer(Input encodedIssuerName,
|
||||
pkix::EndEntityOrCA endEntityOrCA, const pkix::CertPolicyId& policy,
|
||||
pkix::Input candidateCertDER,
|
||||
/*out*/ pkix::TrustLevel& trustLevel) override;
|
||||
virtual mozilla::pkix::Result FindIssuer(pkix::Input encodedIssuerName,
|
||||
IssuerChecker& checker,
|
||||
Time time) override;
|
||||
pkix::Time time) override;
|
||||
|
||||
virtual mozilla::pkix::Result CheckRevocation(
|
||||
EndEntityOrCA endEntityOrCA, const CertID& certID, Time time,
|
||||
EndEntityOrCA endEntityOrCA, const pkix::CertID& certID, Time time,
|
||||
mozilla::pkix::Duration validityDuration,
|
||||
/*optional*/ const Input* stapledOCSPresponse,
|
||||
/*optional*/ const Input* aiaExtension,
|
||||
/*optional*/ const Input* sctExtension) override {
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
virtual mozilla::pkix::Result IsChainValid(
|
||||
const DERArray& certChain, Time time,
|
||||
const CertPolicyId& requiredPolicy) override;
|
||||
const pkix::DERArray& certChain, pkix::Time time,
|
||||
const pkix::CertPolicyId& requiredPolicy) override;
|
||||
|
||||
virtual mozilla::pkix::Result CheckSignatureDigestAlgorithm(
|
||||
DigestAlgorithm digestAlg, EndEntityOrCA endEntityOrCA,
|
||||
Time notBefore) override {
|
||||
return Success;
|
||||
pkix::DigestAlgorithm digestAlg, pkix::EndEntityOrCA endEntityOrCA,
|
||||
pkix::Time notBefore) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result CheckRSAPublicKeyModulusSizeInBits(
|
||||
EndEntityOrCA endEntityOrCA, unsigned int modulusSizeInBits) override {
|
||||
return Success;
|
||||
pkix::EndEntityOrCA endEntityOrCA,
|
||||
unsigned int modulusSizeInBits) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result VerifyRSAPKCS1SignedData(
|
||||
Input data, DigestAlgorithm, Input signature,
|
||||
Input subjectPublicKeyInfo) override {
|
||||
return Success;
|
||||
pkix::Input data, pkix::DigestAlgorithm, pkix::Input signature,
|
||||
pkix::Input subjectPublicKeyInfo) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result VerifyRSAPSSSignedData(
|
||||
Input data, DigestAlgorithm, Input signature,
|
||||
Input subjectPublicKeyInfo) override {
|
||||
return Success;
|
||||
pkix::Input data, pkix::DigestAlgorithm, pkix::Input signature,
|
||||
pkix::Input subjectPublicKeyInfo) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result CheckECDSACurveIsAcceptable(
|
||||
EndEntityOrCA endEntityOrCA, NamedCurve curve) override {
|
||||
return Success;
|
||||
pkix::EndEntityOrCA endEntityOrCA, pkix::NamedCurve curve) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result VerifyECDSASignedData(
|
||||
Input data, DigestAlgorithm, Input signature,
|
||||
Input subjectPublicKeyInfo) override {
|
||||
return Success;
|
||||
pkix::Input data, pkix::DigestAlgorithm, pkix::Input signature,
|
||||
pkix::Input subjectPublicKeyInfo) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result CheckValidityIsAcceptable(
|
||||
Time notBefore, Time notAfter, EndEntityOrCA endEntityOrCA,
|
||||
KeyPurposeId keyPurpose) override {
|
||||
return Success;
|
||||
pkix::Time notBefore, pkix::Time notAfter,
|
||||
pkix::EndEntityOrCA endEntityOrCA,
|
||||
pkix::KeyPurposeId keyPurpose) override {
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual mozilla::pkix::Result NetscapeStepUpMatchesServerAuth(
|
||||
Time notBefore,
|
||||
pkix::Time notBefore,
|
||||
/*out*/ bool& matches) override {
|
||||
matches = true;
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
virtual void NoteAuxiliaryExtension(AuxiliaryExtension extension,
|
||||
Input extensionData) override {}
|
||||
virtual mozilla::pkix::Result DigestBuf(Input item, DigestAlgorithm digestAlg,
|
||||
virtual void NoteAuxiliaryExtension(pkix::AuxiliaryExtension extension,
|
||||
pkix::Input extensionData) override {}
|
||||
virtual mozilla::pkix::Result DigestBuf(pkix::Input item,
|
||||
pkix::DigestAlgorithm digestAlg,
|
||||
/*out*/ uint8_t* digestBuf,
|
||||
size_t digestBufLen) override {
|
||||
return DigestBufNSS(item, digestAlg, digestBuf, digestBufLen);
|
||||
return pkix::DigestBufNSS(item, digestAlg, digestBuf, digestBufLen);
|
||||
}
|
||||
|
||||
nsTArray<nsTArray<uint8_t>> TakeBuiltChain() {
|
||||
|
@ -248,18 +268,18 @@ class ClientAuthCertNonverifyingTrustDomain final : public TrustDomain {
|
|||
};
|
||||
|
||||
mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::GetCertTrust(
|
||||
EndEntityOrCA endEntityOrCA, const CertPolicyId& policy,
|
||||
Input candidateCertDER,
|
||||
/*out*/ TrustLevel& trustLevel) {
|
||||
pkix::EndEntityOrCA endEntityOrCA, const pkix::CertPolicyId& policy,
|
||||
pkix::Input candidateCertDER,
|
||||
/*out*/ pkix::TrustLevel& trustLevel) {
|
||||
// If the server did not specify any CA names, all client certificates are
|
||||
// acceptable.
|
||||
if (mCANames.Length() == 0) {
|
||||
trustLevel = TrustLevel::TrustAnchor;
|
||||
return Success;
|
||||
trustLevel = pkix::TrustLevel::TrustAnchor;
|
||||
return pkix::Success;
|
||||
}
|
||||
BackCert cert(candidateCertDER, endEntityOrCA, nullptr);
|
||||
mozilla::pkix::Result rv = cert.Init();
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return rv;
|
||||
}
|
||||
// If this certificate's issuer distinguished name is in the set of acceptable
|
||||
|
@ -269,22 +289,22 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::GetCertTrust(
|
|||
// the case where client certificates that have the id-kp-OCSPSigning EKU
|
||||
// can't be trust anchors according to mozilla::pkix, and thus we may be
|
||||
// looking directly at the issuer.
|
||||
Input issuer(cert.GetIssuer());
|
||||
Input subject(cert.GetSubject());
|
||||
pkix::Input issuer(cert.GetIssuer());
|
||||
pkix::Input subject(cert.GetSubject());
|
||||
for (const auto& caName : mCANames) {
|
||||
Input caNameInput;
|
||||
pkix::Input caNameInput;
|
||||
rv = caNameInput.Init(caName.Elements(), caName.Length());
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
continue; // probably too big
|
||||
}
|
||||
if (InputsAreEqual(issuer, caNameInput) ||
|
||||
InputsAreEqual(subject, caNameInput)) {
|
||||
trustLevel = TrustLevel::TrustAnchor;
|
||||
return Success;
|
||||
trustLevel = pkix::TrustLevel::TrustAnchor;
|
||||
return pkix::Success;
|
||||
}
|
||||
}
|
||||
trustLevel = TrustLevel::InheritsTrust;
|
||||
return Success;
|
||||
trustLevel = pkix::TrustLevel::InheritsTrust;
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
// In theory this implementation should only need to consider intermediate
|
||||
|
@ -297,10 +317,10 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::GetCertTrust(
|
|||
// certificates directly. These issuers could be roots, so we have to consider
|
||||
// roots here.
|
||||
mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::FindIssuer(
|
||||
Input encodedIssuerName, IssuerChecker& checker, Time time) {
|
||||
pkix::Input encodedIssuerName, IssuerChecker& checker, pkix::Time time) {
|
||||
// First try all relevant certificates known to Gecko, which avoids calling
|
||||
// CERT_CreateSubjectCertList, because that can be expensive.
|
||||
Vector<Input> geckoCandidates;
|
||||
Vector<pkix::Input> geckoCandidates;
|
||||
if (!mCertStorage) {
|
||||
return mozilla::pkix::Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
}
|
||||
|
@ -313,9 +333,9 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::FindIssuer(
|
|||
return mozilla::pkix::Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
}
|
||||
for (auto& cert : certs) {
|
||||
Input certDER;
|
||||
pkix::Input certDER;
|
||||
mozilla::pkix::Result rv = certDER.Init(cert.Elements(), cert.Length());
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
continue; // probably too big
|
||||
}
|
||||
if (!geckoCandidates.append(certDER)) {
|
||||
|
@ -324,10 +344,10 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::FindIssuer(
|
|||
}
|
||||
|
||||
for (const auto& thirdPartyCertificate : mThirdPartyCertificates) {
|
||||
Input thirdPartyCertificateInput;
|
||||
pkix::Input thirdPartyCertificateInput;
|
||||
mozilla::pkix::Result rv = thirdPartyCertificateInput.Init(
|
||||
thirdPartyCertificate.Elements(), thirdPartyCertificate.Length());
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
continue; // probably too big
|
||||
}
|
||||
if (!geckoCandidates.append(thirdPartyCertificateInput)) {
|
||||
|
@ -336,30 +356,31 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::FindIssuer(
|
|||
}
|
||||
|
||||
bool keepGoing = true;
|
||||
for (Input candidate : geckoCandidates) {
|
||||
for (pkix::Input candidate : geckoCandidates) {
|
||||
mozilla::pkix::Result rv = checker.Check(candidate, nullptr, keepGoing);
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return rv;
|
||||
}
|
||||
if (!keepGoing) {
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
}
|
||||
|
||||
SECItem encodedIssuerNameItem = UnsafeMapInputToSECItem(encodedIssuerName);
|
||||
SECItem encodedIssuerNameItem =
|
||||
pkix::UnsafeMapInputToSECItem(encodedIssuerName);
|
||||
// NSS seems not to differentiate between "no potential issuers found" and
|
||||
// "there was an error trying to retrieve the potential issuers." We assume
|
||||
// there was no error if CERT_CreateSubjectCertList returns nullptr.
|
||||
UniqueCERTCertList candidates(CERT_CreateSubjectCertList(
|
||||
nullptr, CERT_GetDefaultCertDB(), &encodedIssuerNameItem, 0, false));
|
||||
Vector<Input> nssCandidates;
|
||||
Vector<pkix::Input> nssCandidates;
|
||||
if (candidates) {
|
||||
for (CERTCertListNode* n = CERT_LIST_HEAD(candidates);
|
||||
!CERT_LIST_END(n, candidates); n = CERT_LIST_NEXT(n)) {
|
||||
Input certDER;
|
||||
pkix::Input certDER;
|
||||
mozilla::pkix::Result rv =
|
||||
certDER.Init(n->cert->derCert.data, n->cert->derCert.len);
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
continue; // probably too big
|
||||
}
|
||||
if (!nssCandidates.append(certDER)) {
|
||||
|
@ -368,26 +389,26 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::FindIssuer(
|
|||
}
|
||||
}
|
||||
|
||||
for (Input candidate : nssCandidates) {
|
||||
for (pkix::Input candidate : nssCandidates) {
|
||||
mozilla::pkix::Result rv = checker.Check(candidate, nullptr, keepGoing);
|
||||
if (rv != Success) {
|
||||
if (rv != pkix::Success) {
|
||||
return rv;
|
||||
}
|
||||
if (!keepGoing) {
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
}
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::IsChainValid(
|
||||
const DERArray& certArray, Time, const CertPolicyId&) {
|
||||
const pkix::DERArray& certArray, pkix::Time, const pkix::CertPolicyId&) {
|
||||
mBuiltChain.Clear();
|
||||
|
||||
size_t numCerts = certArray.GetLength();
|
||||
for (size_t i = 0; i < numCerts; ++i) {
|
||||
nsTArray<uint8_t> certBytes;
|
||||
const Input* certInput = certArray.GetDER(i);
|
||||
const pkix::Input* certInput = certArray.GetDER(i);
|
||||
MOZ_ASSERT(certInput != nullptr);
|
||||
if (!certInput) {
|
||||
return mozilla::pkix::Result::FATAL_ERROR_LIBRARY_FAILURE;
|
||||
|
@ -397,7 +418,7 @@ mozilla::pkix::Result ClientAuthCertNonverifyingTrustDomain::IsChainValid(
|
|||
mBuiltChain.AppendElement(std::move(certBytes));
|
||||
}
|
||||
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
|
||||
void ClientAuthCertificateSelectedBase::SetSelectedClientAuthData(
|
||||
|
@ -455,7 +476,7 @@ SelectClientAuthCertificate::Run() {
|
|||
if (mSelectedCertBytes.Length() > 0) {
|
||||
nsTArray<nsTArray<uint8_t>> selectedCertChainBytes;
|
||||
if (BuildChainForCertificate(mSelectedCertBytes, selectedCertChainBytes) !=
|
||||
Success) {
|
||||
pkix::Success) {
|
||||
selectedCertChainBytes.Clear();
|
||||
}
|
||||
mContinuation->SetSelectedClientAuthData(std::move(mSelectedCertBytes),
|
||||
|
@ -480,17 +501,17 @@ mozilla::pkix::Result SelectClientAuthCertificate::BuildChainForCertificate(
|
|||
nsTArray<uint8_t>& certBytes, nsTArray<nsTArray<uint8_t>>& certChainBytes) {
|
||||
ClientAuthCertNonverifyingTrustDomain trustDomain(mCANames,
|
||||
mEnterpriseCertificates);
|
||||
Input certDER;
|
||||
pkix::Input certDER;
|
||||
mozilla::pkix::Result result =
|
||||
certDER.Init(certBytes.Elements(), certBytes.Length());
|
||||
if (result != Success) {
|
||||
if (result != pkix::Success) {
|
||||
return result;
|
||||
}
|
||||
// Client certificates shouldn't be CAs, but for interoperability reasons we
|
||||
// attempt to build a path with each certificate as an end entity and then as
|
||||
// a CA if that fails.
|
||||
const EndEntityOrCA kEndEntityOrCAParams[] = {EndEntityOrCA::MustBeEndEntity,
|
||||
EndEntityOrCA::MustBeCA};
|
||||
const pkix::EndEntityOrCA kEndEntityOrCAParams[] = {
|
||||
pkix::EndEntityOrCA::MustBeEndEntity, pkix::EndEntityOrCA::MustBeCA};
|
||||
// mozilla::pkix rejects certificates with id-kp-OCSPSigning unless it is
|
||||
// specifically required. A client certificate should never have this EKU.
|
||||
// Unfortunately, there are some client certificates in private PKIs that
|
||||
|
@ -498,17 +519,18 @@ mozilla::pkix::Result SelectClientAuthCertificate::BuildChainForCertificate(
|
|||
// restriction in mozilla::pkix by first building the certificate chain with
|
||||
// no particular EKU required and then again with id-kp-OCSPSigning required
|
||||
// if that fails.
|
||||
const KeyPurposeId kKeyPurposeIdParams[] = {KeyPurposeId::anyExtendedKeyUsage,
|
||||
KeyPurposeId::id_kp_OCSPSigning};
|
||||
const pkix::KeyPurposeId kKeyPurposeIdParams[] = {
|
||||
pkix::KeyPurposeId::anyExtendedKeyUsage,
|
||||
pkix::KeyPurposeId::id_kp_OCSPSigning};
|
||||
for (const auto& endEntityOrCAParam : kEndEntityOrCAParams) {
|
||||
for (const auto& keyPurposeIdParam : kKeyPurposeIdParams) {
|
||||
mozilla::pkix::Result result =
|
||||
BuildCertChain(trustDomain, certDER, Now(), endEntityOrCAParam,
|
||||
KeyUsage::noParticularKeyUsageRequired,
|
||||
keyPurposeIdParam, CertPolicyId::anyPolicy, nullptr);
|
||||
if (result == Success) {
|
||||
mozilla::pkix::Result result = BuildCertChain(
|
||||
trustDomain, certDER, Now(), endEntityOrCAParam,
|
||||
KeyUsage::noParticularKeyUsageRequired, keyPurposeIdParam,
|
||||
pkix::CertPolicyId::anyPolicy, nullptr);
|
||||
if (result == pkix::Success) {
|
||||
certChainBytes = trustDomain.TakeBuiltChain();
|
||||
return Success;
|
||||
return pkix::Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -550,7 +572,7 @@ void SelectClientAuthCertificate::DoSelectClientAuthCertificate() {
|
|||
certBytes.AppendElements(n->cert->derCert.data, n->cert->derCert.len);
|
||||
mozilla::pkix::Result result =
|
||||
BuildChainForCertificate(certBytes, unusedBuiltChain);
|
||||
if (result != Success) {
|
||||
if (result != pkix::Success) {
|
||||
MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
|
||||
("removing cert '%s'", n->cert->subjectName));
|
||||
CERTCertListNode* toRemove = n;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "NSSSocketControl.h"
|
||||
#include "nsIX509Cert.h"
|
||||
#include "nsNSSIOLayer.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "ssl.h"
|
||||
|
||||
// NSS callback to select a client authentication certificate. See documentation
|
||||
|
|
|
@ -20,9 +20,12 @@
|
|||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsIX509Cert.h"
|
||||
#include "secerr.h"
|
||||
#include "ssl.h"
|
||||
|
||||
#include "mozilla/ipc/IPDLParamTraits.h"
|
||||
|
||||
// nsITransportSecurityInfo should not be created via do_CreateInstance. This
|
||||
// stub prevents that.
|
||||
template <>
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "nsNSSIOLayer.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
|
||||
#include "secerr.h"
|
||||
|
||||
extern mozilla::LazyLogModule gPIPNSSLog;
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
#include "nsNSSComponent.h"
|
||||
#include "secerr.h"
|
||||
#include "SharedCertVerifier.h"
|
||||
#include "NSSCertDBTrustDomain.h"
|
||||
#include "SSLServerCertVerification.h"
|
||||
#include "nsNSSIOLayer.h"
|
||||
#include "nsISocketProvider.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
|
|
|
@ -276,5 +276,3 @@ for header, array_name, cert in headers_arrays_certs:
|
|||
GeneratedFile(
|
||||
header, script="gen_cert_header.py", entry_point=array_name, inputs=[cert]
|
||||
)
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/TextUtils.h"
|
||||
#include "mozilla/Tokenizer.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsILineInputStream.h"
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче