Commit aab95359 authored by ggaren@apple.com's avatar ggaren@apple.com

JavaScriptCore:

        Reviewed by Oliver Hunt.
        
        Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
        variable access (16644)
        
        This bug was caused by var declarations shadowing built-in properties of
        the global object.
        
        To match Firefox, we've decided that var declarations will never shadow
        built-in properties of the global object or its prototypes. We used to
        behave more like IE, which allows shadowing, but walking that line got
        us into trouble with websites that sent us down the Firefox codepath.

        * kjs/JSVariableObject.h:
        (KJS::JSVariableObject::symbolTableGet): New code to support calling
        hasProperty before the variable object is fully initialized (so you
        can call it during initialization).

        * kjs/nodes.cpp:.
        (KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
        check when looking for duplicates, not getDirect, since it only checks
        the property map, and not hasOwnProperty, since it doesn't check
        prototypes.
        (KJS::EvalNode::processDeclarations): ditto

        * kjs/property_slot.h:
        (KJS::PropertySlot::ungettableGetter): Best function name evar.

WebCore:

        Reviewed by Oliver Hunt.
        
        Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
        variable access (16644)
        
        Removed the ReadOnly bit from some properties, to match Firefox. Also
        removed status-related setters, to allow using their names as variable
        names.
        
        * bindings/scripts/CodeGeneratorJS.pm: Added support for properties that
        are one-way across domain boundaries, to match Firefox.

        * bindings/js/kjs_window.cpp: Changed ReadOnly declarations to match FF.

        * bindings/scripts/CodeGeneratorJS.pm: Don't use JSObject:: because
        we don't know that JSObject is our base class.

        * page/DOMWindow.idl: Replaced lots of readonly declarations with
        [Replaceable] declarations.

        * page/DOMWindow.h: Removed interfaces for setting status text via the
        DOM. (They were getting in the way of, e.g., "var status"
        declarations.) By default, IE 7 and FF disable these interfaces in order
        to defend against phishing attacks that try to spoof domain names in the
        statusbar.
        * page/DOMWindow.cpp:

LayoutTests:

        Reviewed by Oliver Hunt.
        
        Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
        variable access (16644)
        
        Added a test. Updated other tests to match new behavior.
        
        * fast/js/var-declarations-shadowing-expected.txt: Added.
        * fast/js/var-declarations-shadowing.html: Added.

        * fast/dom/HTMLScriptElement/script-load-events.html: Changed this test
        a bit because the original design made it hard to understand why it was failing.
        * fast/dom/HTMLScriptElement/script-load-events-expected.txt:
        
        * fast/dom/Window/get-set-properties.html: Changed this test to expect
        our new behavior, which matches Firefox.
        * fast/dom/Window/get-set-properties-expected.txt:

        * fast/dom/Window/window-property-shadowing.html: Removed some cases
        that differed from Firefox. 
        * fast/dom/Window/window-property-shadowing-expected.txt: 

        * http/tests/security/cross-frame-access-put-expected.txt: This test emits
        more "Unsafe JavaScript attempt" messages now because property sets that
        used to be prohibited (somewhat accidentally) by the ReadOnly attribute
        are now prohibited by security checks.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@29428 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b16ec567
2008-01-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
variable access (16644)
This bug was caused by var declarations shadowing built-in properties of
the global object.
To match Firefox, we've decided that var declarations will never shadow
built-in properties of the global object or its prototypes. We used to
behave more like IE, which allows shadowing, but walking that line got
us into trouble with websites that sent us down the Firefox codepath.
* kjs/JSVariableObject.h:
(KJS::JSVariableObject::symbolTableGet): New code to support calling
hasProperty before the variable object is fully initialized (so you
can call it during initialization).
* kjs/nodes.cpp:.
(KJS::ProgramNode::initializeSymbolTable): Always do a full hasProperty
check when looking for duplicates, not getDirect, since it only checks
the property map, and not hasOwnProperty, since it doesn't check
prototypes.
(KJS::EvalNode::processDeclarations): ditto
* kjs/property_slot.h:
(KJS::PropertySlot::ungettableGetter): Best function name evar.
2008-01-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Maciej.
......
......@@ -91,6 +91,18 @@ namespace KJS {
{
size_t index = symbolTable().get(propertyName.ustring().rep());
if (index != missingSymbolMarker()) {
#ifndef NDEBUG
// During initialization, the variable object needs to advertise that it has certain
// properties, even if they're not ready for access yet. This check verifies that
// no one tries to access such a property.
// In a release build, we optimize this check away and just return an invalid pointer.
// There's no harm in an invalid pointer, since no one dereferences it.
if (index >= d->localStorage.size()) {
slot.setUngettable(this);
return true;
}
#endif
slot.setValueSlot(this, &d->localStorage[index].value);
return true;
}
......
......@@ -4326,7 +4326,7 @@ void ProgramNode::initializeSymbolTable(ExecState* exec)
m_varIndexes.resize(size);
for (size_t i = 0; i < size; ++i) {
const Identifier& ident = m_varStack[i].first;
if (variableObject->getDirect(ident)) {
if (variableObject->hasProperty(exec, ident)) {
m_varIndexes[i] = missingSymbolMarker(); // Signal not to initialize this declaration.
continue;
}
......@@ -4474,7 +4474,7 @@ void EvalNode::processDeclarations(ExecState* exec)
for (i = 0, size = m_varStack.size(); i < size; ++i) {
Identifier& ident = m_varStack[i].first;
bool isConstant = m_varStack[i].second & DeclarationStacks::IsConstant;
if (variableObject->hasOwnProperty(exec, ident))
if (variableObject->hasProperty(exec, ident))
continue;
int attributes = minAttributes;
if (isConstant)
......
......@@ -32,6 +32,12 @@ JSValue *PropertySlot::undefinedGetter(ExecState*, JSObject*, const Identifier&,
return jsUndefined();
}
JSValue* PropertySlot::ungettableGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&)
{
ASSERT_NOT_REACHED();
return jsUndefined();
}
JSValue *PropertySlot::functionGetter(ExecState* exec, JSObject* originalObject, const Identifier&, const PropertySlot& slot)
{
return slot.m_data.getterFunc->call(exec, originalObject, exec->emptyList());
......
......@@ -109,6 +109,12 @@ public:
m_getValue = undefinedGetter;
}
void setUngettable(JSObject* slotBase) // Used to signal that you have a property, but trying to get it at this time is an error.
{
m_slotBase = slotBase;
m_getValue = ungettableGetter;
}
JSObject* slotBase() const { return m_slotBase; }
const HashEntry* staticEntry() const { return m_data.staticEntry; }
......@@ -116,6 +122,7 @@ public:
private:
static JSValue* undefinedGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
static JSValue* ungettableGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
static JSValue* functionGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
GetValueFunc m_getValue;
......
2008-01-11 Geoffrey Garen <ggaren@apple.com>
Reviewed by Oliver Hunt.
Fixed <rdar://problem/5665251> REGRESSION (r28880-r28886): Global
variable access (16644)
Added a test. Updated other tests to match new behavior.
* fast/js/var-declarations-shadowing-expected.txt: Added.
* fast/js/var-declarations-shadowing.html: Added.
* fast/dom/HTMLScriptElement/script-load-events.html: Changed this test
a bit because the original design made it hard to understand why it was failing.
* fast/dom/HTMLScriptElement/script-load-events-expected.txt:
* fast/dom/Window/get-set-properties.html: Changed this test to expect
our new behavior, which matches Firefox.
* fast/dom/Window/get-set-properties-expected.txt:
* fast/dom/Window/window-property-shadowing.html: Removed some cases
that differed from Firefox.
* fast/dom/Window/window-property-shadowing-expected.txt:
* http/tests/security/cross-frame-access-put-expected.txt: This test emits
more "Unsafe JavaScript attempt" messages now because property sets that
used to be prohibited (somewhat accidentally) by the ReadOnly attribute
are now prohibited by security checks.
2008-01-11 Anyang Ren <anyang.ren@gmail.com>
Reviewed by Darin Adler.
......
This tests for regressions against http://bugzilla.opendarwin.org/show_bug.cgi?id=5812 Generate load events for <script> elements.
Test result: PASS
PASS
......@@ -6,60 +6,70 @@ var status = new Array();
function loaded(i)
{
status[i-1] = "L";
status[i] = "L";
}
function erred(i)
{
status[i-1] = "E";
status[i] = "E";
}
function endTest()
{
var failures = "";
if (status[0] != "E")
failures += "0 ";
if (status[1] != "E")
failures += "1 ";
if (status[2] != "L")
failures += "2 ";
if (status[3] != "L")
failures += "3 ";
if (status[4] != "L")
failures += "4 ";
if (status[5] != "L")
failures += "5 ";
var results = document.getElementById("results");
if (status[0]=="E" &&
status[1]=="E" &&
status[2]=="L" &&
status[3]=="L" &&
status[4]=="L" &&
status[5]=="L")
results.innerText = "PASS";
if (failures)
results.innerHTML = "FAIL: The following tests failed: " + failures;
else
results.innerText = "FAIL: " + status;
}
results.innerHTML = "PASS";
function loaded6()
{
loaded(6);
endTest();
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function test()
{
if (window.layoutTestController)
if (window.layoutTestController) {
layoutTestController.dumpAsText();
var e = document.createElement( "script" ) ;
e.type = "text/javascript" ;
document.getElementsByTagName("head")[0].appendChild( e ) ;
e.onload = loaded6;
endTest(); // called here in case the load even doesn't fire
e.src = 'resources/script-load.js' ;
layoutTestController.waitUntilDone();
}
var e = document.createElement("script");
e.type = "text/javascript";
e.src = 'resources/script-load.js';
e.onload = function() {
loaded(5);
endTest();
};
document.getElementsByTagName("head")[0].appendChild( e );
}
</script>
</head>
<body onload="test()">
<script type="text/javascript" onload="loaded(0)" onerror="erred(0)" src="resources/certainlydoesnotexist.js"></script>
<script type="text/javascript" onload="loaded(1)" onerror="erred(1)" src="resources/certainlydoesnotexist.js"></script>
<script type="text/javascript" onload="loaded(2)" onerror="erred(2)" src="resources/certainlydoesnotexist.js"></script>
<script type="text/javascript" onload="loaded(2)" onerror="erred(2)" src="resources/script-load.js"></script>
<script type="text/javascript" onload="loaded(3)" onerror="erred(3)" src="resources/script-load.js"></script>
<script type="text/javascript" onload="loaded(4)" onerror="erred(4)" src="resources/script-load.js"></script>
<script type="text/javascript">
document.write('<script type="text/javascript" onload="loaded(5)" onerror="erred(5)" src="resources/script-load.js"></script'+'>');
document.write('<script type="text/javascript" onload="loaded(4)" onerror="erred(4)" src="resources/script-load.js"></script'+'>');
</script>
This tests for regressions against <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=5812">http://bugzilla.opendarwin.org/show_bug.cgi?id=5812</a>
Generate load events for &lt;script&gt; elements</i>.
<hr>
<p>Test result: <span id="results"></span></p>
<p id="results">FAIL: Test never finished.</p>
</body>
</html>
Tests getting and setting window properties and functions.
This page tests getting and setting window properties and functions.
----- tests for getting/setting read-write properties -----
PASS: canGet('addEventListener') should be 'true' and is.
PASS: canSet('addEventListener') should be 'true' and is.
PASS: canGet('alert') should be 'true' and is.
PASS: canSet('alert') should be 'true' and is.
PASS: canGet('atob') should be 'true' and is.
PASS: canSet('atob') should be 'true' and is.
PASS: canGet('Attr') should be 'true' and is.
PASS: canSet('Attr') should be 'true' and is.
PASS: canGet('btoa') should be 'true' and is.
PASS: canSet('btoa') should be 'true' and is.
PASS: canGet('captureEvents') should be 'true' and is.
PASS: canSet('captureEvents') should be 'true' and is.
PASS: canGet('CDATASection') should be 'true' and is.
PASS: canSet('CDATASection') should be 'true' and is.
PASS: canGet('CharacterData') should be 'true' and is.
PASS: canSet('CharacterData') should be 'true' and is.
PASS: canGet('clearInterval') should be 'true' and is.
PASS: canSet('clearInterval') should be 'true' and is.
PASS: canGet('clearTimeout') should be 'true' and is.
PASS: canSet('clearTimeout') should be 'true' and is.
PASS: canGet('Comment') should be 'true' and is.
PASS: canSet('Comment') should be 'true' and is.
PASS: canGet('console') should be 'true' and is.
PASS: canSet('console') should be 'true' and is.
PASS: canGet('CSSPrimitiveValue') should be 'true' and is.
PASS: canSet('CSSPrimitiveValue') should be 'true' and is.
PASS: canGet('CSSRule') should be 'true' and is.
......@@ -35,18 +15,22 @@ PASS: canGet('CSSStyleDeclaration') should be 'true' and is.
PASS: canSet('CSSStyleDeclaration') should be 'true' and is.
PASS: canGet('CSSValue') should be 'true' and is.
PASS: canSet('CSSValue') should be 'true' and is.
PASS: canGet('Document') should be 'true' and is.
PASS: canSet('Document') should be 'true' and is.
PASS: canGet('DocumentFragment') should be 'true' and is.
PASS: canSet('DocumentFragment') should be 'true' and is.
PASS: canGet('DocumentType') should be 'true' and is.
PASS: canSet('DocumentType') should be 'true' and is.
PASS: canGet('CharacterData') should be 'true' and is.
PASS: canSet('CharacterData') should be 'true' and is.
PASS: canGet('Comment') should be 'true' and is.
PASS: canSet('Comment') should be 'true' and is.
PASS: canGet('DOMException') should be 'true' and is.
PASS: canSet('DOMException') should be 'true' and is.
PASS: canGet('DOMImplementation') should be 'true' and is.
PASS: canSet('DOMImplementation') should be 'true' and is.
PASS: canGet('DOMParser') should be 'true' and is.
PASS: canSet('DOMParser') should be 'true' and is.
PASS: canGet('Document') should be 'true' and is.
PASS: canSet('Document') should be 'true' and is.
PASS: canGet('DocumentFragment') should be 'true' and is.
PASS: canSet('DocumentFragment') should be 'true' and is.
PASS: canGet('DocumentType') should be 'true' and is.
PASS: canSet('DocumentType') should be 'true' and is.
PASS: canGet('Element') should be 'true' and is.
PASS: canSet('Element') should be 'true' and is.
PASS: canGet('Entity') should be 'true' and is.
......@@ -57,32 +41,30 @@ PASS: canGet('EvalError') should be 'true' and is.
PASS: canSet('EvalError') should be 'true' and is.
PASS: canGet('Event') should be 'true' and is.
PASS: canSet('Event') should be 'true' and is.
PASS: canGet('event') should be 'true' and is.
PASS: canSet('event') should be 'true' and is.
PASS: canGet('HTMLAnchorElement') should be 'true' and is.
PASS: canSet('HTMLAnchorElement') should be 'true' and is.
PASS: canGet('HTMLAppletElement') should be 'true' and is.
PASS: canSet('HTMLAppletElement') should be 'true' and is.
PASS: canGet('HTMLAreaElement') should be 'true' and is.
PASS: canSet('HTMLAreaElement') should be 'true' and is.
PASS: canGet('HTMLBRElement') should be 'true' and is.
PASS: canSet('HTMLBRElement') should be 'true' and is.
PASS: canGet('HTMLBaseElement') should be 'true' and is.
PASS: canSet('HTMLBaseElement') should be 'true' and is.
PASS: canGet('HTMLBaseFontElement') should be 'true' and is.
PASS: canSet('HTMLBaseFontElement') should be 'true' and is.
PASS: canGet('HTMLBodyElement') should be 'true' and is.
PASS: canSet('HTMLBodyElement') should be 'true' and is.
PASS: canGet('HTMLBRElement') should be 'true' and is.
PASS: canSet('HTMLBRElement') should be 'true' and is.
PASS: canGet('HTMLButtonElement') should be 'true' and is.
PASS: canSet('HTMLButtonElement') should be 'true' and is.
PASS: canGet('HTMLCanvasElement') should be 'true' and is.
PASS: canSet('HTMLCanvasElement') should be 'true' and is.
PASS: canGet('HTMLDListElement') should be 'true' and is.
PASS: canSet('HTMLDListElement') should be 'true' and is.
PASS: canGet('HTMLDirectoryElement') should be 'true' and is.
PASS: canSet('HTMLDirectoryElement') should be 'true' and is.
PASS: canGet('HTMLDivElement') should be 'true' and is.
PASS: canSet('HTMLDivElement') should be 'true' and is.
PASS: canGet('HTMLDListElement') should be 'true' and is.
PASS: canSet('HTMLDListElement') should be 'true' and is.
PASS: canGet('HTMLDocument') should be 'true' and is.
PASS: canSet('HTMLDocument') should be 'true' and is.
PASS: canGet('HTMLElement') should be 'true' and is.
......@@ -97,12 +79,12 @@ PASS: canGet('HTMLFrameElement') should be 'true' and is.
PASS: canSet('HTMLFrameElement') should be 'true' and is.
PASS: canGet('HTMLFrameSetElement') should be 'true' and is.
PASS: canSet('HTMLFrameSetElement') should be 'true' and is.
PASS: canGet('HTMLHRElement') should be 'true' and is.
PASS: canSet('HTMLHRElement') should be 'true' and is.
PASS: canGet('HTMLHeadElement') should be 'true' and is.
PASS: canSet('HTMLHeadElement') should be 'true' and is.
PASS: canGet('HTMLHeadingElement') should be 'true' and is.
PASS: canSet('HTMLHeadingElement') should be 'true' and is.
PASS: canGet('HTMLHRElement') should be 'true' and is.
PASS: canSet('HTMLHRElement') should be 'true' and is.
PASS: canGet('HTMLHtmlElement') should be 'true' and is.
PASS: canSet('HTMLHtmlElement') should be 'true' and is.
PASS: canGet('HTMLIFrameElement') should be 'true' and is.
......@@ -113,12 +95,12 @@ PASS: canGet('HTMLInputElement') should be 'true' and is.
PASS: canSet('HTMLInputElement') should be 'true' and is.
PASS: canGet('HTMLIsIndexElement') should be 'true' and is.
PASS: canSet('HTMLIsIndexElement') should be 'true' and is.
PASS: canGet('HTMLLIElement') should be 'true' and is.
PASS: canSet('HTMLLIElement') should be 'true' and is.
PASS: canGet('HTMLLabelElement') should be 'true' and is.
PASS: canSet('HTMLLabelElement') should be 'true' and is.
PASS: canGet('HTMLLegendElement') should be 'true' and is.
PASS: canSet('HTMLLegendElement') should be 'true' and is.
PASS: canGet('HTMLLIElement') should be 'true' and is.
PASS: canSet('HTMLLIElement') should be 'true' and is.
PASS: canGet('HTMLLinkElement') should be 'true' and is.
PASS: canSet('HTMLLinkElement') should be 'true' and is.
PASS: canGet('HTMLMapElement') should be 'true' and is.
......@@ -211,85 +193,103 @@ PASS: canGet('XPathResult') should be 'true' and is.
PASS: canSet('XPathResult') should be 'true' and is.
PASS: canGet('XSLTProcessor') should be 'true' and is.
PASS: canSet('XSLTProcessor') should be 'true' and is.
----- tests for getting/setting readonly properties -----
PASS: canGet('addEventListener') should be 'true' and is.
PASS: canSet('addEventListener') should be 'true' and is.
PASS: canGet('alert') should be 'true' and is.
PASS: canSet('alert') should be 'true' and is.
PASS: canGet('atob') should be 'true' and is.
PASS: canSet('atob') should be 'true' and is.
PASS: canGet('btoa') should be 'true' and is.
PASS: canSet('btoa') should be 'true' and is.
PASS: canGet('captureEvents') should be 'true' and is.
PASS: canSet('captureEvents') should be 'true' and is.
PASS: canGet('clearInterval') should be 'true' and is.
PASS: canSet('clearInterval') should be 'true' and is.
PASS: canGet('clearTimeout') should be 'true' and is.
PASS: canSet('clearTimeout') should be 'true' and is.
PASS: canGet('clientInformation') should be 'true' and is.
PASS: canSet('clientInformation') should be 'false' and is.
PASS: canGet('closed') should be 'true' and is.
PASS: canSet('closed') should be 'false' and is.
PASS: canSet('clientInformation') should be 'true' and is.
PASS: canGet('console') should be 'true' and is.
PASS: canSet('console') should be 'true' and is.
PASS: canGet('defaultStatus') should be 'true' and is.
PASS: canSet('defaultStatus') should be 'false' and is.
PASS: canSet('defaultStatus') should be 'true' and is.
PASS: canGet('defaultstatus') should be 'true' and is.
PASS: canSet('defaultstatus') should be 'false' and is.
PASS: canSet('defaultstatus') should be 'true' and is.
PASS: canGet('devicePixelRatio') should be 'true' and is.
PASS: canSet('devicePixelRatio') should be 'false' and is.
PASS: canGet('document') should be 'true' and is.
PASS: canSet('document') should be 'false' and is.
PASS: canSet('devicePixelRatio') should be 'true' and is.
PASS: canGet('event') should be 'true' and is.
PASS: canSet('event') should be 'true' and is.
PASS: canGet('frames') should be 'true' and is.
PASS: canSet('frames') should be 'false' and is.
PASS: canGet('history') should be 'true' and is.
PASS: canSet('history') should be 'false' and is.
PASS: canSet('frames') should be 'true' and is.
PASS: canGet('innerHeight') should be 'true' and is.
PASS: canSet('innerHeight') should be 'false' and is.
PASS: canSet('innerHeight') should be 'true' and is.
PASS: canGet('innerWidth') should be 'true' and is.
PASS: canSet('innerWidth') should be 'false' and is.
PASS: canSet('innerWidth') should be 'true' and is.
PASS: canGet('length') should be 'true' and is.
PASS: canSet('length') should be 'false' and is.
PASS: canSet('length') should be 'true' and is.
PASS: canGet('locationbar') should be 'true' and is.
PASS: canSet('locationbar') should be 'false' and is.
PASS: canSet('locationbar') should be 'true' and is.
PASS: canGet('menubar') should be 'true' and is.
PASS: canSet('menubar') should be 'false' and is.
PASS: canGet('name') should be 'true' and is.
PASS: canSet('name') should be 'false' and is.
PASS: canSet('menubar') should be 'true' and is.
PASS: canGet('navigator') should be 'true' and is.
PASS: canSet('navigator') should be 'false' and is.
PASS: canSet('navigator') should be 'true' and is.
PASS: canGet('offscreenBuffering') should be 'true' and is.
PASS: canSet('offscreenBuffering') should be 'false' and is.
PASS: canSet('offscreenBuffering') should be 'true' and is.
PASS: canGet('opener') should be 'true' and is.
PASS: canSet('opener') should be 'false' and is.
PASS: canSet('opener') should be 'true' and is.
PASS: canGet('outerHeight') should be 'true' and is.
PASS: canSet('outerHeight') should be 'false' and is.
PASS: canSet('outerHeight') should be 'true' and is.
PASS: canGet('outerWidth') should be 'true' and is.
PASS: canSet('outerWidth') should be 'false' and is.
PASS: canGet('pageXOffset') should be 'true' and is.
PASS: canSet('pageXOffset') should be 'false' and is.
PASS: canGet('pageYOffset') should be 'true' and is.
PASS: canSet('pageYOffset') should be 'false' and is.
PASS: canSet('outerWidth') should be 'true' and is.
PASS: canGet('parent') should be 'true' and is.
PASS: canSet('parent') should be 'false' and is.
PASS: canSet('parent') should be 'true' and is.
PASS: canGet('personalbar') should be 'true' and is.
PASS: canSet('personalbar') should be 'false' and is.
PASS: canGet('screen') should be 'true' and is.
PASS: canSet('screen') should be 'false' and is.
PASS: canSet('personalbar') should be 'true' and is.
PASS: canGet('screenLeft') should be 'true' and is.
PASS: canSet('screenLeft') should be 'false' and is.
PASS: canSet('screenLeft') should be 'true' and is.
PASS: canGet('screenTop') should be 'true' and is.
PASS: canSet('screenTop') should be 'false' and is.
PASS: canSet('screenTop') should be 'true' and is.
PASS: canGet('screenX') should be 'true' and is.
PASS: canSet('screenX') should be 'false' and is.
PASS: canSet('screenX') should be 'true' and is.
PASS: canGet('screenY') should be 'true' and is.
PASS: canSet('screenY') should be 'false' and is.
PASS: canGet('scrollbars') should be 'true' and is.
PASS: canSet('scrollbars') should be 'false' and is.
PASS: canSet('screenY') should be 'true' and is.
PASS: canGet('scrollX') should be 'true' and is.
PASS: canSet('scrollX') should be 'false' and is.
PASS: canSet('scrollX') should be 'true' and is.
PASS: canGet('scrollY') should be 'true' and is.
PASS: canSet('scrollY') should be 'false' and is.
PASS: canSet('scrollY') should be 'true' and is.
PASS: canGet('scrollbars') should be 'true' and is.
PASS: canSet('scrollbars') should be 'true' and is.
PASS: canGet('self') should be 'true' and is.
PASS: canSet('self') should be 'false' and is.
PASS: canSet('self') should be 'true' and is.
PASS: canGet('status') should be 'true' and is.
PASS: canSet('status') should be 'false' and is.
PASS: canSet('status') should be 'true' and is.
PASS: canGet('statusbar') should be 'true' and is.
PASS: canSet('statusbar') should be 'false' and is.
PASS: canSet('statusbar') should be 'true' and is.
PASS: canGet('toolbar') should be 'true' and is.
PASS: canSet('toolbar') should be 'false' and is.
PASS: canSet('toolbar') should be 'true' and is.
PASS: canGet('top') should be 'true' and is.
PASS: canSet('top') should be 'false' and is.
PASS: canSet('top') should be 'true' and is.
----- tests for getting/setting readonly properties -----
PASS: canGet('closed') should be 'true' and is.
PASS: canSet('closed') should be 'false' and is.
PASS: canGet('document') should be 'true' and is.
PASS: canSet('document') should be 'false' and is.
PASS: canGet('history') should be 'true' and is.
PASS: canSet('history') should be 'false' and is.
PASS: canGet('name') should be 'true' and is.
PASS: canSet('name') should be 'false' and is.
PASS: canGet('pageXOffset') should be 'true' and is.
PASS: canSet('pageXOffset') should be 'false' and is.
PASS: canGet('pageYOffset') should be 'true' and is.
PASS: canSet('pageYOffset') should be 'false' and is.
PASS: canGet('screen') should be 'true' and is.
PASS: canSet('screen') should be 'false' and is.
PASS: canGet('window') should be 'true' and is.
PASS: canSet('window') should be 'false' and is.
----- tests for getting/setting function -----
----- tests for getting/setting functions -----
PASS: canGet('blur') should be 'true' and is.
PASS: canSet('blur') should be 'true' and is.
......
<p>Tests getting and setting window properties and functions.</p>
<p>This page tests getting and setting window properties and functions.</p>
<pre id="console"></pre>
<script>
......@@ -57,46 +57,37 @@ function canSet(keyPath)
}
var windowReadWriteProperties = [
"addEventListener",
"alert",
"atob",
"Attr",
"btoa",
"captureEvents",
"CDATASection",
"CharacterData",
"clearInterval",
"clearTimeout",
"Comment",
"console",
"CSSPrimitiveValue",
"CSSRule",
"CSSStyleDeclaration",
"CSSValue",
"Document",
"DocumentFragment",
"DocumentType",
"CharacterData",
"Comment",
"DOMException",
"DOMImplementation",
"DOMParser",
"Document",
"DocumentFragment",
"DocumentType",
"Element",
"Entity",
"EntityReference",
"EvalError",
"Event",
"event",
"HTMLAnchorElement",
"HTMLAppletElement",
"HTMLAreaElement",
"HTMLBRElement",
"HTMLBaseElement",
"HTMLBaseFontElement",
"HTMLBodyElement",
"HTMLBRElement",
"HTMLButtonElement",
"HTMLCanvasElement",
"HTMLDListElement",
"HTMLDirectoryElement",
"HTMLDivElement",
"HTMLDListElement",
"HTMLDocument",
"HTMLElement",
"HTMLFieldSetElement",
......@@ -104,17 +95,17 @@ var windowReadWriteProperties = [
"HTMLFormElement",
"HTMLFrameElement",
"HTMLFrameSetElement",
"HTMLHRElement",
"HTMLHeadElement",
"HTMLHeadingElement",
"HTMLHRElement",
"HTMLHtmlElement",
"HTMLIFrameElement",
"HTMLImageElement",
"HTMLInputElement",
"HTMLIsIndexElement",
"HTMLLIElement",
"HTMLLabelElement",
"HTMLLegendElement",
"HTMLLIElement",
"HTMLLinkElement",
"HTMLMapElement",
"HTMLMarqueeElement",
......@@ -161,45 +152,54 @@ var windowReadWriteProperties = [
"XPathEvaluator",
"XPathResult",
"XSLTProcessor",
];
var windowReadOnlyProperties = [
"addEventListener",
"alert",
"atob",
"btoa",
"captureEvents",
"clearInterval",
"clearTimeout",
"clientInformation",
"closed",
"console",
"defaultStatus",
"defaultstatus",
"devicePixelRatio",
"document",
"event",
"frames",
"history",