Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
72 lines (53 loc) · 2.47 KB

File metadata and controls

72 lines (53 loc) · 2.47 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var x = [];
x[2] = 5;
x.foo = 3;
Object.defineProperty(x, '1', {
get: function () { return this.foo + 1; },
set: function (x) { this.foo = x / 2; }
});
Object.defineProperty(x, 11, {
get: function () { return this.foo; }
});
var simpleArrayEmptyLength = [];
Object.defineProperty(simpleArrayEmptyLength, "length", {});
var aFixedInfo = [0, 1, 2, 3, 4, 5];
Object.defineProperty(aFixedInfo, "length", { writable: false });
Object.defineProperty(aFixedInfo, "2", { writable: false });
var aFrozen = [0, 1, 2, 3, 4, 5];
Object.freeze(aFrozen);
var oIncFreeze = [0, 1, 2, 3, 4, 5];
for (var i = 0; i < oIncFreeze.length; i++)
{
Object.defineProperty(oIncFreeze, i, { writable: false, configurable: false });
}
Object.preventExtensions(oIncFreeze);
WScript.SetTimeout(testFunction, 50);
/////////////////
function testFunction()
{
telemetryLog(`Array.isArray(x): ${Array.isArray(x)}`, true); //true
telemetryLog(`x.foo: ${x.foo}`, true); //3
telemetryLog(`x[1]: ${x[1]}`, true); //4
telemetryLog(`x[11]: ${x[11]}`, true); //3
////
x[1] = 12;
////
telemetryLog(`x[1]: ${x[1]}`, true); //7
telemetryLog(`x[11]: ${x[11]}`, true); //6
////
telemetryLog(`Object.getOwnPropertyDescriptor(simpleArrayEmptyLength.length): ${JSON.stringify(Object.getOwnPropertyDescriptor(simpleArrayEmptyLength, "length"))}`, true); //asdf
aFixedInfo[9] = 9; // This would throw in strict mode
telemetryLog(`aFixedInfo: ${JSON.stringify(aFixedInfo)}`, true); //0, 1, 2, 3, 4, 5
aFixedInfo[1] = -1;
aFixedInfo[2] = -2;
telemetryLog(`aFixedInfo: ${JSON.stringify(aFixedInfo)}`, true); //0, 1, 2, 3, 4, 5
telemetryLog(`Object.getOwnPropertyDescriptor(aFrozen.length): ${JSON.stringify(Object.getOwnPropertyDescriptor(aFrozen, "length"))}`, true); //asdf
telemetryLog(`isFrozen: ${Object.isFrozen(oIncFreeze)}`, true); // false, because length writable
Object.defineProperty(oIncFreeze, "length", { writable: false });
telemetryLog(`isFrozen: ${Object.isFrozen(oIncFreeze)}`, true);
emitTTDLog(ttdLogURI);
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.