Changeset 62380 in webkit


Ignore:
Timestamp:
Jul 2, 2010 4:43:45 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-07-02 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

[v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute
https://bugs.webkit.org/show_bug.cgi?id=41511

  • fast/events/popup-blocked-from-fake-user-gesture-expected.txt: Added.
  • fast/events/popup-blocked-from-fake-user-gesture.html: Added.
  • http/tests/inspector/change-iframe-src-expected.txt: Added.
  • http/tests/inspector/change-iframe-src.html: Added.

2010-07-02 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

[v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute
https://bugs.webkit.org/show_bug.cgi?id=41511

Tests: fast/events/popup-blocked-from-fake-user-gesture.html

http/tests/inspector/change-iframe-src.html

  • bindings/v8/ScriptController.cpp: (WebCore::ScriptController::processingUserGesture): use V8Proxy from the ScriptController instead of one from the call stack. Get event directly from hidden property to avoid unnecessary checks.
  • bindings/v8/V8AbstractEventListener.cpp: (WebCore::V8AbstractEventListener::invokeEventHandler):
  • bindings/v8/V8HiddenPropertyName.h:
  • bindings/v8/custom/V8DOMWindowCustom.cpp: (WebCore::V8DOMWindow::eventAccessorGetter): (WebCore::V8DOMWindow::eventAccessorSetter):

2010-07-02 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

[v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute
https://bugs.webkit.org/show_bug.cgi?id=41511

  • src/WebBindings.cpp: (WebKit::getEvent):
Location:
trunk
Files:
4 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62379 r62380  
     12010-07-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        [v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=41511
     7
     8        * fast/events/popup-blocked-from-fake-user-gesture-expected.txt: Added.
     9        * fast/events/popup-blocked-from-fake-user-gesture.html: Added.
     10        * http/tests/inspector/change-iframe-src-expected.txt: Added.
     11        * http/tests/inspector/change-iframe-src.html: Added.
     12
    1132010-07-02  Yury Semikhatsky  <yurys@chromium.org>
    214
  • trunk/WebCore/ChangeLog

    r62378 r62380  
     12010-07-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        [v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=41511
     7
     8        Tests: fast/events/popup-blocked-from-fake-user-gesture.html
     9               http/tests/inspector/change-iframe-src.html
     10
     11        * bindings/v8/ScriptController.cpp:
     12        (WebCore::ScriptController::processingUserGesture): use V8Proxy from the ScriptController instead of one
     13        from the call stack. Get event directly from hidden property to avoid unnecessary checks.
     14        * bindings/v8/V8AbstractEventListener.cpp:
     15        (WebCore::V8AbstractEventListener::invokeEventHandler):
     16        * bindings/v8/V8HiddenPropertyName.h:
     17        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     18        (WebCore::V8DOMWindow::eventAccessorGetter):
     19        (WebCore::V8DOMWindow::eventAccessorSetter):
     20
    1212010-07-02  Adam Barth  <abarth@webkit.org>
    222
  • trunk/WebCore/bindings/v8/ScriptController.cpp

    r62274 r62380  
    5454#include "V8DOMWindow.h"
    5555#include "V8Event.h"
     56#include "V8HiddenPropertyName.h"
    5657#include "V8HTMLEmbedElement.h"
    5758#include "V8IsolatedContext.h"
     
    161162bool ScriptController::processingUserGesture(DOMWrapperWorld*) const
    162163{
    163     Frame* activeFrame = V8Proxy::retrieveFrameForEnteredContext();
    164164    // No script is running, so it is user-initiated unless the gesture stack
    165165    // explicitly says it is not.
    166     if (!activeFrame)
     166    if (!m_proxy->executingScript())
    167167        return UserGestureIndicator::getUserGestureState() != DefinitelyNotProcessingUserGesture;
    168168
    169     V8Proxy* activeProxy = activeFrame->script()->proxy();
    170 
    171     v8::HandleScope handleScope;
    172     v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(activeFrame);
     169    v8::HandleScope handleScope;
     170    v8::Handle<v8::Context> v8Context = m_proxy->mainWorldContext();
    173171    // FIXME: find all cases context can be empty:
    174172    //  1) JS is disabled;
     
    180178
    181179    v8::Handle<v8::Object> global = v8Context->Global();
    182     v8::Handle<v8::Value> jsEvent = global->Get(v8::String::NewSymbol("event"));
     180    v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
     181    v8::Handle<v8::Value> jsEvent = global->GetHiddenValue(eventSymbol);
    183182    Event* event = V8DOMWrapper::isValidDOMObject(jsEvent) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)) : 0;
    184183
     
    189188        return event->fromUserGesture();
    190189    }
    191     if (m_sourceURL && m_sourceURL->isNull() && !activeProxy->timerCallback()) {
     190    if (m_sourceURL && m_sourceURL->isNull() && !m_proxy->timerCallback()) {
    192191        // This is the <a href="javascript:window.open('...')> case -> we let it through.
    193192        return true;
  • trunk/WebCore/bindings/v8/V8AbstractEventListener.cpp

    r62274 r62380  
    3939#include "V8Event.h"
    4040#include "V8EventListenerList.h"
     41#include "V8HiddenPropertyName.h"
    4142#include "V8Proxy.h"
    4243#include "V8Utilities.h"
     
    127128
    128129    // We push the event being processed into the global object, so that it can be exposed by DOMWindow's bindings.
    129     v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
     130    v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
    130131    v8::Local<v8::Value> returnValue;
    131132
  • trunk/WebCore/bindings/v8/V8HiddenPropertyName.h

    r62274 r62380  
    4242    V(scriptState) \
    4343    V(sleepFunction) \
    44     V(toStringString)
     44    V(toStringString) \
     45    V(event)
    4546
    4647    class V8HiddenPropertyName {
  • trunk/WebCore/bindings/v8/V8Proxy.cpp

    r61531 r62380  
    363363}
    364364
     365bool V8Proxy::executingScript() const
     366{
     367    return m_recursion;
     368}
     369
    365370v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* node)
    366371{
  • trunk/WebCore/bindings/v8/V8Proxy.h

    r61640 r62380  
    211211        void evaluateInIsolatedWorld(int worldId, const Vector<ScriptSourceCode>& sources, int extensionGroup);
    212212
     213        // Returns true if the proxy is currently executing a script in V8.
     214        bool executingScript() const;
     215
    213216        // Evaluate a script file in the current execution environment.
    214217        // The caller must hold an execution context.
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r62274 r62380  
    5959#include "V8DatabaseCallback.h"
    6060#include "V8GCForContextDispose.h"
     61#include "V8HiddenPropertyName.h"
    6162#include "V8HTMLAudioElementConstructor.h"
    6263#include "V8HTMLCollection.h"
     
    176177        return v8::Undefined();
    177178
    178     v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
     179    v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
    179180    v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol);
    180181    if (jsEvent.IsEmpty())
     
    197198        return;
    198199
    199     v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event");
     200    v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event();
    200201    context->Global()->SetHiddenValue(eventSymbol, value);
    201202}
  • trunk/WebKit/chromium/ChangeLog

    r62351 r62380  
     12010-07-02  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        [v8] Web Inspector: inspected page crashes on attempt to change iframe's src attribute
     6        https://bugs.webkit.org/show_bug.cgi?id=41511
     7
     8        * src/WebBindings.cpp:
     9        (WebKit::getEvent):
     10
    1112010-07-01  Sheriff Bot  <webkit.review.bot@gmail.com>
    212
  • trunk/WebKit/chromium/src/WebBindings.cpp

    r62274 r62380  
    4646#include "V8Event.h"
    4747#include "V8Helpers.h"
     48#include "V8HiddenPropertyName.h"
    4849#include "V8NPUtils.h"
    4950#include "V8Proxy.h"
     
    209210static v8::Local<v8::Value> getEvent(const v8::Handle<v8::Context>& context)
    210211{
    211     static v8::Persistent<v8::String> eventSymbol(v8::Persistent<v8::String>::New(v8::String::NewSymbol("event")));
    212     return context->Global()->GetHiddenValue(eventSymbol);
     212    return context->Global()->GetHiddenValue(V8HiddenPropertyName::event());
    213213}
    214214
Note: See TracChangeset for help on using the changeset viewer.