Merge autoland to mozilla-central. a=merge

This commit is contained in:
Narcis Beleuzu 2022-03-10 23:49:49 +02:00
Родитель 60191d925d f5642cacbf
Коммит 61fcf20da2
177 изменённых файлов: 1796 добавлений и 883 удалений

Просмотреть файл

@ -156,9 +156,8 @@ async function runTest(url) {
}
async function setDownloadDir() {
let tmpDir = await PathUtils.getTempDir();
tmpDir = PathUtils.join(
tmpDir,
let tmpDir = PathUtils.join(
PathUtils.tempDir,
"testsavedir" + Math.floor(Math.random() * 2 ** 32)
);
// Create this dir if it doesn't exist (ignores existing dirs)

Просмотреть файл

@ -17,9 +17,8 @@ function waitForNewWindow() {
}
add_task(async function setup() {
let tmpDir = await PathUtils.getTempDir();
tmpDir = PathUtils.join(
tmpDir,
let tmpDir = PathUtils.join(
PathUtils.tempDir,
"testsavedir" + Math.floor(Math.random() * 2 ** 32)
);
// Create this dir if it doesn't exist (ignores existing dirs)

Просмотреть файл

@ -39,10 +39,7 @@ async function createDownloadFile() {
info("Setting path for download file");
// Set target for download file. Otherwise, file will default to .file instead of txt
// when we prepare our downloads - particularly in task_addDownloads().
let targetPath = PathUtils.join(
await PathUtils.getTempDir(),
"downloaded.txt"
);
let targetPath = PathUtils.join(PathUtils.tempDir, "downloaded.txt");
let target = new FileUtils.File(targetPath);
target.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
downloads.push({

Просмотреть файл

@ -263,9 +263,8 @@ async function task_openPanel() {
}
async function setDownloadDir() {
let tmpDir = await PathUtils.getTempDir();
tmpDir = PathUtils.join(
tmpDir,
let tmpDir = PathUtils.join(
PathUtils.tempDir,
"testsavedir" + Math.floor(Math.random() * 2 ** 32)
);
// Create this dir if it doesn't exist (ignores existing dirs)

Просмотреть файл

@ -54,10 +54,7 @@ this.PersistentCache = class PersistentCache {
(this._cache = new Promise(async (resolve, reject) => {
let filepath;
try {
filepath = PathUtils.join(
await PathUtils.getLocalProfileDir(),
this._filename
);
filepath = PathUtils.join(PathUtils.localProfileDir, this._filename);
} catch (error) {
reject(error);
return;
@ -86,10 +83,7 @@ this.PersistentCache = class PersistentCache {
* Persist the cache to file.
*/
async _persist(data) {
const filepath = PathUtils.join(
await PathUtils.getLocalProfileDir(),
this._filename
);
const filepath = PathUtils.join(PathUtils.localProfileDir, this._filename);
await IOUtils.writeJSON(filepath, data, {
tmpPath: `${filepath}.tmp`,
});

Просмотреть файл

@ -19,7 +19,7 @@ describe("PersistentCache", () => {
};
fakePathUtils = {
join: sinon.stub().returns(filename),
getLocalProfileDir: sinon.stub().resolves("/"),
localProfileDir: "/",
};
reportErrorStub = sandbox.stub();
globals.set("Cu", { reportError: reportErrorStub });
@ -123,7 +123,11 @@ describe("PersistentCache", () => {
);
});
it("throws when failing to get file path", async () => {
fakePathUtils.getLocalProfileDir.rejects(new Error());
Object.defineProperty(fakePathUtils, "localProfileDir", {
get() {
throw new Error();
},
});
let rejected = false;
try {

Просмотреть файл

@ -699,8 +699,10 @@ const Snapshots = new (class Snapshots {
if (dbVersion < 1) {
try {
// Delete legacy keyframes.sqlite DB.
let profileDir = await PathUtils.getProfileDir();
let pathToKeyframes = PathUtils.join(profileDir, "keyframes.sqlite");
let pathToKeyframes = PathUtils.join(
PathUtils.profileDir,
"keyframes.sqlite"
);
await IOUtils.remove(pathToKeyframes);
} catch (ex) {
console.warn(`Failed to delete keyframes.sqlite: ${ex}`);

Просмотреть файл

@ -181,8 +181,10 @@ add_task(async function test_delete_snapshot() {
add_task(async function deleteKeyframesDb() {
Services.prefs.setIntPref(VERSION_PREF, 0);
let profileDir = await PathUtils.getProfileDir();
let pathToKeyframes = PathUtils.join(profileDir, "keyframes.sqlite");
let pathToKeyframes = PathUtils.join(
PathUtils.profileDir,
"keyframes.sqlite"
);
try {
let db = await Sqlite.openConnection({

Просмотреть файл

@ -124,7 +124,7 @@ function settingNameToL10nID(settingName) {
`Unknown extension controlled setting name: ${settingName}`
);
}
return `extension-controlled-${extensionControlledL10nKeys[settingName]}`;
return `extension-controlling-${extensionControlledL10nKeys[settingName]}`;
}
/**

Просмотреть файл

@ -89,9 +89,6 @@
<hbox id="browserContainersExtensionContent"
align="center" class="extension-controlled info-box-container">
<hbox flex="1">
<hbox class="info-icon-container">
<image class="info-icon"></image>
</hbox>
<description control="disableContainersExtension" class="description-with-side-element" flex="1" />
</hbox>
<button id="disableContainersExtension"

Просмотреть файл

@ -829,7 +829,7 @@ add_task(async function testExtensionControlledWebNotificationsPermission() {
Assert.deepEqual(
doc.l10n.getAttributes(controlledDesc),
{
id: "extension-controlled-web-notifications",
id: "extension-controlling-web-notifications",
args: {
name: "TestExtension",
},
@ -918,7 +918,7 @@ add_task(async function testExtensionControlledHomepageUninstalledAddon() {
},
};
let jsonFileName = "extension-settings.json";
let storePath = PathUtils.join(await PathUtils.getProfileDir(), jsonFileName);
let storePath = PathUtils.join(PathUtils.profileDir, jsonFileName);
await IOUtils.writeUTF8(storePath, JSON.stringify(storeData));
@ -987,7 +987,7 @@ add_task(async function testExtensionControlledTrackingProtection() {
Assert.deepEqual(
doc.l10n.getAttributes(controlledDesc),
{
id: "extension-controlled-websites-content-blocking-all-trackers",
id: "extension-controlling-websites-content-blocking-all-trackers",
args: {
name: "set_tp",
},
@ -1109,7 +1109,7 @@ add_task(async function testExtensionControlledPasswordManager() {
Assert.deepEqual(
gBrowser.contentDocument.l10n.getAttributes(controlledDesc),
{
id: "extension-controlled-password-saving",
id: "extension-controlling-password-saving",
args: {
name: "testPasswordManagerExtension",
},
@ -1183,7 +1183,7 @@ add_task(async function testExtensionControlledProxyConfig() {
function expectedConnectionSettingsMessage(doc, isControlled) {
return isControlled
? "extension-controlled-proxy-config"
? "extension-controlling-proxy-config"
: "network-proxy-connection-description";
}
@ -1223,7 +1223,7 @@ add_task(async function testExtensionControlledProxyConfig() {
Assert.deepEqual(
doc.l10n.getAttributes(controlledDesc),
{
id: "extension-controlled-proxy-config",
id: "extension-controlling-proxy-config",
args: {
name: "set_proxy",
},

Просмотреть файл

@ -33,11 +33,10 @@ add_task(async function test_creation() {
// Cancel all pending session saves so they won't get in our way.
SessionSaver.cancel();
let PROFILE_DIR = await PathUtils.getProfileDir();
// Create dummy sessionstore backups
let OLD_BACKUP = PathUtils.join(PROFILE_DIR, "sessionstore.baklz4");
let OLD_BACKUP = PathUtils.join(PathUtils.profileDir, "sessionstore.baklz4");
let OLD_UPGRADE_BACKUP = PathUtils.join(
PROFILE_DIR,
PathUtils.profileDir,
"sessionstore.baklz4-0000000"
);

Просмотреть файл

@ -24,10 +24,7 @@ const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
registerCleanupFunction(async function() {
// Remove the distribution dir, even if the test failed, otherwise all
// next tests will use it.
let folderPath = PathUtils.join(
await PathUtils.getProfileDir(),
"distribution"
);
let folderPath = PathUtils.join(PathUtils.profileDir, "distribution");
await IOUtils.remove(folderPath, { ignoreAbsent: true, recursive: true });
Assert.ok(!(await IOUtils.exists(folderPath)));
Services.prefs.clearUserPref("distribution.testing.loadFromProfile");

Просмотреть файл

@ -89,23 +89,23 @@ restart-later = Restart Later
# This string is shown to notify the user that the password manager setting
# is being controlled by an extension
extension-controlled-password-saving = An extension, <img data-l10n-name="icon"/> { $name }, is controlling this setting.
extension-controlling-password-saving = <img data-l10n-name="icon"/> <strong>{ $name }</strong> controls this setting.
# This string is shown to notify the user that their notifications permission
# is being controlled by an extension.
extension-controlled-web-notifications= An extension, <img data-l10n-name="icon"/> { $name }, is controlling this setting.
extension-controlling-web-notifications = <img data-l10n-name="icon"/> <strong>{ $name }</strong> controls this setting.
# This string is shown to notify the user that Container Tabs
# are being enabled by an extension.
extension-controlled-privacy-containers = An extension, <img data-l10n-name="icon"/> { $name }, requires Container Tabs.
extension-controlling-privacy-containers = <img data-l10n-name="icon"/> <strong>{ $name }</strong> requires Container Tabs.
# This string is shown to notify the user that their content blocking "All Detected Trackers"
# preferences are being controlled by an extension.
extension-controlled-websites-content-blocking-all-trackers = An extension, <img data-l10n-name="icon"/> { $name }, is controlling this setting.
extension-controlling-websites-content-blocking-all-trackers = <img data-l10n-name="icon"/> <strong>{ $name }</strong> controls this setting.
# This string is shown to notify the user that their proxy configuration preferences
# are being controlled by an extension.
extension-controlled-proxy-config = An extension, <img data-l10n-name="icon"/> { $name }, is controlling how { -brand-short-name } connects to the internet.
extension-controlling-proxy-config = <img data-l10n-name ="icon"/> <strong>{ $name }</strong> controls how { -brand-short-name } connects to the internet.
# This string is shown after the user disables an extension to notify the user
# how to enable an extension that they disabled.

Просмотреть файл

@ -91,10 +91,7 @@ var TestRunner = {
"mozscreenshots",
new Date().toISOString().replace(/:/g, "-") + "_" + Services.appinfo.OS,
];
let screenshotPath = PathUtils.join(
await PathUtils.getTempDir(),
...subDirs
);
let screenshotPath = PathUtils.join(PathUtils.tempDir, ...subDirs);
const MOZ_UPLOAD_DIR = env.get("MOZ_UPLOAD_DIR");
const GECKO_HEAD_REPOSITORY = env.get("GECKO_HEAD_REPOSITORY");

Просмотреть файл

@ -4,6 +4,7 @@ subsuite = devtools
skip-if = (os == 'linux' && debug && bits == 32)
support-files =
examples/*
integration-tests/*
head.js
shared-head.js
!/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js
@ -20,6 +21,8 @@ prefs =
# rejection).
dom.ipc.processPrelaunch.enabled=false
[browser_dbg-integration-reloading-compressed-sourcemaps.js]
[browser_dbg-integration-reloading-uncompressed-sourcemaps.js]
[browser_dbg-asm.js]
[browser_dbg-asyncstacks.js]
[browser_dbg-audiocontext.js]
@ -61,7 +64,6 @@ skip-if = os == "win"
[browser_dbg-breakpoints-reloading-with-source-changes.js]
[browser_dbg-breakpoints-reloading.js]
[browser_dbg-breakpoints-same-file-per-target.js]
[browser_dbg-breakpoints-sourcemaps-reloading-with-source-changes.js]
[browser_dbg-breakpoint-skipping.js]
[browser_dbg-breakpoint-skipping-console.js]
[browser_dbg-call-stack.js]

Просмотреть файл

@ -4,7 +4,9 @@
"use strict";
const testServer = createVersionizedHttpTestServer("sourcemaps-reload");
const testServer = createVersionizedHttpTestServer(
"examples/sourcemaps-reload-uncompressed"
);
const TEST_URL = testServer.urlFor("index.html");
// Assert the behavior of the gutter that grays out non-breakable lines

Просмотреть файл

@ -4,7 +4,9 @@
"use strict";
const testServer = createVersionizedHttpTestServer("sourcemaps-reload");
const testServer = createVersionizedHttpTestServer(
"examples/sourcemaps-reload-uncompressed"
);
const TEST_URL = testServer.urlFor("index.html");
// getTokenFromPosition pauses 0.5s for each line,

Просмотреть файл

@ -1,210 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
/*
* This tests resyncing of breakpoints in sourcemapped files when
* source content changes of reload.
*/
"use strict";
const testServer = createVersionizedHttpTestServer("sourcemaps-reload");
const TEST_URL = testServer.urlFor("index.html");
/**
* This first test will focus on original.js file whose content changes
* which affects the related generated file: bundle.js
*/
add_task(async function testReloadingStableOriginalSource() {
const dbg = await initDebuggerWithAbsoluteURL(TEST_URL, "original.js");
info("Add initial breakpoint");
await selectSource(dbg, "original.js");
await addBreakpoint(dbg, "original.js", 6);
info("Check that only one breakpoint is set");
is(dbg.selectors.getBreakpointCount(), 1, "Only one breakpoint exists");
info("Check that the breakpoint location info is correct");
let breakpoint = dbg.selectors.getBreakpointsList(dbg)[0];
is(breakpoint.location.line, 6);
is(breakpoint.generatedLocation.line, 82);
const expectedOriginalFileContentOnBreakpointLine = "await bar();";
const expectedGeneratedFileContentOnBreakpointLine = "await bar();";
info("Check that the breakpoint is displayed on the correct line in the ui");
await assertBreakpoint(dbg, 6);
info("Check that breakpoint is on the first line within the function `foo`");
assertTextContentOnLine(dbg, 6, expectedOriginalFileContentOnBreakpointLine);
info(
"Check that the breakpoint is displayed in correct location in bundle.js (generated source)"
);
await selectSource(dbg, "bundle.js");
await assertBreakpoint(dbg, 82);
assertTextContentOnLine(
dbg,
82,
expectedGeneratedFileContentOnBreakpointLine
);
await closeTab(dbg, "bundle.js");
info("Reload with a new version of the file");
const waitUntilNewBreakpointIsSet = waitForDispatch(
dbg.store,
"SET_BREAKPOINT"
);
testServer.switchToNextVersion();
await reload(dbg, "bundle.js", "original.js");
await waitUntilNewBreakpointIsSet;
info("Check that only one breakpoint is set");
is(dbg.selectors.getBreakpointCount(), 1, "Only one breakpoint exists");
info("Check that the original location has changed");
breakpoint = dbg.selectors.getBreakpointsList(dbg)[0];
is(breakpoint.location.line, 9);
is(breakpoint.generatedLocation.line, 82);
info("Invoke `foo` to trigger breakpoint");
invokeInTab("foo");
await waitForPaused(dbg);
info("Check that the breakpoint is displayed and paused on the correct line");
const originalSource = findSource(dbg, "original.js");
await assertPausedAtSourceAndLine(dbg, originalSource.id, 9);
await assertBreakpoint(dbg, 9);
info(
"Check that though the breakpoint has moved, it is still on the first line within the function `foo`"
);
assertTextContentOnLine(dbg, 9, expectedOriginalFileContentOnBreakpointLine);
info(
"Check that the breakpoint is displayed in correct location in bundle.js (generated source)"
);
await selectSource(dbg, "bundle.js");
// This scrolls the line into view so the content
// on the line is rendered and avaliable for dom querying.
getCM(dbg).scrollIntoView({ line: 82, ch: 0 });
const generatedSource = findSource(dbg, "bundle.js");
await assertPausedAtSourceAndLine(dbg, generatedSource.id, 82);
await assertBreakpoint(dbg, 82);
assertTextContentOnLine(
dbg,
82,
expectedGeneratedFileContentOnBreakpointLine
);
await closeTab(dbg, "bundle.js");
await resume(dbg);
info("Add a second breakpoint");
await addBreakpoint(dbg, "original.js", 13);
is(dbg.selectors.getBreakpointCount(dbg), 2, "Two breakpoints exist");
info("Check that the original location of the new breakpoint is correct");
breakpoint = dbg.selectors.getBreakpointsList(dbg)[1];
is(breakpoint.location.line, 13);
is(breakpoint.generatedLocation.line, 86);
// NOTE: When we reload, the `foo` function no longer exists
// and the original.js file is now 3 lines long
info("Reload and observe no breakpoints");
testServer.switchToNextVersion();
await reload(dbg, "original.js");
// There will initially be zero breakpoints, but wait to make sure none are
// installed while syncing.
await wait(1000);
assertNotPaused(dbg);
is(dbg.selectors.getBreakpointCount(dbg), 0, "No breakpoints");
});
/**
* This second test will focus on removed-original.js which is an original source mapped file.
* This source is mapped to replaced-bundle.js.
* This original source is removed and another original file: new-original.js
* will replace the content of the removed-original.js in the replaced-bundle.js generated file.
* And finally, everything is removed, both original and generated source.
*/
add_task(async function testReloadingReplacedOriginalSource() {
testServer.backToFirstVersion();
const dbg = await initDebuggerWithAbsoluteURL(
TEST_URL,
"removed-original.js"
);
info("Add initial breakpoint");
await selectSource(dbg, "removed-original.js");
await addBreakpoint(dbg, "removed-original.js", 2);
// Assert the precise behavior of the breakpoint before reloading
invokeInTab("removedOriginal");
await waitForPaused(dbg);
const replacedSource = findSource(dbg, "removed-original.js");
assertPausedAtSourceAndLine(dbg, replacedSource.id, 2);
assertTextContentOnLine(dbg, 2, 'console.log("Removed original");');
await assertBreakpoint(dbg, 2);
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
let breakpoint = dbg.selectors.getBreakpointsList()[0];
is(breakpoint.location.sourceUrl, replacedSource.url);
is(breakpoint.location.line, 2);
is(breakpoint.generatedLocation.line, 78);
await resume(dbg);
info(
"Reload, which should remove the original file and a add a new original file which will replace its content in the generated file"
);
const syncBp = waitForDispatch(dbg.store, "SET_BREAKPOINT");
testServer.switchToNextVersion();
await reload(dbg);
await syncBp;
// Assert the new breakpoint being created after reload
// For now, the current behavior of the debugger is that:
// the breakpoint is still hit based on the generated source/bundle file
// and the UI updates itself to mention the new original file.
await waitForPaused(dbg);
const newSource = findSource(dbg, "new-original.js");
assertPausedAtSourceAndLine(dbg, newSource.id, 2);
assertTextContentOnLine(dbg, 2, 'console.log("New original");');
await assertBreakpoint(dbg, 2);
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
breakpoint = dbg.selectors.getBreakpointsList()[0];
is(breakpoint.location.sourceUrl, newSource.url);
is(breakpoint.location.line, 2);
is(breakpoint.generatedLocation.line, 78);
info(
"Reload a last time to remove both original and generated sources entirely"
);
testServer.switchToNextVersion();
await reload(dbg);
// Let some time for breakpoint syncing to be buggy and recreated unexpected breakpoint
await wait(1000);
info("Assert that sources and breakpoints are gone and we aren't paused");
ok(
!sourceExists(dbg, "removed-original.js"),
"removed-original is not present"
);
ok(!sourceExists(dbg, "new-original.js"), "new-original is not present");
ok(
!sourceExists(dbg, "replaced-bundle.js"),
"replaced-bundle is not present"
);
assertNotPaused(dbg);
is(dbg.selectors.getBreakpointCount(), 0, "We no longer have any breakpoint");
});

Просмотреть файл

@ -0,0 +1,20 @@
/* 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/>. */
/**
* This runs all integration tests against a test using sources maps
* whose generated files (bundles) are compressed.
* i.e. bundles are made of a unique line with all sources compressed into one line.
*/
"use strict";
add_task(async function() {
const testFolder = "sourcemaps-reload-compressed";
const isCompressed = true;
await runAllIntegrationTests(testFolder, {
isCompressed,
});
});

Просмотреть файл

@ -0,0 +1,20 @@
/* 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/>. */
/**
* This runs all integration tests against a test using sources maps
* whose generated files (bundles) are uncompressed.
* i.e. bundles are keeping the same format as original files.
*/
"use strict";
add_task(async function() {
const testFolder = "sourcemaps-reload-uncompressed";
const isCompressed = false;
await runAllIntegrationTests(testFolder, {
isCompressed,
});
});

Просмотреть файл

@ -0,0 +1,6 @@
### Steps to Rebuild
1. /!\ ONLY DO CHANGES TO package.json /!\
All other files from v1, v2,... folders are automatically copied from ../sourcemaps-reload-uncompressed/ folder
2. run `yarn` to install webpack & babel
3. run `yarn run pack` to update everything

Просмотреть файл

@ -0,0 +1,20 @@
{
"name": "sourcemaps-reload-compressed",
"version": "1.0.0",
"description": "Rebuild assets for sourcemaps-reload-compressed test, see README.md in the same folder",
"scripts": {
"pack": "cp -r ../sourcemaps-reload-uncompressed/v* ./ && cd v1 && webpack && cd ../v2 && webpack && cd ../v3 && webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "MPL-2.0",
"dependencies": {},
"devDependencies": {
"babel-core": "^7.0.0-beta.3",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"webpack": "^4",
"webpack-cli": ""
}
}

Просмотреть файл

@ -0,0 +1,2 @@
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n){window.bar=function(){return new Promise(e=>setTimeout(e,100))},window.foo=async function(){await bar(),console.log("YO")}}]);
//# sourceMappingURL=bundle.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,5 @@
// Add two comment lines, to match the one from new-original.js and have same
// breakpoint positions..............................
window.removedOriginal = function removedOriginal() {
console.log("Removed original");
}

Просмотреть файл

@ -0,0 +1,2 @@
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n){window.removedOriginal=function(){console.log("Removed original")}}]);
//# sourceMappingURL=replaced-bundle.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./removed-original.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","window","removedOriginal","console","log"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,gDChFrDC,OAAOC,gBAAkB,WACvBC,QAAQC,IAAI","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","// Add two comment lines, to match the one from new-original.js and have same\n// breakpoint positions..............................\nwindow.removedOriginal = function removedOriginal() {\n console.log(\"Removed original\");\n}\n"],"sourceRoot":""}

Просмотреть файл

@ -0,0 +1,41 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
};
if (webpack.version && webpack.version[0] === "4") {
// Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
// Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
config.mode = "production";
} else {
// Also Webpack 4 doesn't support the module.loaders attribute
config.module = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
};
}
const originalBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js",
},
});
const replacedBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "removed-original.js")],
output: {
path: __dirname,
filename: "replaced-bundle.js",
},
});
module.exports = [originalBundle, replacedBundle];

Просмотреть файл

@ -0,0 +1,2 @@
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n){window.bar=function(){return new Promise(e=>setTimeout(e,100))},window.foo=async function(){await bar(),console.log("YO")},console.log("HEY")}]);
//# sourceMappingURL=bundle.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,6 @@
// Pad the name with "_" in order to match the same length as removedOriginal
// and set the column breakpoints on the same column!
window.____newOriginal = function ____newOriginal() {
console.log("New original");
}
window.____newOriginal();

Просмотреть файл

@ -0,0 +1,2 @@
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n,t){e.exports=t(1)},function(e,n){window.____newOriginal=function(){console.log("New original")},window.____newOriginal()}]);
//# sourceMappingURL=replaced-bundle.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,41 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
};
if (webpack.version && webpack.version[0] === "4") {
// Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
// Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
config.mode = "production";
} else {
// Also Webpack 4 doesn't support the module.loaders attribute
config.module = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
};
}
const originalBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js",
},
});
const replacedBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "new-original.js")],
output: {
path: __dirname,
filename: "replaced-bundle.js",
},
});
module.exports = [originalBundle, replacedBundle];

Просмотреть файл

@ -0,0 +1,2 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t){window.bar=function(){return new Promise(e=>setTimeout(e,100))}}]);
//# sourceMappingURL=bundle.js.map

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./original.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","window","bar","Promise","resolve","setTimeout"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,gDClFrDC,OAAOC,IAAM,WACX,OAAO,IAAIC,QAAQC,GAAWC,WAAWD,EAAS","file":"bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","window.bar = function bar() {\n return new Promise(resolve => setTimeout(resolve, 100))\n}\n"],"sourceRoot":""}

Просмотреть файл

@ -0,0 +1,31 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
};
if (webpack.version && webpack.version[0] === "4") {
// Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
// Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
config.mode = "production";
} else {
// Also Webpack 4 doesn't support the module.loaders attribute
config.module = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
};
}
module.exports = Object.assign({}, config, {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js",
},
});

Просмотреть файл

@ -0,0 +1,11 @@
### Steps to Rebuild
1. make changes to files within v1, v2, v3,... folders (update package.json if you add more folders/versions)
2. run `yarn` to install webpack & babel
3. run `yarn run pack`
4. also go rebuild bundles in ../sourcemaps-reload-compressed/
There are two distinct source folders as their package.json file is different.
They use different webpack/babel versions.
This also allows to detect the webpack version from webpack.config.js
and use different settings in order to compress or not.

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "sourcemaps-reload",
"name": "sourcemaps-reload-uncompressed",
"version": "1.0.0",
"description": "Rebuild assets for sourcemaps-reload test, see README.md in the same folder",
"description": "Rebuild assets for sourcemaps-reload-uncompressed test, see README.md in the same folder",
"scripts": {
"pack": "cd v1 && webpack && cd ../v2 && webpack && cd ../v3 && webpack",
"test": "echo \"Error: no test specified\" && exit 1"

Просмотреть файл

@ -0,0 +1,21 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<script src="script.js"></script>
<script src="bundle.js"></script>
<script src="replaced-bundle.js"></script>
<head>
<meta charset="utf-8"/>
<title>Empty test page 1</title>
</head>
<body>
<script>
// Comment
console.log('breakable-line');
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,8 @@
window.bar = function bar() {
return new Promise(resolve => setTimeout(resolve, 100))
}
window.foo = async function foo() {
await bar();
console.log("YO")
}

Просмотреть файл

@ -0,0 +1,5 @@
// Add two comment lines, to match the one from new-original.js and have same
// breakpoint positions..............................
window.removedOriginal = function removedOriginal() {
console.log("Removed original");
}

Просмотреть файл

@ -74,6 +74,8 @@ module.exports = __webpack_require__(1);
/* 1 */
/***/ (function(module, exports) {
// Add two comment lines, to match the one from new-original.js and have same
// breakpoint positions..............................
window.removedOriginal = function removedOriginal() {
console.log("Removed original");
};

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 450f2ed5071212525ef7","webpack:///./removed-original.js"],"names":["window","removedOriginal","console","log"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;;AC7DA;AACA;AACAA,OAAOC,eAAP,GAAyB,SAASA,eAAT,GAA2B;AAClDC,UAAQC,GAAR,CAAY,kBAAZ;AACD,CAFD,C","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 450f2ed5071212525ef7","// Add two comment lines, to match the one from new-original.js and have same\n// breakpoint positions..............................\nwindow.removedOriginal = function removedOriginal() {\n console.log(\"Removed original\");\n}\n\n\n\n// WEBPACK FOOTER //\n// ./removed-original.js"],"sourceRoot":""}

Просмотреть файл

@ -0,0 +1,2 @@
console.log("only one breakable line");
// And one non-breakable line

Просмотреть файл

@ -0,0 +1,41 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
};
if (webpack.version && webpack.version[0] === "4") {
// Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
// Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
config.mode = "production";
} else {
// Also Webpack 4 doesn't support the module.loaders attribute
config.module = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
};
}
const originalBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js",
},
});
const replacedBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "removed-original.js")],
output: {
path: __dirname,
filename: "replaced-bundle.js",
},
});
module.exports = [originalBundle, replacedBundle];

