Changeset 56142 in webkit


Ignore:
Timestamp:
Mar 17, 2010 7:25:22 PM (14 years ago)
Author:
oliver@apple.com
Message:

2010-03-17 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

undefined, NaN, and Infinity should be ReadOnly
https://bugs.webkit.org/show_bug.cgi?id=36263

Simply add the ReadOnly flag to these properties.

  • runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset):

2010-03-17 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

undefined, NaN, and Infinity should be ReadOnly
https://bugs.webkit.org/show_bug.cgi?id=36263

Add tests for the attributes of undefined, NaN and Infinity on the
global object

  • fast/js/getOwnPropertyDescriptor-expected.txt:
  • fast/js/resources/getOwnPropertyDescriptor.js:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r56135 r56142  
     12010-03-17  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        undefined, NaN, and Infinity should be ReadOnly
     6        https://bugs.webkit.org/show_bug.cgi?id=36263
     7
     8        Simply add the ReadOnly flag to these properties.
     9
     10        * runtime/JSGlobalObject.cpp:
     11        (JSC::JSGlobalObject::reset):
     12
    1132010-03-17  Darin Adler  <darin@apple.com>
    214
  • trunk/JavaScriptCore/runtime/JSGlobalObject.cpp

    r56085 r56142  
    320320    GlobalPropertyInfo staticGlobals[] = {
    321321        GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, MathObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete),
    322         GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete),
    323         GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete),
    324         GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete),
     322        GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete | ReadOnly),
     323        GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete | ReadOnly),
     324        GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly),
    325325        GlobalPropertyInfo(Identifier(exec, "JSON"), new (exec) JSONObject(JSONObject::createStructure(d()->objectPrototype)), DontEnum | DontDelete)
    326326    };
  • trunk/LayoutTests/ChangeLog

    r56140 r56142  
     12010-03-17  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        undefined, NaN, and Infinity should be ReadOnly
     6        https://bugs.webkit.org/show_bug.cgi?id=36263
     7
     8        Add tests for the attributes of undefined, NaN and Infinity on the
     9        global object
     10
     11        * fast/js/getOwnPropertyDescriptor-expected.txt:
     12        * fast/js/resources/getOwnPropertyDescriptor.js:
     13
    1142010-03-17  Chang Shu  <chang.shu@nokia.com>
    215
  • trunk/LayoutTests/fast/js/getOwnPropertyDescriptor-expected.txt

    r47780 r56142  
    105105PASS Object.getOwnPropertyDescriptor(global, 'global').enumerable is true
    106106PASS Object.getOwnPropertyDescriptor(global, 'global').configurable is false
     107PASS Object.getOwnPropertyDescriptor(global, 'undefined').value is undefined
     108PASS Object.getOwnPropertyDescriptor(global, 'undefined').hasOwnProperty('get') is false
     109PASS Object.getOwnPropertyDescriptor(global, 'undefined').hasOwnProperty('set') is false
     110PASS Object.getOwnPropertyDescriptor(global, 'undefined').enumerable is false
     111PASS Object.getOwnPropertyDescriptor(global, 'undefined').configurable is false
     112PASS Object.getOwnPropertyDescriptor(global, 'NaN').value is NaN
     113PASS Object.getOwnPropertyDescriptor(global, 'NaN').hasOwnProperty('get') is false
     114PASS Object.getOwnPropertyDescriptor(global, 'NaN').hasOwnProperty('set') is false
     115PASS Object.getOwnPropertyDescriptor(global, 'NaN').enumerable is false
     116PASS Object.getOwnPropertyDescriptor(global, 'NaN').configurable is false
     117PASS Object.getOwnPropertyDescriptor(global, 'Infinity').value is Infinity
     118PASS Object.getOwnPropertyDescriptor(global, 'Infinity').hasOwnProperty('get') is false
     119PASS Object.getOwnPropertyDescriptor(global, 'Infinity').hasOwnProperty('set') is false
     120PASS Object.getOwnPropertyDescriptor(global, 'Infinity').enumerable is false
     121PASS Object.getOwnPropertyDescriptor(global, 'Infinity').configurable is false
    107122PASS Object.getOwnPropertyDescriptor(global, 'window').value is global
    108123PASS Object.getOwnPropertyDescriptor(global, 'window').hasOwnProperty('get') is false
  • trunk/LayoutTests/fast/js/resources/getOwnPropertyDescriptor.js

    r47780 r56142  
    4040var global = this;
    4141descriptorShouldBe("global", "'global'", {writable: true, enumerable: true, configurable: false, value:"global"});
     42descriptorShouldBe("global", "'undefined'", {writable: false, enumerable: false, configurable: false, value:"undefined"});
     43descriptorShouldBe("global", "'NaN'", {writable: false, enumerable: false, configurable: false, value:"NaN"});
     44descriptorShouldBe("global", "'Infinity'", {writable: false, enumerable: false, configurable: false, value:"Infinity"});
    4245descriptorShouldBe("global", "'window'", {writable: false, enumerable: true, configurable: false, value:"global"});
    4346descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: true, configurable: false, value:"XMLHttpRequest"});
Note: See TracChangeset for help on using the changeset viewer.