Commit fb0910db authored by weinig's avatar weinig
Browse files

LayoutTests:

        Reviewed by Darin.

        Update tests now that window.frames points to window and not FrameArray
        (which has been removed).

        * fast/dom/Window/resources/window-appendages-cleared-results.html:
        * fast/dom/Window/window-appendages-cleared-expected.txt:
        * fast/dom/Window/window-appendages-cleared.html:
        * fast/dom/Window/window-properties-expected.txt:
        * fast/js/toString-and-valueOf-override-expected.txt:
        * fast/js/toString-and-valueOf-override.html:

WebCore:

        Reviewed by Darin.

        Remove the FrameArray class and instead make window.frames another
        self-reference for window (like window.window, window.self, etc).
        This is what Firefox and what the HTML5 dictates.

        * bindings/js/kjs_window.cpp:
        (KJS::WindowPrivate::WindowPrivate):
        (KJS::Window::mark):
        (KJS::Window::getValueProperty):
        (KJS::Window::clearHelperObjectProperties):
        (KJS::Window::disconnectFrame):
        * bindings/js/kjs_window.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23567 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 72b53161
2007-06-18 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Update tests now that window.frames points to window and not FrameArray
(which has been removed).
* fast/dom/Window/resources/window-appendages-cleared-results.html:
* fast/dom/Window/window-appendages-cleared-expected.txt:
* fast/dom/Window/window-appendages-cleared.html:
* fast/dom/Window/window-properties-expected.txt:
* fast/js/toString-and-valueOf-override-expected.txt:
* fast/js/toString-and-valueOf-override.html:
2007-06-18 Mitz Pettel <mitz@webkit.org>
 
