Skip to content

Commit 27021cc

Browse files
madblexgithub-actions[bot]
authored andcommitted
Release build 11.4.0 [ci release]
1 parent 9eea407 commit 27021cc

File tree

54 files changed

+1873
-920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1873
-920
lines changed

CHANGELOG.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
- NTP: More omnibar design feedback (#1876)
2-
- NTP: Remove search icon and input suffix from omnibar, tweak surface colours (#1871)
3-
- NTP: Swap “Show Duck.ai” / “Hide Duck.ai” link for a Duck.ai toggle (#1870)
4-
- Add typing method to urlChanged method (#1869)
5-
- Add screenshot tests for omnibar widget states (#1868)
1+
- NTP: Omnibar design fixes i2 (#1889)
2+
- Fix context menu by filtering fake widgets starting with underscore (#1888)
3+
- build(deps): bump @rive-app/canvas-single from 2.30.4 to 2.31.1 (#1885)
4+
- build(deps-dev): bump eslint from 9.32.0 to 9.33.0 in the eslint group (#1886)
5+
- build(deps): bump immutable-json-patch from 6.0.1 to 6.0.2 (#1873)
6+
- Inject name conditional (#1884)
7+
- Remove console.log from url-change.js (#1877)
8+
- Match on frame conditional (#1725)

build/android/autofillPasswordImport.js

Lines changed: 74 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,26 +1817,25 @@
18171817
copy2[symbol] = value[symbol];
18181818
});
18191819
return copy2;
1820-
} else if (isJSONObject(value)) {
1820+
}
1821+
if (isJSONObject(value)) {
18211822
const copy2 = {
18221823
...value
18231824
};
18241825
Object.getOwnPropertySymbols(value).forEach((symbol) => {
18251826
copy2[symbol] = value[symbol];
18261827
});
18271828
return copy2;
1828-
} else {
1829-
return value;
18301829
}
1830+
return value;
18311831
}
18321832
function applyProp(object, key, value) {
18331833
if (object[key] === value) {
18341834
return object;
1835-
} else {
1836-
const updatedObject = shallowClone(object);
1837-
updatedObject[key] = value;
1838-
return updatedObject;
18391835
}
1836+
const updatedObject = shallowClone(object);
1837+
updatedObject[key] = value;
1838+
return updatedObject;
18401839
}
18411840
function getIn(object, path) {
18421841
let value = object;
@@ -1845,7 +1844,7 @@
18451844
if (isJSONObject(value)) {
18461845
value = value[path[i]];
18471846
} else if (isJSONArray(value)) {
1848-
value = value[parseInt(path[i])];
1847+
value = value[Number.parseInt(path[i])];
18491848
} else {
18501849
value = void 0;
18511850
}
@@ -1862,15 +1861,13 @@
18621861
const updatedValue = setIn(object ? object[key] : void 0, path.slice(1), value, createPath);
18631862
if (isJSONObject(object) || isJSONArray(object)) {
18641863
return applyProp(object, key, updatedValue);
1865-
} else {
1866-
if (createPath) {
1867-
const newObject = IS_INTEGER_REGEX.test(key) ? [] : {};
1868-
newObject[key] = updatedValue;
1869-
return newObject;
1870-
} else {
1871-
throw new Error("Path does not exist");
1872-
}
18731864
}
1865+
if (createPath) {
1866+
const newObject = IS_INTEGER_REGEX.test(key) ? [] : {};
1867+
newObject[key] = updatedValue;
1868+
return newObject;
1869+
}
1870+
throw new Error("Path does not exist");
18741871
}
18751872
var IS_INTEGER_REGEX = /^\d+$/;
18761873
function updateIn(object, path, transform) {
@@ -1895,16 +1892,15 @@
18951892
const key2 = path[0];
18961893
if (!(key2 in object)) {
18971894
return object;
1898-
} else {
1899-
const updatedObject = shallowClone(object);
1900-
if (isJSONArray(updatedObject)) {
1901-
updatedObject.splice(parseInt(key2), 1);
1902-
}
1903-
if (isJSONObject(updatedObject)) {
1904-
delete updatedObject[key2];
1905-
}
1906-
return updatedObject;
19071895
}
1896+
const updatedObject = shallowClone(object);
1897+
if (isJSONArray(updatedObject)) {
1898+
updatedObject.splice(Number.parseInt(key2), 1);
1899+
}
1900+
if (isJSONObject(updatedObject)) {
1901+
delete updatedObject[key2];
1902+
}
1903+
return updatedObject;
19081904
}
19091905
const key = path[0];
19101906
const updatedValue = deleteIn(object[key], path.slice(1));
@@ -1915,10 +1911,10 @@
19151911
const index = path[path.length - 1];
19161912
return updateIn(document2, parentPath, (items) => {
19171913
if (!Array.isArray(items)) {
1918-
throw new TypeError("Array expected at path " + JSON.stringify(parentPath));
1914+
throw new TypeError(`Array expected at path ${JSON.stringify(parentPath)}`);
19191915
}
19201916
const updatedItems = shallowClone(items);
1921-
updatedItems.splice(parseInt(index), 0, value);
1917+
updatedItems.splice(Number.parseInt(index), 0, value);
19221918
return updatedItems;
19231919
});
19241920
}
@@ -1945,7 +1941,7 @@
19451941
return path.map(compileJSONPointerProp).join("");
19461942
}
19471943
function compileJSONPointerProp(pathProp) {
1948-
return "/" + String(pathProp).replace(/~/g, "~0").replace(/\//g, "~1");
1944+
return `/${String(pathProp).replace(/~/g, "~0").replace(/\//g, "~1")}`;
19491945
}
19501946

19511947
// ../node_modules/immutable-json-patch/lib/esm/immutableJSONPatch.js
@@ -1954,7 +1950,7 @@
19541950
for (let i = 0; i < operations.length; i++) {
19551951
validateJSONPatchOperation(operations[i]);
19561952
let operation = operations[i];
1957-
if (options && options.before) {
1953+
if (options?.before) {
19581954
const result = options.before(updatedDocument, operation);
19591955
if (result !== void 0) {
19601956
if (result.document !== void 0) {
@@ -1983,9 +1979,9 @@
19831979
} else if (operation.op === "test") {
19841980
test(updatedDocument, path, operation.value);
19851981
} else {
1986-
throw new Error("Unknown JSONPatch operation " + JSON.stringify(operation));
1982+
throw new Error(`Unknown JSONPatch operation ${JSON.stringify(operation)}`);
19871983
}
1988-
if (options && options.after) {
1984+
if (options?.after) {
19891985
const result = options.after(updatedDocument, operation, previousDocument);
19901986
if (result !== void 0) {
19911987
updatedDocument = result;
@@ -1995,26 +1991,23 @@
19951991
return updatedDocument;
19961992
}
19971993
function replace(document2, path, value) {
1998-
return setIn(document2, path, value);
1994+
return existsIn(document2, path) ? setIn(document2, path, value) : document2;
19991995
}
20001996
function remove(document2, path) {
20011997
return deleteIn(document2, path);
20021998
}
20031999
function add(document2, path, value) {
20042000
if (isArrayItem(document2, path)) {
20052001
return insertAt(document2, path, value);
2006-
} else {
2007-
return setIn(document2, path, value);
20082002
}
2003+
return setIn(document2, path, value);
20092004
}
20102005
function copy(document2, path, from) {
20112006
const value = getIn(document2, from);
20122007
if (isArrayItem(document2, path)) {
20132008
return insertAt(document2, path, value);
2014-
} else {
2015-
const value2 = getIn(document2, from);
2016-
return setIn(document2, path, value2);
20172009
}
2010+
return setIn(document2, path, value);
20182011
}
20192012
function move(document2, path, from) {
20202013
const value = getIn(document2, from);
@@ -2051,14 +2044,14 @@
20512044
function validateJSONPatchOperation(operation) {
20522045
const ops = ["add", "remove", "replace", "copy", "move", "test"];
20532046
if (!ops.includes(operation.op)) {
2054-
throw new Error("Unknown JSONPatch op " + JSON.stringify(operation.op));
2047+
throw new Error(`Unknown JSONPatch op ${JSON.stringify(operation.op)}`);
20552048
}
20562049
if (typeof operation.path !== "string") {
2057-
throw new Error('Required property "path" missing or not a string in operation ' + JSON.stringify(operation));
2050+
throw new Error(`Required property "path" missing or not a string in operation ${JSON.stringify(operation)}`);
20582051
}
20592052
if (operation.op === "copy" || operation.op === "move") {
20602053
if (typeof operation.from !== "string") {
2061-
throw new Error('Required property "from" missing or not a string in operation ' + JSON.stringify(operation));
2054+
throw new Error(`Required property "from" missing or not a string in operation ${JSON.stringify(operation)}`);
20622055
}
20632056
}
20642057
}
@@ -2887,6 +2880,13 @@
28872880
get featureSettings() {
28882881
return __privateGet(this, _args)?.featureSettings;
28892882
}
2883+
/**
2884+
* Getter for injectName, will be overridden by subclasses (namely ContentFeature)
2885+
* @returns {string | undefined}
2886+
*/
2887+
get injectName() {
2888+
return void 0;
2889+
}
28902890
/**
28912891
* Given a config key, interpret the value as a list of conditionals objects, and return the elements that match the current page
28922892
* Consider in your feature using patchSettings instead as per `getFeatureSetting`.
@@ -2925,6 +2925,10 @@
29252925
* @property {object} [experiment]
29262926
* @property {string} [experiment.experimentName]
29272927
* @property {string} [experiment.cohort]
2928+
* @property {object} [context]
2929+
* @property {boolean} [context.frame] - true if the condition applies to frames
2930+
* @property {boolean} [context.top] - true if the condition applies to the top frame
2931+
* @property {string} [injectName] - the inject name to match against (e.g., "apple-isolated")
29282932
*/
29292933
/**
29302934
* Takes multiple conditional blocks and returns true if any apply.
@@ -2946,9 +2950,11 @@
29462950
_matchConditionalBlock(conditionBlock) {
29472951
const conditionChecks = {
29482952
domain: this._matchDomainConditional,
2953+
context: this._matchContextConditional,
29492954
urlPattern: this._matchUrlPatternConditional,
29502955
experiment: this._matchExperimentConditional,
2951-
minSupportedVersion: this._matchMinSupportedVersion
2956+
minSupportedVersion: this._matchMinSupportedVersion,
2957+
injectName: this._matchInjectNameConditional
29522958
};
29532959
for (const key in conditionBlock) {
29542960
if (!conditionChecks[key]) {
@@ -2984,6 +2990,22 @@
29842990
return cohort.feature === "contentScopeExperiments" && cohort.subfeature === experiment.experimentName && cohort.cohort === experiment.cohort;
29852991
});
29862992
}
2993+
/**
2994+
* Takes a condition block and returns true if the current context matches the context.
2995+
* @param {ConditionBlock} conditionBlock
2996+
* @returns {boolean}
2997+
*/
2998+
_matchContextConditional(conditionBlock) {
2999+
if (!conditionBlock.context) return false;
3000+
const isFrame = window.self !== window.top;
3001+
if (conditionBlock.context.frame && isFrame) {
3002+
return true;
3003+
}
3004+
if (conditionBlock.context.top && !isFrame) {
3005+
return true;
3006+
}
3007+
return false;
3008+
}
29873009
/**
29883010
* Takes a condtion block and returns true if the current url matches the urlPattern.
29893011
* @param {ConditionBlock} conditionBlock
@@ -3012,6 +3034,17 @@
30123034
}
30133035
return matchHostname(domain, conditionBlock.domain);
30143036
}
3037+
/**
3038+
* Takes a condition block and returns true if the current inject name matches the injectName.
3039+
* @param {ConditionBlock} conditionBlock
3040+
* @returns {boolean}
3041+
*/
3042+
_matchInjectNameConditional(conditionBlock) {
3043+
if (!conditionBlock.injectName) return false;
3044+
const currentInjectName = this.injectName;
3045+
if (!currentInjectName) return false;
3046+
return conditionBlock.injectName === currentInjectName;
3047+
}
30153048
/**
30163049
* Takes a condition block and returns true if the platform version satisfies the `minSupportedFeature`
30173050
* @param {ConditionBlock} conditionBlock
@@ -3889,7 +3922,6 @@
38893922
const historyMethodProxy = new DDGProxy(urlChangedInstance, History.prototype, "pushState", {
38903923
apply(target, thisArg, args) {
38913924
const changeResult = DDGReflect.apply(target, thisArg, args);
3892-
console.log("pushstate event");
38933925
handleURLChange("push");
38943926
return changeResult;
38953927
}

0 commit comments

Comments
 (0)