Ignore:
Timestamp:
Nov 17, 2009, 12:41:10 AM (16 years ago)
Author:
[email protected]
Message:

Incorrect use of JavaScriptCore API in DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=31577

Reviewed by Maciej Stachowiak

Return undefined rather than a literal null.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r48836 r51068  
    132132                value = getProperty(ctx, thisRef, propertyNameRef.get(), &exception);
    133133            }
    134             exec->setException(toJS(exec, exception));
     134            if (exception) {
     135                exec->setException(toJS(exec, exception));
     136                slot.setValue(jsUndefined());
     137                return true;
     138            }
    135139            if (value) {
    136140                slot.setValue(toJS(exec, value));
    137                 return true;
    138             }
    139             if (exception) {
    140                 slot.setValue(jsUndefined());
    141141                return true;
    142142            }
     
    185185                result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
    186186            }
    187             exec->setException(toJS(exec, exception));
     187            if (exception)
     188                exec->setException(toJS(exec, exception));
    188189            if (result || exception)
    189190                return;
     
    203204                        result = setProperty(ctx, thisRef, propertyNameRef.get(), valueRef, &exception);
    204205                    }
    205                     exec->setException(toJS(exec, exception));
     206                    if (exception)
     207                        exec->setException(toJS(exec, exception));
    206208                    if (result || exception)
    207209                        return;
     
    241243                result = deleteProperty(ctx, thisRef, propertyNameRef.get(), &exception);
    242244            }
    243             exec->setException(toJS(exec, exception));
     245            if (exception)
     246                exec->setException(toJS(exec, exception));
    244247            if (result || exception)
    245248                return true;
     
    302305                result = toJS(callAsConstructor(execRef, constructorRef, argumentCount, arguments.data(), &exception));
    303306            }
    304             exec->setException(toJS(exec, exception));
     307            if (exception)
     308                exec->setException(toJS(exec, exception));
    305309            return result;
    306310        }
     
    326330                result = hasInstance(execRef, thisRef, valueRef, &exception);
    327331            }
    328             exec->setException(toJS(exec, exception));
     332            if (exception)
     333                exec->setException(toJS(exec, exception));
    329334            return result;
    330335        }
     
    364369                result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception));
    365370            }
    366             exec->setException(toJS(exec, exception));
     371            if (exception)
     372                exec->setException(toJS(exec, exception));
    367373            return result;
    368374        }
     
    436442
    437443            double dValue;
    438             return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
     444            if (value)
     445                return toJS(exec, value).getNumber(dValue) ? dValue : NaN;
    439446        }
    440447           
     
    460467                return "";
    461468            }
    462             return toJS(exec, value).getString();
     469            if (value)
     470                return toJS(exec, value).getString();
    463471        }
    464472           
     
    508516                        value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
    509517                    }
    510                     exec->setException(toJS(exec, exception));
     518                    if (exception) {
     519                        exec->setException(toJS(exec, exception));
     520                        return jsUndefined();
     521                    }
    511522                    if (value)
    512523                        return toJS(exec, value);
    513                     if (exception)
    514                         return jsUndefined();
    515524                }
    516                    
     525
    517526    return throwError(exec, ReferenceError, "Static value property defined with NULL getProperty callback.");
    518527}
     
    561570                value = getProperty(toRef(exec), thisRef, propertyNameRef.get(), &exception);
    562571            }
    563             exec->setException(toJS(exec, exception));
     572            if (exception) {
     573                exec->setException(toJS(exec, exception));
     574                return jsUndefined();
     575            }
    564576            if (value)
    565577                return toJS(exec, value);
    566             if (exception)
    567                 return jsUndefined();
    568578        }
    569579           
Note: See TracChangeset for help on using the changeset viewer.