Commit 360b1359 authored by scheib@chromium.org's avatar scheib@chromium.org

Unreviewed, rolling out r132845.

http://trac.webkit.org/changeset/132845
https://bugs.webkit.org/show_bug.cgi?id=99975

Broke chromium builds, linker errors from
IDBBindingUtilitiesTest

Source/WebCore:

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::dispatchEvent):
* Modules/indexeddb/IDBRequest.h:
(IDBRequest):
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromScriptValueAndKeyPath):
(WebCore):
(WebCore::deserializeIDBValue):
(WebCore::injectIDBKeyIntoScriptValue):
(WebCore::idbKeyToScriptValue):
* bindings/v8/V8PerIsolateData.cpp:
(WebCore::V8PerIsolateData::ensureAuxiliaryContext):
(WebCore):
* bindings/v8/V8PerIsolateData.h:
(V8PerIsolateData):

Source/WebKit/chromium:

* tests/IDBBindingUtilitiesTest.cpp:
(WebCore::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132864 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5e352844
2012-10-29 Vincent Scheib <scheib@chromium.org>
Unreviewed, rolling out r132845.
http://trac.webkit.org/changeset/132845
https://bugs.webkit.org/show_bug.cgi?id=99975
Broke chromium builds, linker errors from
IDBBindingUtilitiesTest
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::dispatchEvent):
* Modules/indexeddb/IDBRequest.h:
(IDBRequest):
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromScriptValueAndKeyPath):
(WebCore):
(WebCore::deserializeIDBValue):
(WebCore::injectIDBKeyIntoScriptValue):
(WebCore::idbKeyToScriptValue):
* bindings/v8/V8PerIsolateData.cpp:
(WebCore::V8PerIsolateData::ensureAuxiliaryContext):
(WebCore):
* bindings/v8/V8PerIsolateData.h:
(V8PerIsolateData):
2012-10-29 Anders Carlsson <andersca@apple.com>
Fix Windows build.
......@@ -42,9 +42,6 @@
#include "IDBTracing.h"
#include "IDBTransaction.h"
#include "ScriptExecutionContext.h"
#if USE(V8)
#include "V8Binding.h"
#endif
namespace WebCore {
......@@ -79,9 +76,6 @@ IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> sourc
, m_pendingCursor(0)
, m_didFireUpgradeNeededEvent(false)
, m_preventPropagation(false)
#if USE(V8)
, m_worldContextHandle(UseCurrentWorld)
#endif
{
if (m_transaction) {
m_transaction->registerRequest(this);
......@@ -290,14 +284,6 @@ void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRe
if (!shouldEnqueueEvent())
return;
#if USE(V8)
v8::HandleScope handleScope;
v8::Local<v8::Context> context = toV8Context(scriptExecutionContext(), m_worldContextHandle);
if (context.IsEmpty())
CRASH();
v8::Context::Scope contextScope(context);
#endif
ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedValue);
ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType);
RefPtr<IDBCursor> cursor;
......@@ -354,14 +340,6 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal
if (!shouldEnqueueEvent())
return;
#if USE(V8)
v8::HandleScope handleScope;
v8::Local<v8::Context> context = toV8Context(scriptExecutionContext(), m_worldContextHandle);
if (context.IsEmpty())
CRASH();
v8::Context::Scope contextScope(context);
#endif
ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedScriptValue);
onSuccessInternal(value);
}
......@@ -385,14 +363,6 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScript
if (!shouldEnqueueEvent())
return;
#if USE(V8)
v8::HandleScope handleScope;
v8::Local<v8::Context> context = toV8Context(scriptExecutionContext(), m_worldContextHandle);
if (context.IsEmpty())
CRASH();
v8::Context::Scope contextScope(context);
#endif
#ifndef NDEBUG
ASSERT(keyPath == effectiveObjectStore(m_source)->keyPath());
#endif
......@@ -434,14 +404,6 @@ void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey
if (!shouldEnqueueEvent())
return;
#if USE(V8)
v8::HandleScope handleScope;
v8::Local<v8::Context> context = toV8Context(scriptExecutionContext(), m_worldContextHandle);
if (context.IsEmpty())
CRASH();
v8::Context::Scope contextScope(context);
#endif
ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedValue);
ASSERT(m_pendingCursor);
setResultCursor(m_pendingCursor.release(), key, primaryKey, value);
......@@ -487,15 +449,6 @@ bool IDBRequest::dispatchEvent(PassRefPtr<Event> event)
ASSERT(scriptExecutionContext());
ASSERT(event->target() == this);
ASSERT_WITH_MESSAGE(m_readyState < DONE, "When dispatching event %s, m_readyState < DONE(%d), was %d", event->type().string().utf8().data(), DONE, m_readyState);
#if USE(V8)
v8::HandleScope handleScope;
v8::Local<v8::Context> context = toV8Context(scriptExecutionContext(), m_worldContextHandle);
if (context.IsEmpty())
CRASH();
v8::Context::Scope contextScope(context);
#endif
if (event->type() != eventNames().blockedEvent)
m_readyState = DONE;
......
......@@ -42,9 +42,6 @@
#include "IDBCallbacks.h"
#include "IDBCursor.h"
#include "IDBCursorBackendInterface.h"
#if USE(V8)
#include "WorldContextHandle.h"
#endif
namespace WebCore {
......@@ -158,9 +155,6 @@ private:
bool m_preventPropagation;
EventTargetData m_eventTargetData;
#if USE(V8)
WorldContextHandle m_worldContextHandle;
#endif
};
} // namespace WebCore
......
......@@ -179,9 +179,10 @@ static PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValu
IDBKeyPathParseError error;
IDBParseKeyPath(keyPath, keyPathElements, error);
ASSERT(error == IDBKeyPathParseErrorNone);
ASSERT(v8::Context::InContext());
v8::HandleScope handleScope;
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Handle<v8::Value> v8Value(value.v8Value());
v8::Handle<v8::Value> v8Key(getNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size()));
if (v8Key.IsEmpty())
......@@ -193,10 +194,8 @@ PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue& valu
{
IDB_TRACE("createIDBKeyFromScriptValueAndKeyPath");
ASSERT(!keyPath.isNull());
ASSERT(v8::Context::InContext());
v8::HandleScope handleScope;
v8::HandleScope scope;
if (keyPath.type() == IDBKeyPath::ArrayType) {
IDBKey::KeyArray result;
const Vector<String>& array = keyPath.array();
......@@ -213,10 +212,11 @@ PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue& valu
return createIDBKeyFromScriptValueAndKeyPath(value, keyPath.string());
}
// FIXME: The only reason this exists is because we need a v8::Context and scope inside a timer. Is there a better / more general way to do this?
ScriptValue deserializeIDBValue(ScriptExecutionContext* scriptContext, PassRefPtr<SerializedScriptValue> prpValue)
{
ASSERT(v8::Context::InContext());
v8::HandleScope handleScope;
v8::Context::Scope contextScope(toV8Context(scriptContext, UseCurrentWorld));
RefPtr<SerializedScriptValue> serializedValue = prpValue;
if (serializedValue)
return ScriptValue(serializedValue->deserialize());
......@@ -226,7 +226,6 @@ ScriptValue deserializeIDBValue(ScriptExecutionContext* scriptContext, PassRefPt
bool injectIDBKeyIntoScriptValue(PassRefPtr<IDBKey> key, ScriptValue& value, const IDBKeyPath& keyPath)
{
IDB_TRACE("injectIDBKeyIntoScriptValue");
ASSERT(v8::Context::InContext());
ASSERT(keyPath.type() == IDBKeyPath::StringType);
Vector<String> keyPathElements;
......@@ -238,6 +237,8 @@ bool injectIDBKeyIntoScriptValue(PassRefPtr<IDBKey> key, ScriptValue& value, con
return 0;
v8::HandleScope handleScope;
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Handle<v8::Value> v8Value(value.v8Value());
v8::Handle<v8::Value> parent(ensureNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size() - 1));
if (parent.IsEmpty())
......@@ -267,8 +268,9 @@ bool canInjectIDBKeyIntoScriptValue(const ScriptValue& scriptValue, const IDBKey
ScriptValue idbKeyToScriptValue(ScriptExecutionContext* scriptContext, PassRefPtr<IDBKey> key)
{
ASSERT(v8::Context::InContext());
v8::HandleScope handleScope;
v8::Context::Scope contextScope(toV8Context(scriptContext, UseCurrentWorld));
v8::Handle<v8::Value> v8Value(toV8(key.get()));
return ScriptValue(v8Value);
}
......
......@@ -132,6 +132,13 @@ void V8PerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor)
}
#endif
v8::Handle<v8::Context> V8PerIsolateData::ensureAuxiliaryContext()
{
if (m_auxiliaryContext.isEmpty())
m_auxiliaryContext.adopt(v8::Context::New());
return m_auxiliaryContext.get();
}
v8::Handle<v8::Value> V8PerIsolateData::constructorOfToString(const v8::Arguments& args)
{
// The DOM constructors' toString functions grab the current toString
......
......@@ -86,6 +86,7 @@ public:
DOMDataList& allStores() { return m_domDataList; }
V8HiddenPropertyName* hiddenPropertyName() { return m_hiddenPropertyName.get(); }
v8::Handle<v8::Context> ensureAuxiliaryContext();
void registerDOMDataStore(DOMDataStore* domDataStore)
{
......
2012-10-29 Vincent Scheib <scheib@chromium.org>
Unreviewed, rolling out r132845.
http://trac.webkit.org/changeset/132845
https://bugs.webkit.org/show_bug.cgi?id=99975
Broke chromium builds, linker errors from
IDBBindingUtilitiesTest
* tests/IDBBindingUtilitiesTest.cpp:
(WebCore::TEST):
2012-10-29 James Robinson <jamesr@chromium.org>
[chromium] Defer commits between page unload and first invalidation in threaded compositing mode
......
......@@ -24,19 +24,11 @@
*/
#include "config.h"
#include "Document.h"
#include "Frame.h"
#include "FrameTestHelpers.h"
#include "IDBBindingUtilities.h"
#include "IDBKey.h"
#include "IDBKeyPath.h"
#include "V8Binding.h"
#include "V8PerIsolateData.h"
#include "V8Utilities.h"
#include "WebFrame.h"
#include "WebFrameImpl.h"
#include "WebView.h"
#include "WorldContextHandle.h"
#include <gtest/gtest.h>
#include <wtf/Vector.h>
......@@ -44,7 +36,6 @@
#if ENABLE(INDEXED_DATABASE)
using namespace WebCore;
using namespace WebKit;
namespace {
......@@ -99,21 +90,10 @@ void checkKeyPathNumberValue(const ScriptValue& value, const String& keyPath, in
ASSERT_TRUE(expected == idbKey->number());
}
static v8::Handle<v8::Context> context()
{
static WebView* webView;
if (!webView) {
webView = FrameTestHelpers::createWebViewAndLoad("about:blank");
webView->setFocus(true);
}
ScriptExecutionContext* context = static_cast<WebFrameImpl*>(webView->mainFrame())->frame()->document();
return toV8Context(context, WorldContextHandle(UseCurrentWorld));
}
TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue)
{
v8::HandleScope handleScope;
v8::Context::Scope scope(context());
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::String::New("zoo"));
......@@ -127,7 +107,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue)
TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue)
{
v8::HandleScope handleScope;
v8::Context::Scope scope(context());
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::Number::New(456));
......@@ -141,7 +121,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue)
TEST(IDBKeyFromValueAndKeyPathTest, SubProperty)
{
v8::HandleScope handleScope;
v8::Context::Scope scope(context());
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Local<v8::Object> object = v8::Object::New();
v8::Local<v8::Object> subProperty = v8::Object::New();
......@@ -157,7 +137,7 @@ TEST(IDBKeyFromValueAndKeyPathTest, SubProperty)
TEST(InjectIDBKeyTest, TopLevelPropertyStringValue)
{
v8::HandleScope handleScope;
v8::Context::Scope scope(context());
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Local<v8::Object> object = v8::Object::New();
object->Set(v8::String::New("foo"), v8::String::New("zoo"));
......@@ -172,7 +152,7 @@ TEST(InjectIDBKeyTest, TopLevelPropertyStringValue)
TEST(InjectIDBKeyTest, SubProperty)
{
v8::HandleScope handleScope;
v8::Context::Scope scope(context());
v8::Context::Scope scope(V8PerIsolateData::current()->ensureAuxiliaryContext());
v8::Local<v8::Object> object = v8::Object::New();
v8::Local<v8::Object> subProperty = v8::Object::New();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment