Skip to content
  • oliver@apple.com's avatar
    Make JSValue bool conversion less dangerous · 02fe0141
    oliver@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=120505
    
    Reviewed by Darin Adler.
    
    Source/JavaScriptCore:
    
    Replaces JSValue::operator bool() with a operator UnspecifiedBoolType* as
    we do elsewhere.  Then fix the places where terrible type coercion was
    happening.  All of the changes made had no fundamental behavioural impact
    as they were coercion results that were ignored (returning undefined
    after an exception).
    
    * dfg/DFGOperations.cpp:
    * interpreter/CallFrame.h:
    (JSC::ExecState::hadException):
    * runtime/JSCJSValue.h:
    * runtime/JSCJSValueInlines.h:
    (JSC::JSValue::operator UnspecifiedBoolType*):
    * runtime/JSGlobalObjectFunctions.cpp:
    (JSC::globalFuncEval):
    * runtime/PropertyDescriptor.cpp:
    (JSC::PropertyDescriptor::equalTo)
    
    Source/WTF:
    
    Make LIKELY and UNLIKELY macros coerce to bool before
    passing to expect.
    
    * wtf/Compiler.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    02fe0141