Changeset 128094 in webkit


Ignore:
Timestamp:
Sep 10, 2012 1:20:58 PM (12 years ago)
Author:
abarth@webkit.org
Message:

[V8] Constructors try to handle errors that cannot occur
https://bugs.webkit.org/show_bug.cgi?id=96304

Patch by Adam Barth <abarth@chromium.org> on 2012-09-10
Reviewed by Kentaro Hara.

There's no reason for constructors to indirect through the Frame. Now
that we can reliably get the Document from the v8::Context, we can just
grab it without worrying about handling error conditions related to not
being able to find the Document.

  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateNamedConstructorCallback):

  • bindings/scripts/test/V8/V8TestNamedConstructor.cpp:

(WebCore::V8TestNamedConstructorConstructorCallback):

  • bindings/v8/custom/V8AudioContextCustom.cpp:

(WebCore::V8AudioContext::constructorCallback):

  • bindings/v8/custom/V8HTMLImageElementConstructor.cpp:

(WebCore::v8HTMLImageElementConstructorCallback):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r128089 r128094  
     12012-09-10  Adam Barth  <abarth@chromium.org>
     2
     3        [V8] Constructors try to handle errors that cannot occur
     4        https://bugs.webkit.org/show_bug.cgi?id=96304
     5
     6        Reviewed by Kentaro Hara.
     7
     8        There's no reason for constructors to indirect through the Frame. Now
     9        that we can reliably get the Document from the v8::Context, we can just
     10        grab it without worrying about handling error conditions related to not
     11        being able to find the Document.
     12
     13        * bindings/scripts/CodeGeneratorV8.pm:
     14        (GenerateNamedConstructorCallback):
     15        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
     16        (WebCore::V8TestNamedConstructorConstructorCallback):
     17        * bindings/v8/custom/V8AudioContextCustom.cpp:
     18        (WebCore::V8AudioContext::constructorCallback):
     19        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
     20        (WebCore::v8HTMLImageElementConstructorCallback):
     21
    1222012-09-10  Andrey Kosyakov  <caseq@chromium.org>
    223
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r127997 r128094  
    20282028        return args.Holder();
    20292029
    2030     Frame* frame = currentFrame(BindingState::instance());
    2031     if (!frame)
    2032         return throwError(ReferenceError, "${implClassName} constructor associated frame is unavailable", args.GetIsolate());
    2033 
    2034     Document* document = frame->document();
     2030    Document* document = currentDocument(BindingState::instance());
    20352031
    20362032    // Make sure the document is added to the DOM Node map. Otherwise, the ${implClassName} instance
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r127972 r128094  
    5454        return args.Holder();
    5555
    56     Frame* frame = currentFrame(BindingState::instance());
    57     if (!frame)
    58         return throwError(ReferenceError, "TestNamedConstructor constructor associated frame is unavailable", args.GetIsolate());
    59 
    60     Document* document = frame->document();
     56    Document* document = currentDocument(BindingState::instance());
    6157
    6258    // Make sure the document is added to the DOM Node map. Otherwise, the TestNamedConstructor instance
  • trunk/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp

    r126399 r128094  
    5050        return args.Holder();
    5151
    52     Frame* frame = currentFrame(BindingState::instance());
    53     if (!frame)
    54         return throwError(ReferenceError, "AudioContext constructor associated frame is unavailable", args.GetIsolate());
    55 
    56     Document* document = frame->document();
    57     if (!document)
    58         return throwError(ReferenceError, "AudioContext constructor associated document is unavailable", args.GetIsolate());
     52    Document* document = currentDocument(BindingState::instance());
    5953
    6054    RefPtr<AudioContext> audioContext;
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp

    r127946 r128094  
    5656        return args.Holder();
    5757
    58     // FIXME: We shouldn't need to go through the Frame to get the Document.
    59     Frame* frame = currentFrame(BindingState::instance());
    60     if (!frame)
    61         return throwError(ReferenceError, "Image constructor associated frame is unavailable", args.GetIsolate());
    62 
    63     Document* document = frame->document();
    64     if (!document)
    65         return throwError(ReferenceError, "Image constructor associated document is unavailable", args.GetIsolate());
     58    Document* document = currentDocument(BindingState::instance());
    6659
    6760    // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance
Note: See TracChangeset for help on using the changeset viewer.