Commit 18eccf40 authored by ggaren's avatar ggaren

JavaScriptCore:

        Reviewed by Oliver Hunt.
        
        Exposed some extra toUInt32 functionality, as part of the fix for
        REGRESSION: Incomplete document.all implementation breaks abtelectronics.com 
        (Style Change Through JavaScript Blanks Content)

        * JavaScriptCore.exp:
        * kjs/identifier.h:
        (KJS::Identifier::toUInt32):

LayoutTests:

        Reviewed by Oliver Hunt.
        
        Layout test for http://bugs.webkit.org/show_bug.cgi?id=13106
        REGRESSION: Incomplete document.all implementation breaks abtelectronics.com 
        (Style Change Through JavaScript Blanks Content)

        * fast/dom/collection-null-like-arguments-expected.txt: Added.
        * fast/dom/collection-null-like-arguments.html: Added.

WebCore:

        Reviewed by Oliver Hunt.
        
        Fixed http://bugs.webkit.org/show_bug.cgi?id=13106
        REGRESSION: Incomplete document.all implementation breaks abtelectronics.com 
        (Style Change Through JavaScript Blanks Content)
        
        When indexing into collections, treat the empty string as an invalid argument,
        instead of the number 0.

        * bindings/js/kjs_html.cpp:
        (KJS::JSHTMLCollection::getOwnPropertySlot):
        (KJS::JSHTMLCollection::callAsFunction):
        (KJS::JSHTMLCollectionPrototypeFunction::callAsFunction):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20295 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 51f5edb7
2007-03-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Exposed some extra toUInt32 functionality, as part of the fix for
REGRESSION: Incomplete document.all implementation breaks abtelectronics.com
(Style Change Through JavaScript Blanks Content)
* JavaScriptCore.exp:
* kjs/identifier.h:
(KJS::Identifier::toUInt32):
2007-03-18 Geoffrey Garen <ggaren@apple.com>
Removed duplicate export name.
......
......@@ -255,6 +255,7 @@ __ZNK3KJS7UString14toStrictUInt32EPb
__ZNK3KJS7UString5asciiEv
__ZNK3KJS7UString6is8BitEv
__ZNK3KJS7UString8toUInt32EPb
__ZNK3KJS7UString8toUInt32EPbb
__ZNK3KJS8Bindings10RootObject11interpreterEv
__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
......
......@@ -51,6 +51,7 @@ namespace KJS {
bool isEmpty() const { return _ustring.isEmpty(); }
uint32_t toUInt32(bool* ok) const { return _ustring.toUInt32(ok); }
uint32_t toUInt32(bool* ok, bool tolerateEmptyString) const { return _ustring.toUInt32(ok, tolerateEmptyString); };
uint32_t toStrictUInt32(bool* ok) const { return _ustring.toStrictUInt32(ok); }
unsigned toArrayIndex(bool* ok) const { return _ustring.toArrayIndex(ok); }
double toDouble() const { return _ustring.toDouble(); }
......
2007-03-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Layout test for http://bugs.webkit.org/show_bug.cgi?id=13106
REGRESSION: Incomplete document.all implementation breaks abtelectronics.com
(Style Change Through JavaScript Blanks Content)
* fast/dom/collection-null-like-arguments-expected.txt: Added.
* fast/dom/collection-null-like-arguments.html: Added.
2007-03-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
This test reports the value that document.all returns for various null-like arguments.
Written for http://bugs.webkit.org/show_bug.cgi?id=13106.
document.all[0]: [object HTMLHtmlElement]
document.all(0): [object HTMLHtmlElement]
document.all.item(0): [object HTMLHtmlElement]
document.all[""]: undefined
document.all(""): undefined
document.all.item(""): undefined
document.all["0"]: [object HTMLHtmlElement]
document.all("0"): [object HTMLHtmlElement]
document.all.item("0"): [object HTMLHtmlElement]
document.all[undefined]: undefined
document.all(undefined): undefined
document.all.item(undefined): undefined
document.all[null]: undefined
document.all(null): undefined
document.all.item(null): undefined
<p>This test reports the value that document.all returns for various null-like arguments.</p>
<p>Written for <a href="http://bugs.webkit.org/show_bug.cgi?id=13106">http://bugs.webkit.org/show_bug.cgi?id=13106</a>.</p>
<hr>
<pre id="log"></pre>
<script>
function log(s)
{
document.getElementById("log").appendChild(document.createTextNode(s));
}
function getDescription(value)
{
if (value === undefined)
return "undefined";
if (value === null)
return "null";
if (typeof value == "number")
return value;
if (typeof value == "string")
return '"' + value + '"';
return "unkown description";
}
window.onload = function onload()
{
if ("layoutTestController" in this)
layoutTestController.dumpAsText();
var arguments = [
0,
"",
"0",
undefined,
null
];
for (var i = 0; i < arguments.length; i++) { //>
var value = arguments[i];
var description = getDescription(value);
log("document.all[" + description + "]: " + document.all[value] + "\n");
log("document.all(" + description + "): " + document.all(value) + "\n");
log("document.all.item(" + description + "): " + document.all.item(value) + "\n");
log("\n");
}
}
</script>
2007-03-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed http://bugs.webkit.org/show_bug.cgi?id=13106
REGRESSION: Incomplete document.all implementation breaks abtelectronics.com
(Style Change Through JavaScript Blanks Content)
When indexing into collections, treat the empty string as an invalid argument,
instead of the number 0.
* bindings/js/kjs_html.cpp:
(KJS::JSHTMLCollection::getOwnPropertySlot):
(KJS::JSHTMLCollection::callAsFunction):
(KJS::JSHTMLCollectionPrototypeFunction::callAsFunction):
2007-03-18 David Hyatt <hyatt@apple.com>
Use fillRect instead of drawLine, since drawLine has some odd behavior (it's only used for borders).
......
......@@ -1484,7 +1484,7 @@ bool JSHTMLCollection::getOwnPropertySlot(ExecState* exec, const Identifier& pro
// name or index ?
bool ok;
unsigned int u = propertyName.toUInt32(&ok);
unsigned int u = propertyName.toUInt32(&ok, false);
if (ok) {
slot.setCustomIndex(this, u, indexGetter);
return true;
......@@ -1512,7 +1512,7 @@ JSValue *JSHTMLCollection::callAsFunction(ExecState* exec, JSObject* , const Lis
// support for document.all(<index>) etc.
bool ok;
UString s = args[0]->toString(exec);
unsigned int u = s.toUInt32(&ok);
unsigned int u = s.toUInt32(&ok, false);
if (ok)
return toJS(exec, collection.item(u));
// support for document.images('<name>') etc.
......@@ -1522,7 +1522,7 @@ JSValue *JSHTMLCollection::callAsFunction(ExecState* exec, JSObject* , const Lis
{
bool ok;
UString s = args[0]->toString(exec);
unsigned int u = args[1]->toString(exec).toUInt32(&ok);
unsigned int u = args[1]->toString(exec).toUInt32(&ok, false);
if (ok)
{
WebCore::String pstr = s;
......@@ -1565,7 +1565,7 @@ JSValue* JSHTMLCollectionPrototypeFunction::callAsFunction(ExecState* exec, JSOb
case JSHTMLCollection::Item:
{
bool ok;
uint32_t index = args[0]->toUInt32(exec, ok);
uint32_t index = args[0]->toString(exec).toUInt32(&ok, false);
if (ok)
return toJS(exec, coll.item(index));
}
......
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