Backed out 3 changesets (bug 1757809, bug 1755599) for causing bc failures on browser_all_files_referenced.js. CLOSED TREE

Backed out changeset 63ae4c9485e9 (bug 1757809)
Backed out changeset 2297b7533b97 (bug 1755599)
Backed out changeset e021f9e97c76 (bug 1755599)
This commit is contained in:
Marian-Vasile Laza 2022-03-10 12:08:13 -08:00
parent 04af168c74
commit f5642cacbf
15 changed files with 4 additions and 1588 deletions

View File

@ -67,7 +67,7 @@
"cta_url": {
"description": "Target URL for the What's New message.",
"type": "string",
"format": "moz-url-format"
"format": "uri"
},
"cta_type": {
"description": "Type of url open action",

View File

@ -30,8 +30,7 @@
},
"infoLinkUrl": {
"type": "string",
"description": "URL for the info section link.",
"format": "moz-url-format"
"description": "URL for the info section link."
},
"promoEnabled": {
"type": "boolean",
@ -60,8 +59,7 @@
},
"promoLinkUrl": {
"type": "string",
"description": "URL for link in the promo box.",
"format": "moz-url-format"
"description": "URL for link in the promo box."
},
"promoLinkType": {
"type": "string",

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2020 Jeremy Danyow
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,42 +0,0 @@
#!/bin/sh
set -euo pipefail
# Path to mach relative to /third_party/js/cfworker
MACH=$(realpath "../../../mach")
if [[ $(uname -a) == *MSYS* ]]; then
MACH="python ${MACH}"
fi
NODE="${MACH} node"
NPM="${MACH} npm"
# Delete empty vestigial directories.
rm -rf .changeset/ .github/ .vscode/
# Patch typescript config to ensure we have LF endings.
patch tsconfig-base.json tsconfig-base.json.patch
cd packages/json-schema
# Install dependencies.
${NPM} install --also=dev
# Compile TypeScript into JavaScript.
${NPM} run build
# Install rollup and bundle into a single module.
${NPM} install rollup@~2.67.x
${NODE} node_modules/rollup/dist/bin/rollup \
dist/index.js \
--file json-schema.js \
--format cjs
cd ../..
# Patch the CommonJS module into a regular JS file and include a copyright notice.
patch packages/json-schema/json-schema.js json-schema.jsm.patch
awk -f exports.awk packages/json-schema/json-schema.js >json-schema.js
# Remove source files we no longer need.
rm -rf packages/ tsconfig-base.json

View File

@ -1,20 +0,0 @@
#!/bin/awk -f
BEGIN {
n_exports = 0;
}
{
if ($0 ~ /^exports.*=/) {
exports[n_exports] = substr($3, 0, length($3) - 1);
n_exports++;
} else {
print;
}
}
END {
for (i = 0; i < n_exports; i++) {
print "this." exports[i] " = " exports[i] ";";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
--- json-schema.jsm
+++ json-schema.jsm
@@ -1,6 +1,26 @@
-'use strict';
+/*
+ * Copyright (c) 2020 Jeremy Danyow
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
-Object.defineProperty(exports, '__esModule', { value: true });
+'use strict';
function deepCompareStrict(a, b) {
const typeofa = typeof a;

View File

@ -1,44 +0,0 @@
schema: 1
bugzilla:
product: Toolkit
component: General
origin:
name: "cfworker"
description: A JSON schema validator
url: https://github.com/cfworker/cfworker/tree/main/packages/json-schema
license: MIT
release: commit @cfworker/dev@1.13.2 (2022-01-23T22:05:24+00:00).
revision: "v1.10.1"
vendoring:
url: https://github.com/cfworker/cfworker
source-hosting: github
tracking: tag
skip-vendoring-steps: ["update-moz-build"]
keep:
- build.sh
- exports.awk
- json-schema.jsm.patch
- tsconfig-base.json.patch
exclude:
- "**"
- ".*"
- ".changeset"
- ".github"
- ".vscode"
include:
- LICENSE.md
- packages/json-schema/src
- packages/json-schema/package.json
- packages/json-schema/tsconfig.json
- tsconfig-base.json
update-actions:
- action: run-script
script: 'build.sh'
cwd: '{yaml_dir}'

View File

@ -1,9 +0,0 @@
--- tsconfig-base.json
+++ tsconfig-base.json
@@ -1,5 +1,6 @@
{
"compilerOptions": {
+ "newLine": "lf",
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true,

View File

@ -114,5 +114,4 @@ toolkit.jar:
content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json)
# Third party files
content/global/third_party/d3/d3.js (/third_party/js/d3/d3.js)
content/global/third_party/cfworker/json-schema.js (/third_party/js/cfworker/json-schema.js)
content/global/third_party/d3/d3.js (/third_party/js/d3/d3.js)

View File

@ -77,7 +77,6 @@
<li><a href="about:license#bspatch">bspatch License</a></li>
<li><a href="about:license#byteorder">byteorder License</a></li>
<li><a href="about:license#cairo">Cairo Component Licenses</a></li>
<li><a href="about:license#cfworker">cfworker License</a></li>
<li><a href="about:license#chromium">Chromium License</a></li>
<li><a href="about:license#codemirror">CodeMirror License</a></li>
<li><a href="about:license#cryptogams">CRYPTOGAMS License</a></li>
@ -2351,35 +2350,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
</pre>
<hr>
<h1><a id="cfworker"></a>cfworker License</h1>
<p>This license applies to the file <code>toolkit/content/third_party/cfworker/json-schema.js</code></p>
<pre>
MIT License
Copyright (c) 2020 Jeremy Danyow
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</pre>
<hr>
<h1><a id="chromium"></a>Chromium License</h1>

View File

@ -1,116 +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/. */
"use strict";
/**
* A facade around @cfworker/json-schema that provides additional formats and
* convenience methods whil executing inside a sandbox.
*/
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const sandbox = new Cu.Sandbox(null, {
wantComponents: false,
wantGlobalProperties: ["URL"],
});
Services.scriptloader.loadSubScript(
"chrome://global/content/third_party/cfworker/json-schema.js",
sandbox
);
/**
* A JSON Schema string format for URLs intended to go through Services.urlFormatter.
*/
Cu.exportFunction(
function validateMozUrlFormat(input) {
try {
const formatted = Services.urlFormatter.formatURL(input);
return Cu.waiveXrays(sandbox.fastFormat).uri(formatted);
} catch {
return false;
}
},
sandbox.fastFormat,
{ defineAs: "moz-url-format" }
);
/**
* A JSONSchema validator that performs validation inside a sandbox.
*/
class Validator {
#inner;
/**
* Create a new validator.
*
* @param {object} schema The schema to validate with.
* @param {string} draft The draft to validate against. Should
* be one of "4", "7", "2019-09".
* @param {boolean} shortCircuit Whether or not the validator should return
* after a single error occurs.
*/
constructor(schema, draft = "2019-09", shortCircuit = true) {
this.#inner = Cu.waiveXrays(
new sandbox.Validator(Cu.cloneInto(schema, sandbox), draft, shortCircuit)
);
}
/**
* Validate the instance against the known schemas.
*
* @param {object} instance The instance to validate.
*
* @return {object} An object with |valid| and |errors| keys that indicates
* the success of validation.
*/
validate(instance) {
return this.#inner.validate(Cu.cloneInto(instance, sandbox));
}
/**
* Add a schema to the validator.
*
* @param {object} schema A JSON schema object.
* @param {string} id An optional ID to identify the schema if it does not
* provide an |$id| field.
*/
addSchema(schema, id) {
this.#inner.addSchema(Cu.cloneInto(schema, sandbox), id);
}
}
/**
* A wrapper around validate that provides some options as an object
* instead of positional arguments.
*
* @param {object} instance The instance to validate.
* @param {object} schema The JSON schema to validate against.
* @param {object} options Options for the validator.
* @param {string} options.draft The draft to validate against. Should
* be one of "4", "7", "2019-09".
* @param {boolean} options.shortCircuit Whether or not the validator should
* return after a single error occurs.
*
* @returns {object} An object with |valid| and |errors| keys that indicates the
* success of validation.
*/
function validate(
instance,
schema,
{ draft = "2019-09", shortCircuit = true } = {}
) {
const clonedSchema = Cu.cloneInto(schema, sandbox);
return sandbox.validate(
Cu.cloneInto(instance, sandbox),
clonedSchema,
draft,
sandbox.dereference(clonedSchema),
shortCircuit
);
}
const EXPORTED_SYMBOLS = ["Validator", "validate", "sandbox"];

View File

@ -183,7 +183,6 @@ EXTRA_JS_MODULES += [
"InlineSpellCheckerContent.jsm",
"Integration.jsm",
"JSONFile.jsm",
"JsonSchema.jsm",
"KeywordUtils.jsm",
"LayoutUtils.jsm",
"Log.jsm",

View File

@ -1,86 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const JsonSchema = ChromeUtils.import("resource://gre/modules/JsonSchema.jsm");
add_task(function test_basicSchema() {
info("Testing validation of a basic schema");
const schema = {
type: "object",
properties: {
id: { type: "number" },
},
required: ["id"],
};
const validator = new JsonSchema.Validator(schema);
Assert.deepEqual(
JsonSchema.validate({ id: 123 }, schema),
{ valid: true, errors: [] },
"Validation of basic schemas with validate()"
);
Assert.deepEqual(
validator.validate({ id: 123 }, schema),
{ valid: true, errors: [] },
"Validation of basic schemas with Validator"
);
Assert.ok(
!JsonSchema.validate({}, schema).valid,
"Validation of basic schemas with validate()"
);
Assert.ok(
!validator.validate({}).valid,
"Validation of basic schemas with Validator"
);
});
add_task(function test_mozUrlFormat() {
info("Testing custom string format 'moz-url-format'");
const schema = {
type: "string",
format: "moz-url-format",
};
{
const obj = "https://www.mozilla.org/%LOCALE%/";
Assert.deepEqual(
JsonSchema.validate(obj, schema),
{ valid: true, errors: [] },
"Substitution of a valid variable validates"
);
}
{
const obj = "https://mozilla.org/%BOGUS%/";
Assert.equal(
Services.urlFormatter.formatURL(obj),
obj,
"BOGUS is an invalid variable for the URL formatter service"
);
Assert.ok(
!JsonSchema.validate(obj, { type: "string", format: "uri" }).valid,
"A moz-url-format string does not validate as a URI"
);
Assert.deepEqual(
JsonSchema.validate(obj, schema),
{
valid: false,
errors: [
{
instanceLocation: "#",
keyword: "format",
keywordLocation: "#/format",
error: `String does not match format "moz-url-format".`,
},
],
},
"Substitution of an invalid variable does not validate"
);
}
});

View File

@ -36,7 +36,6 @@ tags = remote-settings
[test_Integration.js]
[test_jsesc.js]
[test_JSONFile.js]
[test_JsonSchema.js]
[test_Log.js]
[test_MatchURLFilters.js]
[test_NewTabUtils.js]