Ignore:
Timestamp:
Apr 30, 2013, 7:38:19 PM (12 years ago)
Author:
[email protected]
Message:

JSContextGroupSetExecutionTimeLimit() should not pass a callback to the
VM watchdog if its client did not pass one in.
https://bugs.webkit.org/show_bug.cgi?id=115461.

Reviewed by Geoffrey Garen.

  • API/JSContextRef.cpp:

(internalScriptTimeoutCallback):
(JSContextGroupSetExecutionTimeLimit):

  • API/tests/testapi.c:

(main):

  • Added test case when the time limit callback is 0.
  • Also updated a check to verify that a TerminatedExecutionException is thrown when the time out is cancelled.
  • Also fixed some cosmetic typos.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSContextRef.cpp

    r148696 r149420  
    8484    JSShouldTerminateCallback callback = reinterpret_cast<JSShouldTerminateCallback>(callbackPtr);
    8585    JSContextRef contextRef = toRef(exec);
     86    ASSERT(callback);
    8687    return callback(contextRef, callbackData);
    8788}
     
    9293    APIEntryShim entryShim(&vm);
    9394    Watchdog& watchdog = vm.watchdog;
    94     void* callbackPtr = reinterpret_cast<void*>(callback);
    95     watchdog.setTimeLimit(vm, limit, internalScriptTimeoutCallback, callbackPtr, callbackData);
     95    if (callback) {
     96        void* callbackPtr = reinterpret_cast<void*>(callback);
     97        watchdog.setTimeLimit(vm, limit, internalScriptTimeoutCallback, callbackPtr, callbackData);
     98    } else
     99        watchdog.setTimeLimit(vm, limit);
    96100}
    97101
Note: See TracChangeset for help on using the changeset viewer.