Просмотреть файл

@ -0,0 +1,21 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<script src="script.js"></script>
<script src="bundle.js"></script>
<script src="replaced-bundle.js"></script>
<head>
<meta charset="utf-8"/>
<title>Empty test page 2</title>
</head>
<body>
<script>
console.log('breakable-line');
// Comment
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,6 @@
// Pad the name with "_" in order to match the same length as removedOriginal
// and set the column breakpoints on the same column!
window.____newOriginal = function ____newOriginal() {
console.log("New original");
}
window.____newOriginal();

Просмотреть файл

@ -0,0 +1,13 @@
window.bar = function bar() {
return new Promise(resolve => setTimeout(resolve, 100))
}
window.foo = async function foo() {
await bar();
console.log("YO")
}
console.log("HEY")

Просмотреть файл

@ -74,10 +74,12 @@ module.exports = __webpack_require__(1);
/* 1 */
/***/ (function(module, exports) {
window.newOriginal = function newOriginal() {
// Pad the name with "_" in order to match the same length as removedOriginal
// and set the column breakpoints on the same column!
window.____newOriginal = function ____newOriginal() {
console.log("New original");
};
window.newOriginal();
window.____newOriginal();
/***/ })
/******/ ]);

Просмотреть файл

@ -0,0 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 70ef17637fbc0da592a3","webpack:///./new-original.js"],"names":["window","____newOriginal","console","log"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;;AC7DA;AACA;AACAA,OAAOC,eAAP,GAAyB,SAASA,eAAT,GAA2B;AAClDC,UAAQC,GAAR,CAAY,cAAZ;AACD,CAFD;AAGAH,OAAOC,eAAP,G","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 70ef17637fbc0da592a3","// Pad the name with \"_\" in order to match the same length as removedOriginal\n// and set the column breakpoints on the same column!\nwindow.____newOriginal = function ____newOriginal() {\n console.log(\"New original\");\n}\nwindow.____newOriginal();\n\n\n\n// WEBPACK FOOTER //\n// ./new-original.js"],"sourceRoot":""}

Просмотреть файл

@ -0,0 +1,22 @@
// Single line comment <<=== this is line 1
console.log("body instruction");
/* Multi
* line
* comment
*/
function bodyFunction() {
// Inline comment
/* Inline
* multiline comment
*/
function inlineFunction() {
console.log("nested instruction");
}
const inlineCount = 1;
let inlineLet = 2;
var inlineVar = 3;
console.log("inline instruction");
}
const bodyCount = 1;
let bodyLet = 2;
var bodyVar = 3;

Просмотреть файл

@ -0,0 +1,41 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
};
if (webpack.version && webpack.version[0] === "4") {
// Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
// Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
config.mode = "production";
} else {
// Also Webpack 4 doesn't support the module.loaders attribute
config.module = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
};
}
const originalBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js",
},
});
const replacedBundle = Object.assign({}, config, {
entry: [path.join(__dirname, "new-original.js")],
output: {
path: __dirname,
filename: "replaced-bundle.js",
},
});
module.exports = [originalBundle, replacedBundle];

Просмотреть файл

@ -0,0 +1,16 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<script src="script.js"></script>
<script src="bundle.js"></script>
<head>
<meta charset="utf-8"/>
<title>Empty test page 3</title>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -0,0 +1,3 @@
window.bar = function bar() {
return new Promise(resolve => setTimeout(resolve, 100))
}

Просмотреть файл

@ -0,0 +1 @@
// empty file

Просмотреть файл

@ -0,0 +1,31 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
};
if (webpack.version && webpack.version[0] === "4") {
// Webpack 3, used in sourcemaps-reload-uncompressed, doesn't support mode attribute.
// Webpack 4, used in sourcemaps-reload-compressed we want production mode in order to compress the sources
config.mode = "production";
} else {
// Also Webpack 4 doesn't support the module.loaders attribute
config.module = {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
};
}
module.exports = Object.assign({}, config, {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js",
},
});

Просмотреть файл

@ -1,5 +0,0 @@
### Steps to Rebuild
1. make changes to files within v1, v2, v3,... folders (update package.json if you add more folders/versions)
2. run `yarn` to install webpack & babel
3. run `yarn run pack`

Просмотреть файл

@ -1,3 +0,0 @@
window.removedOriginal = function removedOriginal() {
console.log("Removed original");
}

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 5cd42dca73a658e6c5e2","webpack:///./removed-original.js"],"names":["window","removedOriginal","console","log"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;;AC7DAA,OAAOC,eAAP,GAAyB,SAASA,eAAT,GAA2B;AAClDC,UAAQC,GAAR,CAAY,kBAAZ;AACD,CAFD,C","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5cd42dca73a658e6c5e2","window.removedOriginal = function removedOriginal() {\n console.log(\"Removed original\");\n}\n\n\n\n// WEBPACK FOOTER //\n// ./removed-original.js"],"sourceRoot":""}

Просмотреть файл

@ -1,39 +0,0 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
},
plugins: [
],
};
const originalBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "original.js"),
],
output: {
path: __dirname,
filename: "bundle.js"
},
});
const replacedBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "removed-original.js"),
],
output: {
path: __dirname,
filename: "replaced-bundle.js"
},
});
module.exports = [originalBundle, replacedBundle];

Просмотреть файл

@ -1,4 +0,0 @@
window.newOriginal = function newOriginal() {
console.log("New original");
}
window.newOriginal();

Просмотреть файл

@ -1 +0,0 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 130724960e68b3d578a1","webpack:///./new-original.js"],"names":["window","newOriginal","console","log"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,KAAK;QACL;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;;;;;;;;;;;;;;AC7DAA,OAAOC,WAAP,GAAqB,SAASA,WAAT,GAAuB;AAC1CC,UAAQC,GAAR,CAAY,cAAZ;AACD,CAFD;AAGAH,OAAOC,WAAP,G","file":"replaced-bundle.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 130724960e68b3d578a1","window.newOriginal = function newOriginal() {\n console.log(\"New original\");\n}\nwindow.newOriginal();\n\n\n\n// WEBPACK FOOTER //\n// ./new-original.js"],"sourceRoot":""}

Просмотреть файл

@ -1,39 +0,0 @@
const path = require("path");
const webpack = require("webpack");
const config = {
devtool: "sourcemap",
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
},
plugins: [
],
};
const originalBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "original.js"),
],
output: {
path: __dirname,
filename: "bundle.js"
},
});
const replacedBundle = Object.assign({}, config, {
entry: [
path.join(__dirname, "new-original.js"),
],
output: {
path: __dirname,
filename: "replaced-bundle.js"
},
});
module.exports = [originalBundle, replacedBundle];

Просмотреть файл

@ -1,22 +0,0 @@
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: [path.join(__dirname, "original.js")],
output: {
path: __dirname,
filename: "bundle.js"
},
devtool: "sourcemap",
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
},
plugins: [
]
};

Просмотреть файл

@ -31,3 +31,68 @@ Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/shared-head.js",
this
);
/**
* Helper function for `_loadAllIntegrationTests`.
*
* Implements this as a global method in order to please eslint.
* This will be used by modules loaded from "integration-tests" folder
* in order to register a new integration task, ran when executing `runAllIntegrationTests`.
*/
const integrationTasks = [];
function addIntegrationTask(fun) {
integrationTasks.push(fun);
}
/**
* Helper function for `runAllIntegrationTests`.
*
* Loads all the modules from "integration-tests" folder and return
* all the task they implemented and registered by calling `addIntegrationTask`.
*/
function _loadAllIntegrationTests() {
const testsDir = getChromeDir(getResolvedURI(gTestPath));
testsDir.append("integration-tests");
const entries = testsDir.directoryEntries;
const urls = [];
while (entries.hasMoreElements()) {
const file = entries.nextFile;
const url = Services.io.newFileURI(file).spec;
if (url.endsWith(".js")) {
urls.push(url);
}
}
// We need to sort in order to run the test in a reliable order
urls.sort();
for (const url of urls) {
Services.scriptloader.loadSubScript(url, this);
}
return integrationTasks;
}
/**
* Method to be called by each integration tests which will
* run all the "integration tasks" implemented in files from the "integration-tests" folder.
* These files should call the `addIntegrationTask()` method to register something to run.
*
* @param {String} testFolder
* Define what folder in "examples" folder to load before opening the debugger.
* This is meant to be a versionized test folder with v1, v2, v3 folders.
* (See createVersionizedHttpTestServer())
* @param {Object} env
* Environment object passed down to each task to better know
* which particular integration test is being run.
*/
async function runAllIntegrationTests(testFolder, env) {
const tasks = _loadAllIntegrationTests();
const testServer = createVersionizedHttpTestServer("examples/" + testFolder);
const testUrl = testServer.urlFor("index.html");
for (const task of tasks) {
info(` ==> Running integration task '${task.name}'`);
await task(testServer, testUrl, env);
}
}

Просмотреть файл

@ -0,0 +1,156 @@
/* 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/>. */
/* import-globals-from ../head.js */
/**
* This first test will focus on original.js file whose content changes
* which affects the related generated file: bundle.js
*/
"use strict";
addIntegrationTask(async function testReloadingStableOriginalSource(
testServer,
testUrl,
{ isCompressed }
) {
info(" # Test reload a stable source whose content changes");
const dbg = await initDebuggerWithAbsoluteURL(testUrl, "original.js");
info("Add initial breakpoint");
await selectSource(dbg, "original.js");
await addBreakpoint(dbg, "original.js", 6);
info("Check that only one breakpoint is set");
is(dbg.selectors.getBreakpointCount(), 1, "Only one breakpoint exists");
info("Check that the breakpoint location info is correct");
let breakpoint = dbg.selectors.getBreakpointsList(dbg)[0];
is(breakpoint.location.line, 6);
if (isCompressed) {
is(breakpoint.generatedLocation.line, 1);
is(breakpoint.generatedLocation.column, 1056);
} else {
is(breakpoint.generatedLocation.line, 82);
}
const expectedOriginalFileContentOnBreakpointLine = "await bar();";
const expectedGeneratedFileContentOnBreakpointLine = "await bar();";
info("Check that the breakpoint is displayed on the correct line in the ui");
await assertBreakpoint(dbg, 6);
info("Check that breakpoint is on the first line within the function `foo`");
assertTextContentOnLine(dbg, 6, expectedOriginalFileContentOnBreakpointLine);
info(
"Check that the breakpoint is displayed in correct location in bundle.js (generated source)"
);
await selectSource(dbg, "bundle.js");
if (isCompressed) {
await assertBreakpoint(dbg, 1);
} else {
await assertBreakpoint(dbg, 82);
assertTextContentOnLine(
dbg,
82,
expectedGeneratedFileContentOnBreakpointLine
);
}
await closeTab(dbg, "bundle.js");
info("Reload with a new version of the file");
const waitUntilNewBreakpointIsSet = waitForDispatch(
dbg.store,
"SET_BREAKPOINT"
);
testServer.switchToNextVersion();
await reload(dbg, "bundle.js", "original.js");
await waitUntilNewBreakpointIsSet;
info("Check that only one breakpoint is set");
is(dbg.selectors.getBreakpointCount(), 1, "Only one breakpoint exists");
info("Check that the original location has changed");
breakpoint = dbg.selectors.getBreakpointsList(dbg)[0];
is(breakpoint.location.line, 9);
if (isCompressed) {
is(breakpoint.generatedLocation.line, 1);
is(breakpoint.generatedLocation.column, 1056);
} else {
is(breakpoint.generatedLocation.line, 82);
}
info("Invoke `foo` to trigger breakpoint");
invokeInTab("foo");
await waitForPaused(dbg);
info("Check that the breakpoint is displayed and paused on the correct line");
const originalSource = findSource(dbg, "original.js");
await assertPausedAtSourceAndLine(dbg, originalSource.id, 9);
await assertBreakpoint(dbg, 9);
info(
"Check that though the breakpoint has moved, it is still on the first line within the function `foo`"
);
assertTextContentOnLine(dbg, 9, expectedOriginalFileContentOnBreakpointLine);
info(
"Check that the breakpoint is displayed in correct location in bundle.js (generated source)"
);
await selectSource(dbg, "bundle.js");
// This scrolls the line into view so the content
// on the line is rendered and avaliable for dom querying.
getCM(dbg).scrollIntoView({ line: 82, ch: 0 });
const generatedSource = findSource(dbg, "bundle.js");
if (isCompressed) {
await assertBreakpoint(dbg, 1);
await assertPausedAtSourceAndLine(dbg, generatedSource.id, 1, 1056);
} else {
await assertBreakpoint(dbg, 82);
await assertPausedAtSourceAndLine(dbg, generatedSource.id, 82);
}
if (!isCompressed) {
assertTextContentOnLine(
dbg,
82,
expectedGeneratedFileContentOnBreakpointLine
);
}
await closeTab(dbg, "bundle.js");
await resume(dbg);
info("Add a second breakpoint");
await addBreakpoint(dbg, "original.js", 13);
is(dbg.selectors.getBreakpointCount(dbg), 2, "Two breakpoints exist");
info("Check that the original location of the new breakpoint is correct");
breakpoint = dbg.selectors.getBreakpointsList(dbg)[1];
is(breakpoint.location.line, 13);
if (isCompressed) {
is(breakpoint.generatedLocation.line, 1);
is(breakpoint.generatedLocation.column, 1089);
} else {
is(breakpoint.generatedLocation.line, 86);
}
// NOTE: When we reload, the `foo` function no longer exists
// and the original.js file is now 3 lines long
info("Reload and observe no breakpoints");
testServer.switchToNextVersion();
await reload(dbg, "original.js");
// There will initially be zero breakpoints, but wait to make sure none are
// installed while syncing.
await wait(1000);
assertNotPaused(dbg);
is(dbg.selectors.getBreakpointCount(dbg), 0, "No breakpoints");
});

Просмотреть файл

@ -0,0 +1,102 @@
/* 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/>. */
/* import-globals-from ../head.js */
/**
* This second test will focus on removed-original.js which is an original source mapped file.
* This source is mapped to replaced-bundle.js.
* This original source is removed and another original file: new-original.js
* will replace the content of the removed-original.js in the replaced-bundle.js generated file.
* And finally, everything is removed, both original and generated source.
*/
"use strict";
addIntegrationTask(async function testReloadingRemovedOriginalSources(
testServer,
testUrl,
{ isCompressed }
) {
info(" # Test reloading a source that is replaced and then removed");
testServer.backToFirstVersion();
const dbg = await initDebuggerWithAbsoluteURL(testUrl, "removed-original.js");
info("Add initial breakpoint");
await selectSource(dbg, "removed-original.js");
await addBreakpoint(dbg, "removed-original.js", 4);
// Assert the precise behavior of the breakpoint before reloading
invokeInTab("removedOriginal");
await waitForPaused(dbg);
const replacedSource = findSource(dbg, "removed-original.js");
assertPausedAtSourceAndLine(dbg, replacedSource.id, 4);
assertTextContentOnLine(dbg, 4, 'console.log("Removed original");');
await assertBreakpoint(dbg, 4);
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
let breakpoint = dbg.selectors.getBreakpointsList()[0];
is(breakpoint.location.sourceUrl, replacedSource.url);
is(breakpoint.location.line, 4);
if (isCompressed) {
is(breakpoint.generatedLocation.line, 1);
is(breakpoint.generatedLocation.column, 992);
} else {
is(breakpoint.generatedLocation.line, 80);
}
await resume(dbg);
info(
"Reload, which should remove the original file and a add a new original file which will replace its content in the generated file"
);
const syncBp = waitForDispatch(dbg.store, "SET_BREAKPOINT");
testServer.switchToNextVersion();
await reload(dbg);
await syncBp;
// Assert the new breakpoint being created after reload
// For now, the current behavior of the debugger is that:
// the breakpoint is still hit based on the generated source/bundle file
// and the UI updates itself to mention the new original file.
await waitForPaused(dbg);
const newSource = findSource(dbg, "new-original.js");
assertPausedAtSourceAndLine(dbg, newSource.id, 4);
assertTextContentOnLine(dbg, 4, 'console.log("New original");');
await assertBreakpoint(dbg, 4);
is(dbg.selectors.getBreakpointCount(), 1, "One breakpoint exists");
breakpoint = dbg.selectors.getBreakpointsList()[0];
is(breakpoint.location.sourceUrl, newSource.url);
is(breakpoint.location.line, 4);
if (isCompressed) {
is(breakpoint.generatedLocation.line, 1);
is(breakpoint.generatedLocation.column, 992);
} else {
is(breakpoint.generatedLocation.line, 80);
}
await resume(dbg);
info(
"Reload a last time to remove both original and generated sources entirely"
);
testServer.switchToNextVersion();
await reload(dbg);
// Let some time for breakpoint syncing to be buggy and recreated unexpected breakpoint
await wait(1000);
info("Assert that sources and breakpoints are gone and we aren't paused");
ok(
!sourceExists(dbg, "removed-original.js"),
"removed-original is not present"
);
ok(!sourceExists(dbg, "new-original.js"), "new-original is not present");
ok(
!sourceExists(dbg, "replaced-bundle.js"),
"replaced-bundle is not present"
);
assertNotPaused(dbg);
is(dbg.selectors.getBreakpointCount(), 0, "We no longer have any breakpoint");
});

Просмотреть файл

@ -0,0 +1,29 @@
# Integration tests folder
This folder contains all the sub tests ran by the integration tests.
The integration tests are in the parent folder and are named `browser_dbg-integration-*.js`.
Each time you execute one of the integration tests, all the sub tests implemented in this folder will be ran.
Sub tests will be ran in a precise order, this is why the module names are prefixed by a number.
Sub tests are javascript files which have all typical test helpers available in their scope:
* devtools/client/shared/test/shared-head.js
* devtools/client/debugger/test/mochitest/shared-head.js
They should call the `addIntegrationTask()` method to register a new sub test:
```
addIntegrationTask(async function testMyNewIntegrationSubTest(
testServer,
testUrl,
{ isCompressed }
) {
info("My new integration sub test");
// `testServer` is a reference to the fake http server returned by `createVersionizedHttpTestServer()`.
// This can be useful to better control the actual content delivered by the server.
// `testUrl` is the URL of the test page the the debugger currently inspects.
// The third argument is the environment object, that helps know which particular integration test currently runs.
// You may have different assertions based on the actual test that runs.
});
```

Просмотреть файл

