Changeset 57530 in webkit


Ignore:
Timestamp:
Apr 13, 2010 2:19:53 PM (14 years ago)
Author:
dumi@chromium.org
Message:

WebCore: Make all HTML5 DB callbacks run in the correct context.
https://bugs.webkit.org/show_bug.cgi?id=27698

Reviewed by Adam Barth.

Tests: storage/statement-error-callback-isolated-world.html

storage/statement-success-callback-isolated-world.html
storage/transaction-callback-isolated-world.html
storage/transaction-error-callback-isolated-world.html

  • bindings/js/JSCustomSQLStatementCallback.cpp:

(WebCore::JSCustomSQLStatementCallback::JSCustomSQLStatementCallback):
(WebCore::JSCustomSQLStatementCallback::handleEvent):

  • bindings/js/JSCustomSQLStatementCallback.h:
  • bindings/js/JSCustomSQLStatementErrorCallback.cpp:

(WebCore::JSCustomSQLStatementErrorCallback::JSCustomSQLStatementErrorCallback):
(WebCore::JSCustomSQLStatementErrorCallback::handleEvent):

  • bindings/js/JSCustomSQLStatementErrorCallback.h:
  • bindings/js/JSCustomSQLTransactionCallback.cpp:

(WebCore::JSCustomSQLTransactionCallback::JSCustomSQLTransactionCallback):
(WebCore::JSCustomSQLTransactionCallback::handleEvent):

  • bindings/js/JSCustomSQLTransactionCallback.h:
  • bindings/js/JSCustomSQLTransactionErrorCallback.cpp:

(WebCore::JSCustomSQLTransactionErrorCallback::JSCustomSQLTransactionErrorCallback):
(WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):

  • bindings/js/JSCustomSQLTransactionErrorCallback.h:
  • bindings/v8/custom/V8CustomSQLStatementCallback.cpp:

(WebCore::V8CustomSQLStatementCallback::V8CustomSQLStatementCallback):
(WebCore::V8CustomSQLStatementCallback::handleEvent):

  • bindings/v8/custom/V8CustomSQLStatementCallback.h:
  • bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:

(WebCore::V8CustomSQLStatementErrorCallback::V8CustomSQLStatementErrorCallback):
(WebCore::V8CustomSQLStatementErrorCallback::handleEvent):

  • bindings/v8/custom/V8CustomSQLStatementErrorCallback.h:
  • bindings/v8/custom/V8CustomSQLTransactionCallback.cpp:

(WebCore::V8CustomSQLTransactionCallback::V8CustomSQLTransactionCallback):
(WebCore::V8CustomSQLTransactionCallback::handleEvent):

  • bindings/v8/custom/V8CustomSQLTransactionCallback.h:
  • bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp:

(WebCore::V8CustomSQLTransactionErrorCallback::V8CustomSQLTransactionErrorCallback):
(WebCore::V8CustomSQLTransactionErrorCallback::handleEvent):

  • bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h:
  • storage/SQLStatement.cpp:

(WebCore::SQLStatement::performCallback):

  • storage/SQLStatementCallback.h:
  • storage/SQLStatementErrorCallback.h:
  • storage/SQLTransaction.cpp:

(WebCore::SQLTransaction::deliverTransactionCallback):
(WebCore::SQLTransaction::deliverTransactionErrorCallback):

  • storage/SQLTransactionCallback.h:
  • storage/SQLTransactionErrorCallback.h:

(WebCore::SQLTransactionErrorCallback::~SQLTransactionErrorCallback):

LayoutTests: Test that the HTML5 DB callbacks run in the correct context.
https://bugs.webkit.org/show_bug.cgi?id=27698

Reviewed by Adam Barth.

  • storage/statement-error-callback-isolated-world-expected.txt: Added.
  • storage/statement-error-callback-isolated-world.html: Added.
  • storage/statement-success-callback-isolated-world-expected.txt: Added.
  • storage/statement-success-callback-isolated-world.html: Added.
  • storage/transaction-callback-isolated-world-expected.txt: Added.
  • storage/transaction-callback-isolated-world.html: Added.
  • storage/transaction-error-callback-isolated-world-expected.txt: Added.
  • storage/transaction-error-callback-isolated-world.html: Added.
