Changeset 128095 in webkit


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

[V8] V8HTMLDocument::write and friends should not indirect through Frame
https://bugs.webkit.org/show_bug.cgi?id=96289

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

There is no reason why document.write and friends need to indirect
through the Frame to find the active document. This patch makes these
functions work the same as the JSC versions.

  • bindings/v8/BindingState.cpp:
  • bindings/v8/BindingState.h:
    • This patch removes the last callers of activeFrame, so we can remove the function entirely.
  • bindings/v8/custom/V8HTMLDocumentCustom.cpp:

(WebCore::V8HTMLDocument::writeCallback):
(WebCore::V8HTMLDocument::writelnCallback):
(WebCore::V8HTMLDocument::openCallback):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r128094 r128095  
     12012-09-10  Adam Barth  <abarth@chromium.org>
     2
     3        [V8] V8HTMLDocument::write and friends should not indirect through Frame
     4        https://bugs.webkit.org/show_bug.cgi?id=96289
     5
     6        Reviewed by Eric Seidel.
     7
     8        There is no reason why document.write and friends need to indirect
     9        through the Frame to find the active document. This patch makes these
     10        functions work the same as the JSC versions.
     11
     12        * bindings/v8/BindingState.cpp:
     13        * bindings/v8/BindingState.h:
     14            - This patch removes the last callers of activeFrame, so we can
     15              remove the function entirely.
     16        * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
     17        (WebCore::V8HTMLDocument::writeCallback):
     18        (WebCore::V8HTMLDocument::writelnCallback):
     19        (WebCore::V8HTMLDocument::openCallback):
     20
    1212012-09-10  Adam Barth  <abarth@chromium.org>
    222
  • trunk/Source/WebCore/bindings/v8/BindingState.cpp

    r126249 r128095  
    6767}
    6868
    69 Frame* activeFrame(BindingState*)
    70 {
    71     v8::Handle<v8::Context> context = activeContext();
    72     if (context.IsEmpty())
    73         return 0;
    74     return toFrameIfNotDetached(context);
    75 }
    76 
    7769Frame* firstFrame(BindingState*)
    7870{
  • trunk/Source/WebCore/bindings/v8/BindingState.h

    r126249 r128095  
    5050DOMWindow* firstDOMWindow(BindingState*);
    5151
    52 Frame* activeFrame(BindingState*);
    5352Frame* firstFrame(BindingState*);
    5453
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

    r127946 r128095  
    120120    INC_STATS("DOM.HTMLDocument.write()");
    121121    HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
    122     Frame* frame = activeFrame(BindingState::instance());
    123     htmlDocument->write(writeHelperGetString(args), frame ? frame->document() : NULL);
     122    htmlDocument->write(writeHelperGetString(args), activeDOMWindow(BindingState::instance())->document());
    124123    return v8::Undefined();
    125124}
     
    129128    INC_STATS("DOM.HTMLDocument.writeln()");
    130129    HTMLDocument* htmlDocument = V8HTMLDocument::toNative(args.Holder());
    131     Frame* frame = activeFrame(BindingState::instance());
    132     htmlDocument->writeln(writeHelperGetString(args), frame ? frame->document() : NULL);
     130    htmlDocument->writeln(writeHelperGetString(args), activeDOMWindow(BindingState::instance())->document());
    133131    return v8::Undefined();
    134132}
     
    161159    }
    162160
    163     Frame* frame = activeFrame(BindingState::instance());
    164     htmlDocument->open(frame ? frame->document() : NULL);
    165     // Return the document.
     161    htmlDocument->open(activeDOMWindow(BindingState::instance())->document());
    166162    return args.Holder();
    167163}
Note: See TracChangeset for help on using the changeset viewer.