Changeset 57991 in webkit


Ignore:
Timestamp:
Apr 21, 2010 10:21:36 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-21 anton muhin <antonm@google.com>

Reviewed by Adam Barth.

[v8] Bail out if fetching of Object.prototype fails.
https://bugs.webkit.org/show_bug.cgi?id=37661

If for any reason we failed to fetch Object.prototype, context cannot
be properly initialized and we bail out.

  • bindings/v8/V8DOMWindowShell.cpp: (WebCore::V8DOMWindowShell::initContextIfNeeded): bail out if installHiddenObjectPrototype failed (WebCore::V8DOMWindowShell::installHiddenObjectPrototype): bail out if failed to fetch Object.prototype
  • bindings/v8/V8DOMWindowShell.h: return false if installHiddenObjectPrototype failed
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57990 r57991  
     12010-04-21  anton muhin  <antonm@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        [v8] Bail out if fetching of Object.prototype fails.
     6        https://bugs.webkit.org/show_bug.cgi?id=37661
     7
     8        If for any reason we failed to fetch Object.prototype, context cannot
     9        be properly initialized and we bail out.
     10
     11        * bindings/v8/V8DOMWindowShell.cpp:
     12        (WebCore::V8DOMWindowShell::initContextIfNeeded): bail out if installHiddenObjectPrototype failed
     13        (WebCore::V8DOMWindowShell::installHiddenObjectPrototype): bail out if failed to fetch Object.prototype
     14        * bindings/v8/V8DOMWindowShell.h: return false if installHiddenObjectPrototype failed
     15
    1162010-04-21  Timothy Hatcher  <timothy@apple.com>
    217
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r57715 r57991  
    287287    }
    288288
    289     installHiddenObjectPrototype(v8Context);
    290 
    291     if (!installDOMWindow(v8Context, m_frame->domWindow()))
     289    if (!installHiddenObjectPrototype(v8Context)) {
    292290        disposeContextHandles();
     291        return;
     292    }
     293
     294    if (!installDOMWindow(v8Context, m_frame->domWindow())) {
     295        disposeContextHandles();
     296        return;
     297    }
    293298
    294299    updateDocument();
     
    504509}
    505510
    506 void V8DOMWindowShell::installHiddenObjectPrototype(v8::Handle<v8::Context> context)
     511bool V8DOMWindowShell::installHiddenObjectPrototype(v8::Handle<v8::Context> context)
    507512{
    508513    v8::Handle<v8::String> objectString = v8::String::New("Object");
     
    511516    // Bail out if allocation failed.
    512517    if (objectString.IsEmpty() || prototypeString.IsEmpty() || hiddenObjectPrototypeString.IsEmpty())
    513         return;
     518        return false;
    514519
    515520    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(objectString));
     521    // Bail out if fetching failed.
     522    if (object.IsEmpty())
     523        return false;
    516524    v8::Handle<v8::Value> objectPrototype = object->Get(prototypeString);
     525    // Bail out if fetching failed.
     526    if (objectPrototype.IsEmpty())
     527        return false;
    517528
    518529    context->Global()->SetHiddenValue(hiddenObjectPrototypeString, objectPrototype);
     530
     531    return true;
    519532}
    520533
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.h

    r56716 r57991  
    7575    static v8::Handle<v8::Value> getHiddenObjectPrototype(v8::Handle<v8::Context>);
    7676    // WARNING: Call |installHiddenObjectPrototype| only on fresh contexts!
    77     static void installHiddenObjectPrototype(v8::Handle<v8::Context>);
     77    static bool installHiddenObjectPrototype(v8::Handle<v8::Context>);
    7878
    7979    // To create JS Wrapper objects, we create a cache of a 'boiler plate'
Note: See TracChangeset for help on using the changeset viewer.