Ignore:
Timestamp:
Dec 7, 2012, 2:34:04 PM (13 years ago)
Author:
[email protected]
Message:

Crash in JSC::Bindings::RootObject::globalObject() sync'ing notes in Evernote
https://bugs.webkit.org/show_bug.cgi?id=104321
<rdar://problem/12770497>

Reviewed by Sam Weinig.

../JavaScriptCore:

Work around a JSValueUnprotect(NULL) in Evernote.

  • API/JSValueRef.cpp:

(evernoteHackNeeded):
(JSValueUnprotect):

../WebCore:

Missed a null check.

  • bindings/objc/WebScriptObject.mm:

(-[WebScriptObject JSObject]): If our root object has been cleared, don't
try to dereference it. This happens in Evernote during tear-down.

This matches the behavior of other methods in the same class.

(_isSafeScript returns false if the root object has been cleared.)

If we believe _isSafeScript is a good idea, it's probably the right test
to use here (as opposed to just null-checking _rootObject) because this API
gives the client unlimited access to the underlying JavaScript object.

File:
1 edited

Legend:

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

    r133493 r136986  
    4545#include <algorithm> // for std::min
    4646
     47#if PLATFORM(MAC)
     48#include <mach-o/dyld.h>
     49#endif
     50
    4751using namespace JSC;
     52
     53#if PLATFORM(MAC)
     54static bool evernoteHackNeeded()
     55{
     56    static const int32_t webkitLastVersionWithEvernoteHack = 35133959;
     57    static bool hackNeeded = CFEqual(CFBundleGetIdentifier(CFBundleGetMainBundle()), CFSTR("com.evernote.Evernote"))
     58        && NSVersionOfLinkTimeLibrary("JavaScriptCore") <= webkitLastVersionWithEvernoteHack;
     59
     60    return hackNeeded;
     61}
     62#endif
    4863
    4964::JSType JSValueGetType(JSContextRef ctx, JSValueRef value)
     
    333348void JSValueUnprotect(JSContextRef ctx, JSValueRef value)
    334349{
     350#if PLATFORM(MAC)
     351    if ((!value || !ctx) && evernoteHackNeeded())
     352        return;
     353#endif
     354
    335355    ExecState* exec = toJS(ctx);
    336356    APIEntryShim entryShim(exec);
Note: See TracChangeset for help on using the changeset viewer.