Reviewed by Adele.
......@@ -23,7 +23,6 @@ function checkForLeftoverProperties(string, object)
}
checkForLeftoverProperties("history", window.history);
checkForLeftoverProperties("frames", frames);
checkForLeftoverProperties("location", location);
checkForLeftoverProperties("locationbar", locationbar);
checkForLeftoverProperties("menubar", menubar);
......
......@@ -2,8 +2,6 @@ PASS history.back == "LEFTOVER" is false
PASS history.forward == "LEFTOVER" is false
PASS history.go == "LEFTOVER" is false
PASS history.length == "LEFTOVER" is false
PASS frames.length == "LEFTOVER" is false
PASS frames.location == "LEFTOVER" is false
PASS location.assign == "LEFTOVER" is false
PASS location.hash == "LEFTOVER" is false
PASS location.host == "LEFTOVER" is false
......
......@@ -12,9 +12,6 @@ history.back = "LEFTOVER";
history.forward = "LEFTOVER";
history.randomProperty = "LEFTOVER";
frames.location = "LEFTOVER";
frames.length = "LEFTOVER";
frames.randomProperty = "LEFTOVER";
location.assign = "LEFTOVER";
location.reload = "LEFTOVER";
location.toString = "LEFTOVER";
......
......@@ -923,21 +923,7 @@ window.find [function]
window.flushLog [function]
window.focus [function]
window.frameElement [undefined]
window.frames [object FrameArray]
window.frames.length [number]
window.frames.location [object Location]
window.frames.location.assign [function]
window.frames.location.hash [string]
window.frames.location.host [string]
window.frames.location.hostname [string]
window.frames.location.href [string]
window.frames.location.pathname [string]
window.frames.location.port [string]
window.frames.location.protocol [string]
window.frames.location.reload [function]
window.frames.location.replace [function]
window.frames.location.search [string]
window.frames.location.toString [function]
window.frames [printed above as window]
window.getComputedStyle [function]
window.getMatchedCSSRules [function]
window.getSelection [function]
......@@ -949,7 +935,19 @@ window.history.length [number]
window.innerHeight [number]
window.innerWidth [number]
window.length [number]
window.location [printed above as window.frames.location]
window.location [object Location]
window.location.assign [function]
window.location.hash [string]
window.location.host [string]
window.location.hostname [string]
window.location.href [string]
window.location.pathname [string]
window.location.port [string]
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]
......
......@@ -241,87 +241,6 @@ Exception
Exception
Unmodified FrameArray
FrameArray : [object FrameArray]
[FrameArray] : [object FrameArray]
String(FrameArray) : [object FrameArray]
String([FrameArray]) : [object FrameArray]
FrameArray.toString() : [object FrameArray]
[FrameArray].toString() : [object FrameArray]
FrameArray.valueOf() : [object FrameArray]
[FrameArray].valueOf() : [object FrameArray]
FrameArray with modified toString and valueOf
FrameArray : valueOf
[FrameArray] : toString
String(FrameArray) : toString
String([FrameArray]) : toString
FrameArray.toString() : toString
[FrameArray].toString() : toString
FrameArray.valueOf() : valueOf
[FrameArray].valueOf() : toString
FrameArray with modified toString that returns an Object
FrameArray : valueOf
[FrameArray] : valueOf
String(FrameArray) : valueOf
String([FrameArray]) : valueOf
FrameArray.toString() : [object Object]
[FrameArray].toString() : valueOf
FrameArray.valueOf() : valueOf
[FrameArray].valueOf() : valueOf
FrameArray with modified valueOf that returns an Object
FrameArray : toString
[FrameArray] : toString
String(FrameArray) : toString
String([FrameArray]) : toString
FrameArray.toString() : toString
[FrameArray].toString() : toString
FrameArray.valueOf() : [object Object]
[FrameArray].valueOf() : toString
FrameArray with modified toString and valueOf that returns an Object
TypeError: No default value
TypeError: No default value
TypeError: No default value
TypeError: No default value
FrameArray.toString() : [object Object]
TypeError: No default value
FrameArray.valueOf() : [object Object]
TypeError: No default value
FrameArray with modified toString that throws an exception
FrameArray : valueOf
Exception
Exception
Exception
Exception
Exception
FrameArray.valueOf() : valueOf
Exception
FrameArray with modified valueOf that throws an exception
Exception
[FrameArray] : toString
String(FrameArray) : toString
String([FrameArray]) : toString
FrameArray.toString() : toString
[FrameArray].toString() : toString
Exception
[FrameArray].valueOf() : toString
FrameArray with modified toString an valueOf that throw exceptions
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Exception
Unmodified History
History : [object History]
[History] : [object History]
......
......@@ -76,7 +76,6 @@
test('window', window);
test('Navigator', window.navigator);
test('FrameArray', window.frames);
test('History', window.history);
test('Selection', window.getSelection());
}
......
2007-06-18 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Remove the FrameArray class and instead make window.frames another
self-reference for window (like window.window, window.self, etc).
This is what Firefox and what the HTML5 dictates.
* bindings/js/kjs_window.cpp:
(KJS::WindowPrivate::WindowPrivate):
(KJS::Window::mark):
(KJS::Window::getValueProperty):
(KJS::Window::clearHelperObjectProperties):
(KJS::Window::disconnectFrame):
* bindings/js/kjs_window.h:
2007-06-18 Mitz Pettel <mitz@webkit.org>
 
Reviewed by Adele.
......@@ -84,7 +84,6 @@ struct WindowPrivate {
WindowPrivate()
: screen(0)
, history(0)
, frames(0)
, loc(0)
, m_selection(0)
, m_locationbar(0)
......@@ -104,7 +103,6 @@ struct WindowPrivate {
Window::UnprotectedListenersMap jsUnprotectedHTMLEventListeners;
mutable Screen* screen;
mutable History* history;
mutable FrameArray* frames;
mutable Location* loc;
mutable Selection* m_selection;
mutable BarInfo* m_locationbar;
......@@ -175,28 +173,6 @@ public:
Frame* m_frame;
};
class FrameArray : public DOMObject {
public:
FrameArray(ExecState *exec, Frame *f)
: m_frame(f)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
}
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
JSValue *getValueProperty(ExecState *exec, int token);
enum { Length, Location };
void disconnectFrame() { m_frame = 0; }
private:
static JSValue *indexGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
static JSValue *nameGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
Frame* m_frame;
};
}
#include "kjs_window.lut.h"
......@@ -502,8 +478,6 @@ void Window::mark()
d->screen->mark();
if (d->history && !d->history->marked())
d->history->mark();
if (d->frames && !d->frames->marked())
d->frames->mark();
if (d->loc && !d->loc->marked())
d->loc->mark();
if (d->m_selection && !d->m_selection->marked())
......@@ -744,9 +718,7 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
case Status:
return jsString(UString(m_frame->jsStatusBarText()));
case Frames:
if (!d->frames)
d->frames = new FrameArray(exec, m_frame);
return d->frames;
return retrieve(m_frame);
case History_:
if (!d->history)
d->history = new History(exec, m_frame);
......@@ -1400,7 +1372,6 @@ void Window::clearHelperObjectProperties()
{
d->screen = 0;
d->history = 0;
d->frames = 0;
d->loc = 0;
d->m_selection = 0;
d->m_locationbar = 0;
......@@ -2055,8 +2026,6 @@ void Window::disconnectFrame()
d->m_toolbar->m_frame = 0;
if (d->m_scrollbars)
d->m_scrollbars->m_frame = 0;
if (d->frames)
d->frames->disconnectFrame();
if (d->history)
d->history->disconnectFrame();
}
......@@ -2081,70 +2050,6 @@ Window::UnprotectedListenersMap& Window::jsUnprotectedHTMLEventListeners()
return d->jsUnprotectedHTMLEventListeners;
}
const ClassInfo FrameArray::info = { "FrameArray", 0, &FrameArrayTable, 0 };
/*
@begin FrameArrayTable 2
length FrameArray::Length DontDelete|ReadOnly
location FrameArray::Location DontDelete|ReadOnly
@end
*/
JSValue *FrameArray::getValueProperty(ExecState *exec, int token)
{
switch (token) {
case Length:
return jsNumber(m_frame->tree()->childCount());
case Location:
// non-standard property, but works in NS and IE
if (JSObject *obj = Window::retrieveWindow(m_frame))
return obj->get(exec, "location");
return jsUndefined();
default:
ASSERT(0);
return jsUndefined();
}
}
JSValue* FrameArray::indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot)
{
return Window::retrieve(static_cast<FrameArray*>(slot.slotBase())->m_frame->tree()->child(slot.index()));
}
JSValue* FrameArray::nameGetter(ExecState*, JSObject*, const Identifier& propertyName, const PropertySlot& slot)
{
return Window::retrieve(static_cast<FrameArray*>(slot.slotBase())->m_frame->tree()->child(AtomicString(propertyName)));
}
bool FrameArray::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
if (!m_frame) {
slot.setUndefined(this);
return true;
}
const HashEntry* entry = Lookup::findEntry(&FrameArrayTable, propertyName);
if (entry) {
slot.setStaticEntry(this, entry, staticValueGetter<FrameArray>);
return true;
}
// check for the name or number
if (m_frame->tree()->child(propertyName)) {
slot.setCustom(this, nameGetter);
return true;
}
bool ok;
unsigned i = propertyName.toArrayIndex(&ok);
if (ok && i < m_frame->tree()->childCount()) {
slot.setCustomIndex(this, i, indexGetter);
return true;
}
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
}
////////////////////// Location Object ////////////////////////
const ClassInfo Location::info = { "Location", 0, &LocationTable, 0 };
......
......@@ -37,7 +37,6 @@ namespace WebCore {
namespace KJS {
class BarInfo;
class FrameArray;
class History;
class JSEventListener;
class JSLazyEventListener;
......
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