@ -2287,7 +2287,7 @@ function createVersionizedHttpTestServer(testFolderName) {
if (request.path == "/" || request.path == "/index.html") {
response.setHeader("Content-Type", "text/html");
}
const url = `${URL_ROOT}examples/${testFolderName}/v${currentVersion}${request.path}`;
const url = `${URL_ROOT}${testFolderName}/v${currentVersion}${request.path}`;
info(`[test-http-server] serving: ${url}`);
const content = await fetch(url);
const text = await content.text();

Просмотреть файл

@ -128,7 +128,7 @@ class HTTPCustomRequestPanel extends Component {
};
Services.prefs.setCharPref(
"devtools.netmonitor.features.newEditAndResendState",
"devtools.netmonitor.customRequest",
JSON.stringify(this.state)
);
@ -152,7 +152,7 @@ class HTTPCustomRequestPanel extends Component {
const persistedState = this.getStateFromPref();
Services.prefs.setCharPref(
"devtools.netmonitor.features.newEditAndResendState",
"devtools.netmonitor.customRequest",
JSON.stringify({ ...persistedState, ...nextState })
);
}
@ -160,9 +160,7 @@ class HTTPCustomRequestPanel extends Component {
getStateFromPref() {
try {
return JSON.parse(
Services.prefs.getCharPref(
"devtools.netmonitor.features.newEditAndResendState"
)
Services.prefs.getCharPref("devtools.netmonitor.customRequest")
);
} catch (_) {
return {};

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function() {
// Turn true the pref
await pushPref("devtools.netmonitor.features.newEditAndResend", true);
// Resetting the pref
await pushPref("devtools.netmonitor.features.newEditAndResendState", "");
await pushPref("devtools.netmonitor.customRequest", "");
const { monitor } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
requestCount: 1,
@ -77,7 +77,7 @@ add_task(async function() {
// Turn true the pref
await pushPref("devtools.netmonitor.features.newEditAndResend", true);
// Resetting the pref
await pushPref("devtools.netmonitor.features.newEditAndResendState", "");
await pushPref("devtools.netmonitor.customRequest", "");
const { tab, monitor } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
requestCount: 1,
@ -129,7 +129,7 @@ add_task(async function() {
// Turn true the pref
await pushPref("devtools.netmonitor.features.newEditAndResend", true);
// Resetting the pref
await pushPref("devtools.netmonitor.features.newEditAndResendState", "");
await pushPref("devtools.netmonitor.customRequest", "");
const { tab, monitor } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
requestCount: 1,
@ -178,7 +178,7 @@ add_task(async function() {
// Turn on the pref
await pushPref("devtools.netmonitor.features.newEditAndResend", true);
// Resetting the pref
await pushPref("devtools.netmonitor.features.newEditAndResendState", "");
await pushPref("devtools.netmonitor.customRequest", "");
const { monitor, tab } = await initNetMonitor(HTTPS_CUSTOM_GET_URL, {
requestCount: 1,

Просмотреть файл

@ -2684,9 +2684,9 @@ class PropertyDefiner:
name,
len(specs),
condition.prefFuncIndex,
condition.nonExposedGlobals,
toStringBool(condition.secureContext),
condition.trial,
condition.nonExposedGlobals,
condition.func,
)
)

Просмотреть файл

@ -113,6 +113,8 @@ static const uint32_t WorkerDebuggerGlobalScope = 1u << 4;
static const uint32_t WorkletGlobalScope = 1u << 5;
static const uint32_t AudioWorkletGlobalScope = 1u << 6;
static const uint32_t PaintWorkletGlobalScope = 1u << 7;
static constexpr uint32_t kCount = 8;
} // namespace GlobalNames
struct PrefableDisablers {
@ -147,14 +149,15 @@ struct PrefableDisablers {
// Index into the array of StaticPrefs
const WebIDLPrefIndex prefIndex;
// A boolean indicating whether a Secure Context is required.
const bool secureContext;
// An origin trial controlling the feature.
const OriginTrial trial;
// Bitmask of global names that we should not be exposed in.
const uint16_t nonExposedGlobals;
const uint16_t nonExposedGlobals : GlobalNames::kCount;
// A boolean indicating whether a Secure Context is required.
const uint16_t secureContext : 1;
// An origin trial controlling the feature. This can be made a bitfield too if
// needed.
const OriginTrial trial;
// A function pointer to a function that can say the property is disabled
// even if "enabled" is set to true. If the pointer is null the value of

Просмотреть файл

@ -14,9 +14,12 @@ using namespace layers;
namespace gfx {
VRLayerParent::VRLayerParent(uint32_t aVRDisplayID, const uint32_t aGroup)
: mIPCOpen(true), mVRDisplayID(aVRDisplayID), mGroup(aGroup) {}
: mIPCOpen(true), mDestroyed(false), mGroup(aGroup) {}
VRLayerParent::~VRLayerParent() { MOZ_COUNT_DTOR(VRLayerParent); }
VRLayerParent::~VRLayerParent() {
Destroy();
MOZ_COUNT_DTOR(VRLayerParent);
}
mozilla::ipc::IPCResult VRLayerParent::RecvDestroy() {
Destroy();
@ -26,12 +29,10 @@ mozilla::ipc::IPCResult VRLayerParent::RecvDestroy() {
void VRLayerParent::ActorDestroy(ActorDestroyReason aWhy) { mIPCOpen = false; }
void VRLayerParent::Destroy() {
if (mVRDisplayID) {
if (!mDestroyed) {
VRManager* vm = VRManager::Get();
vm->RemoveLayer(this);
// 0 will never be a valid VRDisplayID; we can use it to indicate that
// we are destroyed and no longer associated with a display.
mVRDisplayID = 0;
mDestroyed = true;
}
if (mIPCOpen) {
@ -42,7 +43,7 @@ void VRLayerParent::Destroy() {
mozilla::ipc::IPCResult VRLayerParent::RecvSubmitFrame(
const layers::SurfaceDescriptor& aTexture, const uint64_t& aFrameId,
const gfx::Rect& aLeftEyeRect, const gfx::Rect& aRightEyeRect) {
if (mVRDisplayID) {
if (!mDestroyed) {
VRManager* vm = VRManager::Get();
vm->SubmitFrame(this, aTexture, aFrameId, aLeftEyeRect, aRightEyeRect);
}

Просмотреть файл

@ -23,7 +23,6 @@ class VRLayerParent : public PVRLayerParent {
const layers::SurfaceDescriptor& aTexture, const uint64_t& aFrameId,
const gfx::Rect& aLeftEyeRect, const gfx::Rect& aRightEyeRect) override;
virtual mozilla::ipc::IPCResult RecvDestroy() override;
uint32_t GetDisplayID() const { return mVRDisplayID; }
uint32_t GetGroup() const { return mGroup; }
protected:
@ -34,7 +33,7 @@ class VRLayerParent : public PVRLayerParent {
bool mIPCOpen;
uint32_t mVRDisplayID;
bool mDestroyed;
gfx::Rect mLeftEyeRect;
gfx::Rect mRightEyeRect;
uint32_t mGroup;

Просмотреть файл

@ -55,8 +55,20 @@ bool RenderTextureHostSWGL::UpdatePlanes(RenderCompositor* aCompositor,
}
break;
case gfx::SurfaceFormat::NV12:
MOZ_ASSERT(colorDepth == gfx::ColorDepth::COLOR_8);
internalFormat = i > 0 ? LOCAL_GL_RG8 : LOCAL_GL_R8;
switch (colorDepth) {
case gfx::ColorDepth::COLOR_8:
internalFormat = i > 0 ? LOCAL_GL_RG8 : LOCAL_GL_R8;
break;
case gfx::ColorDepth::COLOR_10:
case gfx::ColorDepth::COLOR_12:
case gfx::ColorDepth::COLOR_16:
internalFormat = i > 0 ? LOCAL_GL_RG16 : LOCAL_GL_R16;
break;
}
break;
case gfx::SurfaceFormat::P010:
MOZ_ASSERT(colorDepth == gfx::ColorDepth::COLOR_10);
internalFormat = i > 0 ? LOCAL_GL_RG16 : LOCAL_GL_R16;
break;
case gfx::SurfaceFormat::YUV422:
MOZ_ASSERT(colorDepth == gfx::ColorDepth::COLOR_8);
@ -164,6 +176,7 @@ bool RenderTextureHostSWGL::LockSWGLCompositeSurface(
switch (GetFormat()) {
case gfx::SurfaceFormat::YUV:
case gfx::SurfaceFormat::NV12:
case gfx::SurfaceFormat::P010:
case gfx::SurfaceFormat::YUV422: {
aInfo->yuv_planes = mPlanes.size();
auto colorSpace = GetYUVColorSpace();

Просмотреть файл

@ -256,6 +256,8 @@ static int bytes_for_internal_format(GLenum internal_format) {
return 2;
case GL_R16:
return 2;
case GL_RG16:
return 4;
default:
debugf("internal format: %x\n", internal_format);
assert(0);
@ -279,6 +281,8 @@ static TextureFormat gl_format_to_texture_format(int type) {
return TextureFormat::RG8;
case GL_R16:
return TextureFormat::R16;
case GL_RG16:
return TextureFormat::RG16;
case GL_RGB_RAW_422_APPLE:
return TextureFormat::YUV422;
default:
@ -1745,6 +1749,8 @@ GLenum internal_format_for_data(GLenum format, GLenum ty) {
return GL_RGB_RAW_422_APPLE;
} else if (format == GL_RED && ty == GL_UNSIGNED_SHORT) {
return GL_R16;
} else if (format == GL_RG && ty == GL_UNSIGNED_SHORT) {
return GL_RG16;
} else {
debugf("unknown internal format for format %x, type %x\n", format, ty);
assert(false);

Просмотреть файл

@ -34,6 +34,7 @@ typedef intptr_t GLintptr;
#define GL_RGBA8 0x8058
#define GL_R8 0x8229
#define GL_R16 0x822A
#define GL_RG16 0x822C
#define GL_RGBA32I 0x8D82
#define GL_BGRA8 0x93A1
#define GL_RG8 0x822B

Просмотреть файл

@ -8,7 +8,7 @@
namespace glsl {
enum TextureFormat { RGBA32F, RGBA32I, RGBA8, R8, RG8, R16, YUV422 };
enum TextureFormat { RGBA32F, RGBA32I, RGBA8, R8, RG8, R16, RG16, YUV422 };
enum TextureFilter { NEAREST, LINEAR };

Просмотреть файл

@ -1035,7 +1035,7 @@ template <typename S0, typename S1>
static ALWAYS_INLINE PackedRGBA8 sampleYUV(S0 sampler0, ivec2 uv0, S1 sampler1,
ivec2 uv1,
const YUVMatrix& rgb_from_ycbcr,
UNUSED int rescaleFactor) {
int rescaleFactor) {
switch (sampler1->format) {
case TextureFormat::RG8: {
assert(sampler0->format == TextureFormat::R8);
@ -1051,6 +1051,21 @@ static ALWAYS_INLINE PackedRGBA8 sampleYUV(S0 sampler0, ivec2 uv0, S1 sampler1,
return convertYUV(rgb_from_ycbcr, y, lowHalf(planar.ba),
highHalf(planar.rg));
}
case TextureFormat::RG16: {
assert(sampler0->format == TextureFormat::R16);
// The rescaling factor represents how many bits to add to renormalize the
// texture to 16 bits, and so the color depth is actually 16 minus the
// rescaling factor.
// Need to right shift the sample by the amount of bits over 8 it
// occupies. On output from textureLinearUnpackedR16, we have lost 1 bit
// of precision at the low end already, hence 1 is subtracted from the
// color depth.
int colorDepth = 16 - rescaleFactor;
int rescaleBits = (colorDepth - 1) - 8;
auto y = textureLinearUnpackedR16(sampler0, uv0) >> rescaleBits;
auto uv = textureLinearUnpackedRG16(sampler1, uv1) >> rescaleBits;
return rgb_from_ycbcr.convert(zip(y, y), uv);
}
default:
assert(false);
return PackedRGBA8(0);

Просмотреть файл

@ -160,6 +160,21 @@ vec4 texelFetchR16(S sampler, ivec2 P) {
return vec4(fetchOffsetsR16(sampler, offset), 0.0f, 0.0f, 1.0f);
}
template <typename S>
SI vec4 fetchOffsetsRG16(S sampler, I32 offset) {
U32 pixels = {sampler->buf[offset.x], sampler->buf[offset.y],
sampler->buf[offset.z], sampler->buf[offset.w]};
Float r = cast(pixels & 0xFFFF) * (1.0f / 65535.0f);
Float g = cast(pixels >> 16) * (1.0f / 65535.0f);
return vec4(r, g, 0.0f, 1.0f);
}
template <typename S>
vec4 texelFetchRG16(S sampler, ivec2 P) {
I32 offset = P.x + P.y * sampler->stride;
return fetchOffsetsRG16(sampler, offset);
}
SI vec4 fetchOffsetsFloat(const uint32_t* buf, I32 offset) {
return pixel_float_to_vec4(*(Float*)&buf[offset.x], *(Float*)&buf[offset.y],
*(Float*)&buf[offset.z], *(Float*)&buf[offset.w]);
@ -212,6 +227,8 @@ vec4 texelFetch(sampler2D sampler, ivec2 P, int lod) {
return texelFetchRG8(sampler, P);
case TextureFormat::R16:
return texelFetchR16(sampler, P);
case TextureFormat::RG16:
return texelFetchRG16(sampler, P);
case TextureFormat::YUV422:
return texelFetchYUV422(sampler, P);
default:
@ -301,6 +318,8 @@ vec4 texelFetch(sampler2DRect sampler, ivec2 P) {
return texelFetchRG8(sampler, P);
case TextureFormat::R16:
return texelFetchR16(sampler, P);
case TextureFormat::RG16:
return texelFetchRG16(sampler, P);
case TextureFormat::YUV422:
return texelFetchYUV422(sampler, P);
default:
@ -710,6 +729,104 @@ vec4 textureLinearR16(S sampler, vec2 P) {
return vec4(r * (1.0f / 32767.0f), 0.0f, 0.0f, 1.0f);
}
// Samples RG16 texture with linear filtering and returns results packed as
// signed I16. One bit of precision is shifted away from the bottom end to
// accommodate the sign bit, so only 15 bits of precision is left.
template <typename S>
static inline V8<int16_t> textureLinearUnpackedRG16(S sampler, ivec2 i) {
assert(sampler->format == TextureFormat::R16);
ivec2 frac = i;
i >>= 7;
I32 row0 = computeRow(sampler, i);
I32 row1 = row0 + computeNextRowOffset(sampler, i);
I16 fracx =
CONVERT(
((frac.x & (i.x >= 0)) | (i.x > int32_t(sampler->width) - 2)) & 0x7F,
I16)
<< 8;
I16 fracy = computeFracY(frac) << 8;
// Sample the 2x16 bit data for both rows
auto a0 = unaligned_load<V4<uint16_t>>(&sampler->buf[row0.x]);
auto b0 = unaligned_load<V4<uint16_t>>(&sampler->buf[row0.y]);
auto ab0 = CONVERT(combine(a0, b0) >> 1, V8<int16_t>);
auto c0 = unaligned_load<V4<uint16_t>>(&sampler->buf[row0.z]);
auto d0 = unaligned_load<V4<uint16_t>>(&sampler->buf[row0.w]);
auto cd0 = CONVERT(combine(c0, d0) >> 1, V8<int16_t>);
auto a1 = unaligned_load<V4<uint16_t>>(&sampler->buf[row1.x]);
auto b1 = unaligned_load<V4<uint16_t>>(&sampler->buf[row1.y]);
auto ab1 = CONVERT(combine(a1, b1) >> 1, V8<int16_t>);
auto c1 = unaligned_load<V4<uint16_t>>(&sampler->buf[row1.z]);
auto d1 = unaligned_load<V4<uint16_t>>(&sampler->buf[row1.w]);
auto cd1 = CONVERT(combine(c1, d1) >> 1, V8<int16_t>);
// The samples occupy 15 bits and the fraction occupies 15 bits, so that when
// they are multiplied together, the new scaled sample will fit in the high
// 14 bits of the result. It is left shifted once to make it 15 bits again
// for the final multiply.
#if USE_SSE2
ab0 += bit_cast<V8<int16_t>>(_mm_mulhi_epi16(ab1 - ab0, fracy.xxxxyyyy)) << 1;
cd0 += bit_cast<V8<int16_t>>(_mm_mulhi_epi16(cd1 - cd0, fracy.zzzzwwww)) << 1;
#elif USE_NEON
// NEON has a convenient instruction that does both the multiply and the
// doubling, so doesn't need an extra shift.
ab0 += bit_cast<V8<int16_t>>(vqrdmulhq_s16(ab1 - ab0, fracy.xxxxyyyy));
cd0 += bit_cast<V8<int16_t>>(vqrdmulhq_s16(cd1 - cd0, fracy.zzzzwwww));
#else
ab0 += CONVERT((CONVERT(ab1 - ab0, V8<int32_t>) *
CONVERT(fracy.xxxxyyyy, V8<int32_t>)) >>
16,
V8<int16_t>)
<< 1;
cd0 += CONVERT((CONVERT(cd1 - cd0, V8<int32_t>) *
CONVERT(fracy.zzzzwwww, V8<int32_t>)) >>
16,
V8<int16_t>)
<< 1;
#endif
// ab = a.rgRG,b.rgRG
// cd = c.rgRG,d.rgRG
// ... ac = a.rg,c.rg,a.RG,c.RG
// ... bd = b.rg,d.rg,b.RG,d.RG
auto ac = zip2Low(ab0, cd0);
auto bd = zip2High(ab0, cd0);
// a.rg,b.rg,c.rg,d.rg
// a.RG,b.RG,c.RG,d.RG
auto abcdl = zip2Low(ac, bd);
auto abcdh = zip2High(ac, bd);
// Blend columns
#if USE_SSE2
abcdl += bit_cast<V8<int16_t>>(_mm_mulhi_epi16(abcdh - abcdl, fracx.xxyyzzww))
<< 1;
#elif USE_NEON
abcdl += bit_cast<V8<int16_t>>(vqrdmulhq_s16(abcdh - abcdl, fracx.xxyyzzww));
#else
abcdl += CONVERT((CONVERT(abcdh - abcdl, V8<int32_t>) *
CONVERT(fracx.xxyyzzww, V8<int32_t>)) >>
16,
V8<int16_t>)
<< 1;
#endif
return abcdl;
}
template <typename S>
vec4 textureLinearRG16(S sampler, vec2 P) {
assert(sampler->format == TextureFormat::RG16);
ivec2 i(linearQuantize(P, 128, sampler));
auto rg = bit_cast<V4<int32_t>>(textureLinearUnpackedRG16(sampler, i));
auto r = cast(rg & 0xFFFF) * (1.0f / 32767.0f);
auto g = cast(rg >> 16) * (1.0f / 32767.0f);
return vec4(r, g, 0.0f, 1.0f);
}
using PackedRGBA32F = V16<float>;
using WideRGBA32F = V16<float>;
@ -854,6 +971,8 @@ SI vec4 texture(sampler2D sampler, vec2 P) {
return textureLinearRG8(sampler, P);
case TextureFormat::R16:
return textureLinearR16(sampler, P);
case TextureFormat::RG16:
return textureLinearRG16(sampler, P);
case TextureFormat::YUV422:
return textureLinearYUV422(sampler, P);
default:
@ -878,6 +997,8 @@ vec4 texture(sampler2DRect sampler, vec2 P) {
return textureLinearRG8(sampler, P);
case TextureFormat::R16:
return textureLinearR16(sampler, P);
case TextureFormat::RG16:
return textureLinearRG16(sampler, P);
case TextureFormat::YUV422:
return textureLinearYUV422(sampler, P);
default:

Просмотреть файл

@ -55,9 +55,9 @@ void brush_vs(
#ifdef SWGL_DRAW_SPAN
// swgl_commitTextureLinearYUV needs to know the color space specifier and
// also needs to know how many bits of scaling are required to normalize
// HDR textures.
// HDR textures. Note that MSB HDR formats don't need renormalization.
vRescaleFactor = 0;
if (prim.channel_bit_depth > 8) {
if (prim.channel_bit_depth > 8 && prim.yuv_format != YUV_FORMAT_P010) {
vRescaleFactor = 16 - prim.channel_bit_depth;
}
// Since SWGL rescales filtered YUV values to 8bpc before yuv->rgb

Просмотреть файл

@ -92,9 +92,9 @@ void main(void) {
#ifdef SWGL_DRAW_SPAN
// swgl_commitTextureLinearYUV needs to know the color space specifier and
// also needs to know how many bits of scaling are required to normalize
// HDR textures.
// HDR textures. Note that MSB HDR formats don't need renormalization.
vRescaleFactor = 0;
if (prim.channel_bit_depth > 8) {
if (prim.channel_bit_depth > 8 && prim.yuv_format != YUV_FORMAT_P010) {
vRescaleFactor = 16 - prim.channel_bit_depth;
}
// Since SWGL rescales filtered YUV values to 8bpc before yuv->rgb
@ -208,7 +208,7 @@ void swgl_drawSpanRGBA8() {
vYcbcrBias,
vRgbFromDebiasedYcbcr,
vRescaleFactor);
} else if (vYuvFormat.x == YUV_FORMAT_NV12) {
} else if (vYuvFormat.x == YUV_FORMAT_NV12 || vYuvFormat.x == YUV_FORMAT_P010) {
swgl_commitTextureLinearYUV(sColor0, vUV_y, vUVBounds_y,
sColor1, vUV_u, vUVBounds_u,
vYcbcrBias,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше