{"size": 1236, "ext": "js", "max_stars_repo_path": "third_party/WebKit/LayoutTests/fast/dom/Window/script-tests/window-custom-prototype.js", "max_stars_repo_name": "google-ar/chromium", "max_stars_repo_stars_event_min_datetime": "2017-08-29T15:15:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T05:29:41.000Z", "max_issues_repo_path": "third_party/WebKit/LayoutTests/fast/dom/Window/script-tests/window-custom-prototype.js", "max_issues_repo_name": "harrymarkovskiy/WebARonARCore", "max_issues_repo_issues_event_min_datetime": "2017-08-30T18:31:18.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-02T10:59:35.000Z", "max_forks_repo_path": "third_party/WebKit/LayoutTests/fast/dom/Window/script-tests/window-custom-prototype.js", "max_forks_repo_name": "harrymarkovskiy/WebARonARCore", "max_forks_repo_forks_event_min_datetime": "2017-08-30T01:19:34.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-17T22:55:31.000Z"}
{"max_stars_count": 777, "max_issues_count": 66, "max_forks_count": 123, "avg_line_length": 58.8571428571, "max_line_length": 102, "alphanum_fraction": 0.7758899676}
description("Test what happens when you set the window's prototype to various values.");

var originalWindowPrototype = __proto__;
var chainPointingBackToWindow = { __proto__: window };
var anotherObject = { };
var error = "'TypeError: Immutable prototype object \\'#<Window>\\' cannot have their prototype set'";

shouldThrow("__proto__ = window; __proto__", error);
shouldThrow("__proto__ = chainPointingBackToWindow; __proto__", error);
shouldBe("__proto__ = 1; __proto__", "originalWindowPrototype");
shouldBe("__proto__ = 'a string'; __proto__", "originalWindowPrototype");
shouldThrow("__proto__ = anotherObject; __proto__", error);
shouldBe("anotherObject.__proto__ = window; __proto__", "originalWindowPrototype");
shouldBe("__proto__ = 1; __proto__", "originalWindowPrototype");
shouldBe("__proto__ = 'a string'; __proto__", "originalWindowPrototype");
shouldThrow("__proto__ = anotherObject; __proto__", error);
shouldBe("__proto__ = originalWindowPrototype; __proto__", "originalWindowPrototype");
shouldBe("anotherObject.__proto__ = window; anotherObject.__proto__", "window");
shouldThrow("__proto__ = null; __proto__", error);
shouldThrow("location.__proto__.__proto__ = location", "'TypeError: Cyclic __proto__ value'");