Location:
trunk
Files:
8 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r57515 r57530  
     12010-04-13  Dumitru Daniliuc  <dumi@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Test that the HTML5 DB callbacks run in the correct context.
     6        https://bugs.webkit.org/show_bug.cgi?id=27698
     7
     8        * storage/statement-error-callback-isolated-world-expected.txt: Added.
     9        * storage/statement-error-callback-isolated-world.html: Added.
     10        * storage/statement-success-callback-isolated-world-expected.txt: Added.
     11        * storage/statement-success-callback-isolated-world.html: Added.
     12        * storage/transaction-callback-isolated-world-expected.txt: Added.
     13        * storage/transaction-callback-isolated-world.html: Added.
     14        * storage/transaction-error-callback-isolated-world-expected.txt: Added.
     15        * storage/transaction-error-callback-isolated-world.html: Added.
     16
    1172010-04-13  Csaba Osztrogonác  <ossy@webkit.org>
    218
  • trunk/WebCore/ChangeLog

    r57529 r57530  
     12010-04-13  Dumitru Daniliuc  <dumi@chromium.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Make all HTML5 DB callbacks run in the correct context.
     6        https://bugs.webkit.org/show_bug.cgi?id=27698
     7
     8        Tests: storage/statement-error-callback-isolated-world.html
     9               storage/statement-success-callback-isolated-world.html
     10               storage/transaction-callback-isolated-world.html
     11               storage/transaction-error-callback-isolated-world.html
     12
     13        * bindings/js/JSCustomSQLStatementCallback.cpp:
     14        (WebCore::JSCustomSQLStatementCallback::JSCustomSQLStatementCallback):
     15        (WebCore::JSCustomSQLStatementCallback::handleEvent):
     16        * bindings/js/JSCustomSQLStatementCallback.h:
     17        * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
     18        (WebCore::JSCustomSQLStatementErrorCallback::JSCustomSQLStatementErrorCallback):
     19        (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
     20        * bindings/js/JSCustomSQLStatementErrorCallback.h:
     21        * bindings/js/JSCustomSQLTransactionCallback.cpp:
     22        (WebCore::JSCustomSQLTransactionCallback::JSCustomSQLTransactionCallback):
     23        (WebCore::JSCustomSQLTransactionCallback::handleEvent):
     24        * bindings/js/JSCustomSQLTransactionCallback.h:
     25        * bindings/js/JSCustomSQLTransactionErrorCallback.cpp:
     26        (WebCore::JSCustomSQLTransactionErrorCallback::JSCustomSQLTransactionErrorCallback):
     27        (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
     28        * bindings/js/JSCustomSQLTransactionErrorCallback.h:
     29        * bindings/v8/custom/V8CustomSQLStatementCallback.cpp:
     30        (WebCore::V8CustomSQLStatementCallback::V8CustomSQLStatementCallback):
     31        (WebCore::V8CustomSQLStatementCallback::handleEvent):
     32        * bindings/v8/custom/V8CustomSQLStatementCallback.h:
     33        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp:
     34        (WebCore::V8CustomSQLStatementErrorCallback::V8CustomSQLStatementErrorCallback):
     35        (WebCore::V8CustomSQLStatementErrorCallback::handleEvent):
     36        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.h:
     37        * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp:
     38        (WebCore::V8CustomSQLTransactionCallback::V8CustomSQLTransactionCallback):
     39        (WebCore::V8CustomSQLTransactionCallback::handleEvent):
     40        * bindings/v8/custom/V8CustomSQLTransactionCallback.h:
     41        * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp:
     42        (WebCore::V8CustomSQLTransactionErrorCallback::V8CustomSQLTransactionErrorCallback):
     43        (WebCore::V8CustomSQLTransactionErrorCallback::handleEvent):
     44        * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h:
     45        * storage/SQLStatement.cpp:
     46        (WebCore::SQLStatement::performCallback):
     47        * storage/SQLStatementCallback.h:
     48        * storage/SQLStatementErrorCallback.h:
     49        * storage/SQLTransaction.cpp:
     50        (WebCore::SQLTransaction::deliverTransactionCallback):
     51        (WebCore::SQLTransaction::deliverTransactionErrorCallback):
     52        * storage/SQLTransactionCallback.h:
     53        * storage/SQLTransactionErrorCallback.h:
     54        (WebCore::SQLTransactionErrorCallback::~SQLTransactionErrorCallback):
     55
    1562010-04-13  Mikhail Naganov  <mnaganov@chromium.org>
    257
  • trunk/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp

    r49280 r57530  
    3333
    3434#include "Frame.h"
    35 #include "ScriptController.h"
    3635#include "JSSQLResultSet.h"
    3736#include "JSSQLTransaction.h"
     37#include "ScriptExecutionContext.h"
    3838#include <runtime/JSLock.h>
    3939#include <wtf/MainThread.h>
    4040
    4141namespace WebCore {
    42    
     42
    4343using namespace JSC;
    44    
     44
    4545JSCustomSQLStatementCallback::JSCustomSQLStatementCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
    4646    : m_data(new JSCallbackData(callback, globalObject))
     47    , m_isolatedWorld(globalObject->world())
    4748{
    4849}
    49    
     50
    5051JSCustomSQLStatementCallback::~JSCustomSQLStatementCallback()
    5152{
     
    5657}
    5758
    58 void JSCustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException)
     59void JSCustomSQLStatementCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException)
    5960{
    6061    ASSERT(m_data);
     62    ASSERT(context);
    6163
    6264    RefPtr<JSCustomSQLStatementCallback> protect(this);
    6365
    6466    JSC::JSLock lock(SilenceAssertionsOnly);
    65     ExecState* exec = m_data->globalObject()->globalExec();
     67    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
     68    if (!globalObject)
     69        return;
     70
     71    ExecState* exec = globalObject->globalExec();
    6672    MarkedArgumentBuffer args;
    6773    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
  • trunk/WebCore/bindings/js/JSCustomSQLStatementCallback.h

    r49280 r57530  
    4646        return adoptRef(new JSCustomSQLStatementCallback(callback, globalObject));
    4747    }
    48    
     48
    4949    virtual ~JSCustomSQLStatementCallback();
    5050
    51     virtual void handleEvent(SQLTransaction*, SQLResultSet*, bool& raisedException);
     51    virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException);
    5252
    5353private:
     
    5555
    5656    JSCallbackData* m_data;
     57    RefPtr<DOMWrapperWorld> m_isolatedWorld;
    5758};
    5859
  • trunk/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp

    r56572 r57530  
    3636#include "JSSQLError.h"
    3737#include "JSSQLTransaction.h"
    38 #include "ScriptController.h"
     38#include "ScriptExecutionContext.h"
    3939#include <runtime/JSLock.h>
    4040#include <wtf/MainThread.h>
    4141
    4242namespace WebCore {
    43    
     43
    4444using namespace JSC;
    45    
     45
    4646JSCustomSQLStatementErrorCallback::JSCustomSQLStatementErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
    4747    : m_data(new JSCallbackData(callback, globalObject))
     48    , m_isolatedWorld(globalObject->world())
    4849{
    4950}
     
    5758}
    5859
    59 bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
     60bool JSCustomSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
    6061{
    6162    ASSERT(m_data);
    62        
     63    ASSERT(context);
     64
    6365    RefPtr<JSCustomSQLStatementErrorCallback> protect(this);
    64        
     66
    6567    JSC::JSLock lock(SilenceAssertionsOnly);
    66     ExecState* exec = m_data->globalObject()->globalExec();
     68    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
     69    if (!globalObject)
     70        return true; // if we cannot invoke the callback, roll back the transaction
     71
     72    ExecState* exec = globalObject->globalExec();
    6773    MarkedArgumentBuffer args;
    6874    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
    6975    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
    70    
     76
    7177    bool raisedException = false;
    7278    JSValue result = m_data->invokeCallback(args, &raisedException);
  • trunk/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.h

    r49280 r57530  
    3232#if ENABLE(DATABASE)
    3333
    34 #include "JSDOMGlobalObject.h"
     34#include "JSCallbackData.h"
    3535#include "SQLStatementErrorCallback.h"
    36 #include <runtime/Protect.h>
    3736#include <wtf/Forward.h>
    3837
    3938namespace WebCore {
    4039
    41 class JSCallbackData;   
     40class JSCallbackData;
    4241class SQLError;
    43    
     42
    4443class JSCustomSQLStatementErrorCallback : public SQLStatementErrorCallback {
    4544public:
     
    5150    virtual ~JSCustomSQLStatementErrorCallback();
    5251
    53     virtual bool handleEvent(SQLTransaction*, SQLError*);
     52    virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*);
    5453
    5554private:
     
    5756
    5857    JSCallbackData* m_data;
     58    RefPtr<DOMWrapperWorld> m_isolatedWorld;
    5959};
    60    
     60
    6161}
    6262
     
    6464
    6565#endif // JSCustomSQLStatementErrorCallback_h
    66 
  • trunk/WebCore/bindings/js/JSCustomSQLTransactionCallback.cpp

    r49280 r57530  
    3434#include "Frame.h"
    3535#include "JSCallbackData.h"
    36 #include "JSDOMGlobalObject.h"
    3736#include "JSSQLTransaction.h"
    38 #include "Page.h"
    39 #include "ScriptController.h"
     37#include "ScriptExecutionContext.h"
    4038#include <runtime/JSLock.h>
    4139#include <wtf/MainThread.h>
     
    4341
    4442namespace WebCore {
    45    
     43
    4644using namespace JSC;
    47    
     45
    4846#ifndef NDEBUG
    4947static WTF::RefCountedLeakCounter counter("JSCustomSQLTransactionCallback");
     
    5250JSCustomSQLTransactionCallback::JSCustomSQLTransactionCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
    5351    : m_data(new JSCallbackData(callback, globalObject))
     52    , m_isolatedWorld(globalObject->world())
    5453{
    5554#ifndef NDEBUG
     
    6766}
    6867
    69 void JSCustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bool& raisedException)
     68void JSCustomSQLTransactionCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, bool& raisedException)
    7069{
    7170    ASSERT(m_data);
     71    ASSERT(context);
    7272
    7373    RefPtr<JSCustomSQLTransactionCallback> protect(this);
    74        
     74
    7575    JSC::JSLock lock(SilenceAssertionsOnly);
    76     ExecState* exec = m_data->globalObject()->globalExec();
     76    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
     77    if (!globalObject)
     78        return;
     79
     80    ExecState* exec = globalObject->globalExec();
    7781    MarkedArgumentBuffer args;
    7882    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
    7983    m_data->invokeCallback(args, &raisedException);
    8084}
    81    
     85
    8286}
    8387
  • trunk/WebCore/bindings/js/JSCustomSQLTransactionCallback.h

    r49280 r57530  
    3232#if ENABLE(DATABASE)
    3333
     34#include "JSDOMGlobalObject.h"
    3435#include "SQLTransactionCallback.h"
    35 #include <wtf/PassRefPtr.h>
    36 
    37 namespace JSC {
    38     class JSObject;
    39 }
     36#include <wtf/Forward.h>
    4037
    4138namespace WebCore {
     
    5350
    5451    virtual ~JSCustomSQLTransactionCallback();
    55    
    56     virtual void handleEvent(SQLTransaction*, bool& raisedException);
     52
     53    virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException);
    5754
    5855private:
     
    6057
    6158    JSCallbackData* m_data;
     59    RefPtr<DOMWrapperWorld> m_isolatedWorld;
    6260};
    6361
  • trunk/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp

    r49280 r57530  
    3535#include "JSCallbackData.h"
    3636#include "JSSQLError.h"
    37 #include "ScriptController.h"
     37#include "ScriptExecutionContext.h"
    3838#include <runtime/JSLock.h>
    3939#include <wtf/MainThread.h>
    4040
    4141namespace WebCore {
    42    
     42
    4343using namespace JSC;
    44    
     44
    4545JSCustomSQLTransactionErrorCallback::JSCustomSQLTransactionErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
    4646    : m_data(new JSCallbackData(callback, globalObject))
     47    , m_isolatedWorld(globalObject->world())
    4748{
    4849}
     
    5657}
    5758
    58 void JSCustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
     59void JSCustomSQLTransactionErrorCallback::handleEvent(ScriptExecutionContext* context, SQLError* error)
    5960{
    6061    ASSERT(m_data);
     62    ASSERT(context);
    6163
    6264    RefPtr<JSCustomSQLTransactionErrorCallback> protect(this);
    6365
    6466    JSC::JSLock lock(SilenceAssertionsOnly);
    65     ExecState* exec = m_data->globalObject()->globalExec();
     67    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
     68    if (!globalObject)
     69        return;
     70
     71    ExecState* exec = globalObject->globalExec();
    6672    MarkedArgumentBuffer args;
    6773    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
  • trunk/WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.h

    r49280 r57530  
    3232#if ENABLE(DATABASE)
    3333
     34#include "JSCallbackData.h"
    3435#include "SQLTransactionErrorCallback.h"
    35 #include "JSDOMGlobalObject.h"
    36 #include <runtime/Protect.h>
    3736#include <wtf/Forward.h>
    3837
     
    4847        return adoptRef(new JSCustomSQLTransactionErrorCallback(callback, globalObject));
    4948    }
    50    
     49
    5150    virtual ~JSCustomSQLTransactionErrorCallback();
    52    
    53     virtual void handleEvent(SQLError*);
     51
     52    virtual void handleEvent(ScriptExecutionContext*, SQLError*);
    5453
    5554private:
     
    5756
    5857    JSCallbackData* m_data;
     58    RefPtr<DOMWrapperWorld> m_isolatedWorld;
    5959};
    6060
  • trunk/WebCore/bindings/js/JSDatabaseCallback.h

    r55823 r57530  
    3636#include "DatabaseCallback.h"
    3737#include "JSCallbackData.h"
     38#include <wtf/Forward.h>
    3839
    3940namespace WebCore {
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp

    r54305 r57530  
    3636
    3737#include "Frame.h"
     38#include "ScriptExecutionContext.h"
    3839#include "V8CustomVoidCallback.h"
    3940#include "V8SQLResultSet.h"
     
    4546    : m_callback(v8::Persistent<v8::Object>::New(callback))
    4647    , m_frame(frame)
     48    , m_worldContext(UseCurrentWorld)
    4749{
    4850}
     
    5355}
    5456
    55 void V8CustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException)
     57void V8CustomSQLStatementCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException)
    5658{
    5759    v8::HandleScope handleScope;
    5860
    59     v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
    60     if (context.IsEmpty())
     61    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
     62    if (v8Context.IsEmpty())
    6163        return;
    6264
    63     v8::Context::Scope scope(context);
     65    v8::Context::Scope scope(v8Context);
    6466
    6567    v8::Handle<v8::Value> argv[] = {
     
    7880
    7981#endif
    80 
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.h

    r43699 r57530  
    3535
    3636#include "SQLStatementCallback.h"
     37#include "WorldContextHandle.h"
    3738#include <v8.h>
    38 #include <wtf/PassRefPtr.h>
    39 #include <wtf/RefPtr.h>
     39#include <wtf/Forward.h>
    4040
    4141namespace WebCore {
     
    5252    virtual ~V8CustomSQLStatementCallback();
    5353
    54     virtual void handleEvent(SQLTransaction*, SQLResultSet*, bool& raisedException);
     54    virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException);
    5555private:
    5656    V8CustomSQLStatementCallback(v8::Local<v8::Object>, Frame*);
     
    5858    v8::Persistent<v8::Object> m_callback;
    5959    RefPtr<Frame> m_frame;
     60    WorldContextHandle m_worldContext;
    6061};
    6162
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp

    r56572 r57530  
    3636
    3737#include "Frame.h"
     38#include "ScriptExecutionContext.h"
    3839#include "V8CustomVoidCallback.h"
    3940#include "V8SQLError.h"
     
    4546    : m_callback(v8::Persistent<v8::Object>::New(callback))
    4647    , m_frame(frame)
     48    , m_worldContext(UseCurrentWorld)
    4749{
    4850}
     
    5355}
    5456
    55 bool V8CustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
     57bool V8CustomSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
    5658{
    5759    v8::HandleScope handleScope;
    5860
    59     v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
    60     if (context.IsEmpty())
     61    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
     62    if (v8Context.IsEmpty())
    6163        return true;
    6264
    63     v8::Context::Scope scope(context);
     65    v8::Context::Scope scope(v8Context);
    6466
    6567    v8::Handle<v8::Value> argv[] = {
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.h

    r43699 r57530  
    3535
    3636#include "SQLStatementErrorCallback.h"
    37 
    38 #include "SQLStatementErrorCallback.h"
     37#include "WorldContextHandle.h"
    3938#include <v8.h>
    4039#include <wtf/PassRefPtr.h>
     
    5453    virtual ~V8CustomSQLStatementErrorCallback();
    5554
    56     virtual bool handleEvent(SQLTransaction*, SQLError*);
     55    virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*);
    5756private:
    5857    V8CustomSQLStatementErrorCallback(v8::Local<v8::Object>, Frame*);
     
    6059    v8::Persistent<v8::Object> m_callback;
    6160    RefPtr<Frame> m_frame;
     61    WorldContextHandle m_worldContext;
    6262};
    6363
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp

    r54305 r57530  
    3636
    3737#include "Frame.h"
     38#include "ScriptExecutionContext.h"
    3839#include "V8CustomVoidCallback.h"
    3940#include "V8SQLTransaction.h"
     
    4445    : m_callback(v8::Persistent<v8::Object>::New(callback))
    4546    , m_frame(frame)
     47    , m_worldContext(UseCurrentWorld)
    4648{
    4749}
     
    5355
    5456
    55 void V8CustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bool& raisedException)
     57void V8CustomSQLTransactionCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, bool& raisedException)
    5658{
    5759    v8::HandleScope handleScope;
    5860
    59     v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
    60     if (context.IsEmpty())
     61    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
     62    if (v8Context.IsEmpty())
    6163        return;
    6264
    63     v8::Context::Scope scope(context);
     65    v8::Context::Scope scope(v8Context);
    6466
    6567    v8::Handle<v8::Value> argv[] = {
     
    8082
    8183#endif
    82 
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.h

    r43699 r57530  
    3535
    3636#include "SQLTransactionCallback.h"
     37#include "WorldContextHandle.h"
    3738#include <v8.h>
    38 #include <wtf/PassRefPtr.h>
    39 #include <wtf/RefPtr.h>
     39#include <wtf/Forward.h>
    4040
    4141namespace WebCore {
     
    5252    virtual ~V8CustomSQLTransactionCallback();
    5353
    54     virtual void handleEvent(SQLTransaction*, bool& raisedException);
     54    virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException);
    5555private:
    5656    V8CustomSQLTransactionCallback(v8::Local<v8::Object>, Frame*);
     
    5858    v8::Persistent<v8::Object> m_callback;
    5959    RefPtr<Frame> m_frame;
     60    WorldContextHandle m_worldContext;
    6061};
    6162
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp

    r54305 r57530  
    3636
    3737#include "Frame.h"
     38#include "ScriptExecutionContext.h"
    3839#include "V8CustomVoidCallback.h"
    3940#include "V8SQLError.h"
     
    4445    : m_callback(v8::Persistent<v8::Object>::New(callback))
    4546    , m_frame(frame)
     47    , m_worldContext(UseCurrentWorld)
    4648{
    4749}
     
    5254}
    5355
    54 void V8CustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
     56void V8CustomSQLTransactionErrorCallback::handleEvent(ScriptExecutionContext* context, SQLError* error)
    5557{
    5658    v8::HandleScope handleScope;
    5759
    58     v8::Handle<v8::Context> context = V8Proxy::context(m_frame.get());
    59     if (context.IsEmpty())
     60    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
     61    if (v8Context.IsEmpty())
    6062        return;
    6163
    62     v8::Context::Scope scope(context);
     64    v8::Context::Scope scope(v8Context);
    6365
    6466    v8::Handle<v8::Value> argv[] = {
     
    7678
    7779#endif
    78 
  • trunk/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.h

    r44157 r57530  
    3535
    3636#include "SQLTransactionErrorCallback.h"
     37#include "WorldContextHandle.h"
    3738#include <v8.h>
    38 #include <wtf/PassRefPtr.h>
    39 #include <wtf/RefPtr.h>
     39#include <wtf/Forward.h>
    4040
    4141namespace WebCore {
     
    5252    virtual ~V8CustomSQLTransactionErrorCallback();
    5353
    54     virtual void handleEvent(SQLError*);
     54    virtual void handleEvent(ScriptExecutionContext*, SQLError*);
    5555
    5656private:
     
    5959    v8::Persistent<v8::Object> m_callback;
    6060    RefPtr<Frame> m_frame;
     61    WorldContextHandle m_worldContext;
    6162};
    6263
  • trunk/WebCore/bindings/v8/custom/V8DatabaseCallback.h

    r55823 r57530  
    3737#include "WorldContextHandle.h"
    3838#include <v8.h>
    39 #include <wtf/PassRefPtr.h>
    40 #include <wtf/RefPtr.h>
     39#include <wtf/Forward.h>
    4140
    4241namespace WebCore {
  • trunk/WebCore/storage/SQLStatement.cpp

    r49160 r57530  
    173173    if (m_error) {
    174174        ASSERT(m_statementErrorCallback);
    175         callbackError = m_statementErrorCallback->handleEvent(transaction, m_error.get());
     175        callbackError = m_statementErrorCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_error.get());
    176176    } else if (m_statementCallback)
    177         m_statementCallback->handleEvent(transaction, m_resultSet.get(), callbackError);
     177        m_statementCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_resultSet.get(), callbackError);
    178178
    179179    // Now release our callbacks, to break reference cycles.
  • trunk/WebCore/storage/SQLStatementCallback.h

    r47808 r57530  
    3535namespace WebCore {
    3636
     37class ScriptExecutionContext;
    3738class SQLTransaction;
    3839class SQLResultSet;
     
    4142public:
    4243    virtual ~SQLStatementCallback() { }
    43     virtual void handleEvent(SQLTransaction*, SQLResultSet*, bool& raisedException) = 0;
     44    virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*, bool& raisedException) = 0;
    4445};
    4546
  • trunk/WebCore/storage/SQLStatementErrorCallback.h

    r47808 r57530  
    3636namespace WebCore {
    3737
     38class ScriptExecutionContext;
    3839class SQLTransaction;
    3940class SQLError;
     
    4243public:
    4344    virtual ~SQLStatementErrorCallback() { }
    44     virtual bool handleEvent(SQLTransaction*, SQLError*) = 0;
     45    virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*) = 0;
    4546};
    4647
  • trunk/WebCore/storage/SQLTransaction.cpp

    r55487 r57530  
    291291    if (m_callback) {
    292292        m_executeSqlAllowed = true;
    293         m_callback->handleEvent(this, shouldDeliverErrorCallback);
     293        m_callback->handleEvent(m_database->scriptExecutionContext(), this, shouldDeliverErrorCallback);
    294294        m_executeSqlAllowed = false;
    295295    } else
     
    546546    // error to have occurred in this transaction.
    547547    if (m_errorCallback)
    548         m_errorCallback->handleEvent(m_transactionError.get());
     548        m_errorCallback->handleEvent(m_database->scriptExecutionContext(), m_transactionError.get());
    549549
    550550    m_nextStep = &SQLTransaction::cleanupAfterTransactionErrorCallback;
  • trunk/WebCore/storage/SQLTransactionCallback.h

    r47808 r57530  
    3636namespace WebCore {
    3737
     38class ScriptExecutionContext;
    3839class SQLTransaction;
    3940class SQLError;
     
    4243public:
    4344    virtual ~SQLTransactionCallback() { }
    44     virtual void handleEvent(SQLTransaction*, bool& raisedException) = 0;
     45    virtual void handleEvent(ScriptExecutionContext*, SQLTransaction*, bool& raisedException) = 0;
    4546};
    4647
  • trunk/WebCore/storage/SQLTransactionErrorCallback.h

    r47808 r57530  
    3636namespace WebCore {
    3737
    38     class SQLError;
     38class ScriptExecutionContext;
     39class SQLError;
    3940
    40     class SQLTransactionErrorCallback : public ThreadSafeShared<SQLTransactionErrorCallback> {
    41     public:
    42         virtual ~SQLTransactionErrorCallback() { }
    43         virtual void handleEvent(SQLError*) = 0;
    44     };
     41class SQLTransactionErrorCallback : public ThreadSafeShared<SQLTransactionErrorCallback> {
     42public:
     43    virtual ~SQLTransactionErrorCallback() { }
     44    virtual void handleEvent(ScriptExecutionContext*, SQLError*) = 0;
     45};
    4546
    4647}
Note: See TracChangeset for help on using the changeset viewer.