Commit f8e2e224 authored by weinig's avatar weinig
Browse files

LayoutTests:

        Reviewed by Maciej.

        Make sure not to enumerate the toString() function.
        <rdar://problem/5297118>

        * fast/dom/Window/window-appendages-cleared-expected.txt:
        * fast/dom/Window/window-properties-expected.txt:
        * fast/js/toString-dontEnum-expected.txt: Added.
        * fast/js/toString-dontEnum.html: Added.

WebCore:

        Reviewed by Maciej.

        Make sure not to enumerate the toString() function.
        <rdar://problem/5297118>

        * bindings/js/kjs_window.cpp:
        * bindings/scripts/CodeGeneratorJS.pm: Add support for [DontEnum].
        * html/HTMLAnchorElement.idl:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23803 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c60a257a
2007-06-26 Sam Weinig <sam@webkit.org>
Reviewed by Maciej.
Make sure not to enumerate the toString() function.
<rdar://problem/5297118>
* fast/dom/Window/window-appendages-cleared-expected.txt:
* fast/dom/Window/window-properties-expected.txt:
* fast/js/toString-dontEnum-expected.txt: Added.
* fast/js/toString-dontEnum.html: Added.
2007-06-26 Sam Weinig <sam@webkit.org>
 
Reviewed by Geoff.
......@@ -13,7 +13,6 @@ PASS location.protocol == "LEFTOVER" is false
PASS location.reload == "LEFTOVER" is false
PASS location.replace == "LEFTOVER" is false
PASS location.search == "LEFTOVER" is false
PASS location.toString == "LEFTOVER" is false
PASS locationbar.visible == "LEFTOVER" is false
PASS menubar.visible == "LEFTOVER" is false
PASS personalbar.visible == "LEFTOVER" is false
......
......@@ -947,7 +947,6 @@ window.location.protocol [string]
window.location.reload [function]
window.location.replace [function]
window.location.search [string]
window.location.toString [function]
window.locationbar [object BarInfo]
window.locationbar.visible [boolean]
window.log [function]
......@@ -1058,6 +1057,5 @@ window.getSelection().rangeCount [number]
window.getSelection().removeAllRanges [function]
window.getSelection().setBaseAndExtent [function]
window.getSelection().setPosition [function]
window.getSelection().toString [function]
window.getSelection().type [string]
This tests that the toString() function does not enumerate.
PASS: the toString function is not enumerable for HTMLAnchorElement.
PASS: the toString function is not enumerable for Location.
PASS: the toString function is not enumerable for Selection.
PASS: the toString function is not enumerable for HTMLDivElement.
PASS: the toString function is not enumerable for HTMLDocument.
PASS: the toString function is not enumerable for Object.
PASS: the toString function is not enumerable for Array.
<html>
<head>
<script type="text/javascript" charset="utf-8">
function log(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
}
function test(element, name)
{
var didPass = true;
for (prop in element) {
if (prop == "toString")
didPass = false;
}
if (didPass)
log("PASS: the toString function is not enumerable for " + name + ".");
else
log("FAIL: the toString function is enumerable for " + name + " and should not be.");
}
function runTests()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
// DOM objects with custom toString() functions
test(document.createElement('a'), "HTMLAnchorElement");
test(window.location, "Location");
test(window.getSelection(), "Selection");
// Other DOM objects
test(document.createElement('div'), "HTMLDivElement");
test(document, "HTMLDocument");
// JS objects
test({}, "Object");
test([], "Array");
}
</script>
</head>
<body onload="runTests();">
<p>This tests that the toString() function does not enumerate.</p>
<pre id="console"></pre>
</body>
</html>
2007-06-26 Sam Weinig <sam@webkit.org>
Reviewed by Maciej.
Make sure not to enumerate the toString() function.
<rdar://problem/5297118>
* bindings/js/kjs_window.cpp:
* bindings/scripts/CodeGeneratorJS.pm: Add support for [DontEnum].
* html/HTMLAnchorElement.idl:
2007-06-26 Alp Toker <alp.toker@collabora.co.uk>
 
Reviewed by Mitz, landed by Anders.
......@@ -1911,7 +1911,7 @@ const ClassInfo Location::info = { "Location", 0, &LocationTable, 0 };
port Location::Port DontDelete
protocol Location::Protocol DontDelete
search Location::Search DontDelete
toString Location::ToString DontDelete|Function 0
toString Location::ToString DontEnum|DontDelete|Function 0
replace Location::Replace DontDelete|Function 1
reload Location::Reload DontDelete|Function 0
@end
......@@ -2119,7 +2119,7 @@ const ClassInfo Selection::info = { "Selection", 0, &SelectionTable, 0 };
isCollapsed Selection::IsCollapsed DontDelete|ReadOnly
type Selection::_Type DontDelete|ReadOnly
rangeCount Selection::RangeCount DontDelete|ReadOnly
toString Selection::ToString DontDelete|Function 0
toString Selection::ToString DontEnum|DontDelete|Function 0
collapse Selection::Collapse DontDelete|Function 2
collapseToEnd Selection::CollapseToEnd DontDelete|Function 0
collapseToStart Selection::CollapseToStart DontDelete|Function 0
......
......@@ -603,6 +603,7 @@ sub GenerateImplementation
my @specials = ();
push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"};
push(@specials, "DontEnum") if $attribute->signature->extendedAttributes->{"DontEnum"};
push(@specials, "ReadOnly") if $attribute->type =~ /readonly/;
my $special = (@specials > 0) ? join("|", @specials) : "0";
push(@hashSpecials, $special);
......@@ -692,6 +693,7 @@ sub GenerateImplementation
my @specials = ();
push(@specials, "DontDelete") unless $function->signature->extendedAttributes->{"Deletable"};
push(@specials, "DontEnum") if $function->signature->extendedAttributes->{"DontEnum"};
push(@specials, "Function");
my $special = (@specials > 0) ? join("|", @specials) : "0";
push(@hashSpecials, $special);
......
......@@ -48,7 +48,7 @@ module html {
readonly attribute DOMString text;
#if defined(LANGUAGE_JAVASCRIPT)
DOMString toString();
[DontEnum] DOMString toString();
#endif
#if defined(LANGUAGE_OBJECTIVE_C)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment