Commit dd714578 authored by barraclough@apple.com's avatar barraclough@apple.com
Browse files

Global Math object should be configurable but isn't

https://bugs.webkit.org/show_bug.cgi?id=55343

Reviewed by Oliver Hunt.

Source/JavaScriptCore: 

This has no performance impact.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
    - Make 'Math' a regular property.

LayoutTests: 

Added test case.

* fast/js/math-expected.txt:
* fast/js/script-tests/math.js:
    - Added test case.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129241 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 77d1efd8
2012-09-21 Gavin Barraclough <barraclough@apple.com>
Global Math object should be configurable but isn't
https://bugs.webkit.org/show_bug.cgi?id=55343
Reviewed by Oliver Hunt.
Added test case.
* fast/js/math-expected.txt:
* fast/js/script-tests/math.js:
- Added test case.
2012-09-21 Marcelo Lira <marcelo.lira@openbossa.org>
 
[Qt] REGRESSION: 5 tests started to fail with newer Qt5
......@@ -163,6 +163,8 @@ PASS Math.tan(0) is 0
PASS Math.tan(-0) is -0
PASS Math.tan(Infinity) is NaN
PASS Math.tan(-Infinity) is NaN
PASS delete Math; is true
PASS 'Math' in global() is false
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -234,3 +234,11 @@ shouldBe("Math.tan(0)", "0");
shouldBe("Math.tan(-0)", "-0");
shouldBe("Math.tan(Infinity)", "NaN");
shouldBe("Math.tan(-Infinity)", "NaN");
var __Math = Math;
shouldBeTrue("delete Math;");
function global() { return this; }
shouldBeFalse("'Math' in global()");
Math = __Math;
2012-09-21 Gavin Barraclough <barraclough@apple.com>
Global Math object should be configurable but isn't
https://bugs.webkit.org/show_bug.cgi?id=55343
Reviewed by Oliver Hunt.
This has no performance impact.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
- Make 'Math' a regular property.
2012-09-21 Chao-ying Fu <fu@mips.com>
 
Add MIPS or32 function
......
......@@ -310,9 +310,9 @@ void JSGlobalObject::reset(JSValue prototype)
putDirectWithoutTransition(exec->globalData(), exec->propertyNames().eval, m_evalFunction.get(), DontEnum);
putDirectWithoutTransition(exec->globalData(), Identifier(exec, "JSON"), JSONObject::create(exec, this, JSONObject::createStructure(exec->globalData(), this, m_objectPrototype.get())), DontEnum);
putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Math"), MathObject::create(exec, this, MathObject::createStructure(exec->globalData(), this, m_objectPrototype.get())), DontEnum);
GlobalPropertyInfo staticGlobals[] = {
GlobalPropertyInfo(Identifier(exec, "Math"), MathObject::create(exec, this, MathObject::createStructure(exec->globalData(), this, m_objectPrototype.get())), DontEnum | DontDelete),
GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(std::numeric_limits<double>::infinity()), DontEnum | DontDelete | ReadOnly),
GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly)
......
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