Skip to content

Commit e1c3ab9

Browse files
committed
No longer test EXTEND_PROTOYPES .. the last usage is removed in >= 6.0
1 parent 15b938e commit e1c3ab9

File tree

5 files changed

+16
-46
lines changed

5 files changed

+16
-46
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ jobs:
9898
- name: "Production build, with optional features"
9999
BUILD: "production"
100100
ENABLE_OPTIONAL_FEATURES: "true"
101-
- name: "Extend prototypes"
102-
EXTEND_PROTOTYPES: "true"
103-
RAISE_ON_DEPRECATION: "false"
104-
- name: "Extend prototypes, with optional features"
105-
EXTEND_PROTOTYPES: "true"
106-
ENABLE_OPTIONAL_FEATURES: "true"
107-
RAISE_ON_DEPRECATION: "false"
108101

109102
steps:
110103
- uses: actions/checkout@v4
@@ -115,7 +108,6 @@ jobs:
115108
env:
116109
ALL_DEPRECATIONS_ENABLED: ${{ matrix.ALL_DEPRECATIONS_ENABLED }}
117110
OVERRIDE_DEPRECATION_VERSION: ${{ matrix.OVERRIDE_DEPRECATION_VERSION }}
118-
EXTEND_PROTOTYPES: ${{ matrix.EXTEND_PROTOTYPES }}
119111
ENABLE_OPTIONAL_FEATURES: ${{ matrix.ENABLE_OPTIONAL_FEATURES }}
120112
RAISE_ON_DEPRECATION: ${{ matrix.RAISE_ON_DEPRECATION }}
121113

bin/run-tests.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ const variants = [
1818
// hit its "until" version, the tests for it will behave correctly.
1919
'OVERRIDE_DEPRECATION_VERSION',
2020

21-
// This enables the legacy Ember feature that causes Ember to extend built-in
22-
// platform features like Array.
23-
'EXTEND_PROTOTYPES',
24-
2521
// This enables all canary feature flags for unreleased feature within Ember
2622
// itself.
2723
'ENABLE_OPTIONAL_FEATURES',

index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
EmberENV.__test_hook_count__ += object;
2525
});
2626

27-
// Handle extending prototypes
28-
EmberENV['EXTEND_PROTOTYPES'] = !!QUnit.urlParams.EXTEND_PROTOTYPES;
29-
3027
// Handle testing feature flags
3128
if (QUnit.urlParams.ENABLE_OPTIONAL_FEATURES) {
3229
EmberENV.ENABLE_OPTIONAL_FEATURES = true;

packages/@ember/-internals/environment/lib/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export const ENV = {
2626
@type Boolean
2727
@default true
2828
@for EmberENV
29-
@public
29+
@private
3030
@deprecated in v5.10
3131
*/
3232
EXTEND_PROTOTYPES: {
33-
Array: true,
33+
Array: false,
3434
},
3535

3636
/**

packages/@ember/array/index.ts

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { assert } from '@ember/debug';
1717
import Enumerable from '@ember/enumerable';
1818
import MutableEnumerable from '@ember/enumerable/mutable';
1919
import { compare, typeOf } from '@ember/utils';
20-
import { ENV } from '@ember/-internals/environment';
2120
import Observable from '@ember/object/observable';
2221
import type { MethodNamesOf, MethodParams, MethodReturns } from '@ember/-internals/utility-types';
2322
import type { ComputedPropertyCallback } from '@ember/-internals/metal';
@@ -2094,34 +2093,20 @@ NativeArray = NativeArray.without(...ignore);
20942093

20952094
let A: <T>(arr?: Array<T>) => NativeArray<T>;
20962095

2097-
if (ENV.EXTEND_PROTOTYPES.Array) {
2098-
NativeArray.apply(Array.prototype, true);
2099-
2100-
A = function <T>(this: unknown, arr?: Array<T>) {
2101-
assert(
2102-
'You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`',
2103-
!(this instanceof A)
2104-
);
2105-
2106-
// SAFTEY: Since we are extending prototypes all true native arrays are Ember NativeArrays
2107-
return (arr || []) as NativeArray<T>;
2108-
};
2109-
} else {
2110-
A = function <T>(this: unknown, arr?: Array<T>) {
2111-
assert(
2112-
'You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`',
2113-
!(this instanceof A)
2114-
);
2115-
2116-
if (isEmberArray(arr)) {
2117-
// SAFETY: If it's a true native array and it is also an EmberArray then it should be an Ember NativeArray
2118-
return arr as unknown as NativeArray<T>;
2119-
} else {
2120-
// SAFETY: This will return an NativeArray but TS can't infer that.
2121-
return NativeArray.apply(arr ?? []) as NativeArray<T>;
2122-
}
2123-
};
2124-
}
2096+
A = function <T>(this: unknown, arr?: Array<T>) {
2097+
assert(
2098+
'You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`',
2099+
!(this instanceof A)
2100+
);
2101+
2102+
if (isEmberArray(arr)) {
2103+
// SAFETY: If it's a true native array and it is also an EmberArray then it should be an Ember NativeArray
2104+
return arr as unknown as NativeArray<T>;
2105+
} else {
2106+
// SAFETY: This will return an NativeArray but TS can't infer that.
2107+
return NativeArray.apply(arr ?? []) as NativeArray<T>;
2108+
}
2109+
};
21252110

21262111
export { A, NativeArray, MutableArray };
21272112

0 commit comments

Comments
 (0)