Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
2010-01-22 Kent Hansen <kent.hansen@nokia.com>
Reviewed by Darin Adler. Object.getOwnPropertyDescriptor(window) returns descriptors for properties in the prototype chain https://bugs.webkit.org/show_bug.cgi?id=33948 Even though prototype properties are proxied by JSDOMWindow::getOwnPropertySlot(), that proxying should not be performed by JSDOMWindow::getOwnPropertyDescriptor(). This makes getOwnPropertyDescriptor() consistent with getOwnPropertyNames(). Test: fast/dom/Window/window-property-descriptors.html * bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getOwnPropertyDescriptor): Canonical link: https://commits.webkit.org/45105@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@53706 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
7 changed files
with
1,511 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,56 @@ | ||
description("Test Object.getOwnPropertyDescriptor on window object."); | ||
|
||
var __skip__ = { | ||
"__skip__" : 1, | ||
"opener" : 1, // Work around DumpRenderTree bug where previous tests add window properties | ||
"Components" : 1, // Work around Firefox exception | ||
|
||
// Don't log DumpRenderTree injected objects | ||
"layoutTestController" : 1, // Work around http://bugs.webkit.org/show_bug.cgi?id=11373 | ||
"GCController" : 1, | ||
"accessibilityController" : 1, | ||
"appleScriptController" : 1, | ||
"eventSender" : 1, | ||
"navigationController" : 1, | ||
"objCController" : 1, | ||
"objCPlugin" : 1, | ||
"objCPluginFunction" : 1, | ||
"plainText" : 1, | ||
"textInputController" : 1, | ||
// Ignore these properties because they do not exist in all implementations. They will be tested separately | ||
"WebGLRenderingContext" : 1, | ||
"WebGLArrayBuffer" : 1, | ||
"WebGLByteArray" : 1, | ||
"WebGLFloatArray" : 1, | ||
"WebGLIntArray" : 1, | ||
"WebGLShortArray" : 1, | ||
"WebGLUnsignedByteArray" : 1, | ||
"WebGLUnsignedIntArray" : 1, | ||
"WebGLUnsignedShortArray" : 1 | ||
}; | ||
|
||
var windowPropertyNames = Object.getOwnPropertyNames(window) | ||
.filter(function(name) { return !__skip__[name]; }) | ||
.sort(); | ||
|
||
for (var i = 0; i < windowPropertyNames.length; ++i) | ||
shouldBe("typeof Object.getOwnPropertyDescriptor(window, '" + windowPropertyNames[i] + "')", "'object'"); | ||
|
||
// Properties in the prototype should not return descriptors | ||
|
||
var protoPropertySet = {}; | ||
for (var o = window.__proto__; o; o = o.__proto__) { | ||
var names = Object.getOwnPropertyNames(o); | ||
for (var i = 0; i < names.length; ++i) | ||
protoPropertySet[names[i]] = true; | ||
} | ||
|
||
var protoPropertyNames = []; | ||
for (var name in protoPropertySet) | ||
protoPropertyNames.push(name); | ||
protoPropertyNames.sort(); | ||
|
||
for (var i = 0; i < protoPropertyNames.length; ++i) | ||
shouldBeUndefined("Object.getOwnPropertyDescriptor(window, '" + protoPropertyNames[i] + "')"); | ||
|
||
var successfullyParsed = true; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="../../js/resources/js-test-style.css"> | ||
<script src="../../js/resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script src="script-tests/window-property-descriptors.js"></script> | ||
<script src="../../js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters