Ignore:
Timestamp:
Oct 18, 2017, 6:12:56 PM (8 years ago)
Author:
[email protected]
Message:

RegExpObject::defineOwnProperty() does not need to compare values if no descriptor value is specified.
https://bugs.webkit.org/show_bug.cgi?id=177600
<rdar://problem/34710985>

Reviewed by Saam Barati.

JSTests:

  • stress/regress-177600.js: Added.

Source/JavaScriptCore:

According to http://www.ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor,
section 9.1.6.3-7.a.ii, we should only check if the value is the same if the
descriptor value is present.

  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::defineOwnProperty):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp

    r222473 r223645  
    121121            if (descriptor.writablePresent() && descriptor.writable())
    122122                return typeError(exec, scope, shouldThrow, ASCIILiteral(UnconfigurablePropertyChangeWritabilityError));
    123             if (!sameValue(exec, regExp->getLastIndex(), descriptor.value()))
     123            if (descriptor.value() && !sameValue(exec, regExp->getLastIndex(), descriptor.value()))
    124124                return typeError(exec, scope, shouldThrow, ASCIILiteral(ReadonlyPropertyChangeError));
    125125            return true;
Note: See TracChangeset for help on using the changeset viewer.