Commit 9aac0415 authored by levin@chromium.org's avatar levin@chromium.org

No review, rolling out r55474.

The patch broke fast/frames/sandboxed-iframe-storage.html

Unfortunately, (the webkit-patch rollout and) I missed these in r55485.

WebCore:

* bindings/js/JSDatabaseCallback.cpp: Removed.
* bindings/js/JSDatabaseCallback.h: Removed.
* bindings/v8/custom/V8DatabaseCallback.cpp: Removed.
* bindings/v8/custom/V8DatabaseCallback.h: Removed.
* storage/DatabaseCallback.h: Removed.

LayoutTests:

* storage/open-database-creation-callback-expected.txt: Removed.
* storage/open-database-creation-callback-isolated-world-expected.txt: Removed.
* storage/open-database-creation-callback-isolated-world.html: Removed.
* storage/open-database-creation-callback.html: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3187f511
2010-03-03 David Levin <levin@chromium.org>
No review, rolling out r55474.
The patch broke fast/frames/sandboxed-iframe-storage.html
Unfortunately, (the webkit-patch rollout and) I missed these in r55485.
* storage/open-database-creation-callback-expected.txt: Removed.
* storage/open-database-creation-callback-isolated-world-expected.txt: Removed.
* storage/open-database-creation-callback-isolated-world.html: Removed.
* storage/open-database-creation-callback.html: Removed.
2010-03-03 Alexey Proskuryakov <ap@apple.com>
Not reviewed.
......
This test tests openDatabase()'s creation callback.
ALERT: undefined
This test tests that the openDatabase() creation callback is called in the right world.
<!DOCTYPE html>
<html>
<body>
This test tests that the openDatabase() creation callback is called in the right world.
<div id="console"></div>
<script>
function done()
{
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function creationCallback(db)
{
alert("FAIL: Visible in isolated world.");
done();
}
document.body.foo = "FAIL: document.body.foo visible in isolated world.";
if (window.layoutTestController) {
layoutTestController.clearAllDatabases();
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
layoutTestController.evaluateScriptInIsolatedWorld(
0,
"function creationCallback(db)\n" +
"{\n" +
" alert(document.body.foo);\n" +
" window.location='javascript:done()';\n" +
"}\n" +
"var db = openDatabase('OpenDatabaseCreationCallbackIsolatedWorld', '1.0', '', 1, creationCallback);");
}
</script>
</body>
</html>
<html>
<head>
<script>
function log(message)
{
document.getElementById("console").innerHTML += message + "<br>";
}
function finishTest()
{
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function runTest()
{
if (window.layoutTestController) {
layoutTestController.clearAllDatabases();
layoutTestController.setDatabaseQuota(32768);
layoutTestController.dumpDatabaseCallbacks();
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var transactionsRun = 0;
// Open a new database with a creation callback, and make sure the creation callback is queued
var creationCallbackCalled1 = false;
var db1 = openDatabase("OpenDatabaseCreationCallback1", "1.0", "", 1,
function(db) {
creationCallbackCalled1 = true;
if (db.version != "") {
log("Creation callback was called with a database with version " +
db.version + "; empty string expected.");
finishTest();
}
});
// Putting this code inside a transaction on 'db1' makes sure that it is executed after
// the creation callback is.
db1.transaction(function(tx) {
if (!creationCallbackCalled1) {
log("Creation callback for db1 was not called.");
finishTest();
}
if (++transactionsRun == 2)
finishTest();
});
// Try to open another handle to the same database.
// Since the version of this database is "" (empty string), openDatabase() should return
// a null handle and throw a INVALID_STATE_ERR exception.
var db1Fail = null;
try {
db1Fail = openDatabase("OpenDatabaseCreationCallback1", "1.0", "", 1);
log("This statement should not have been executed; an INVALID_STATE_ERR exception should've been thrown.");
finishTest();
} catch(err) {
if (db1Fail) {
log("db1Fail should have been null.");
finishTest();
}
}
// Open a handle to another database, first without a creation callback, then with one.
// Make sure the creation callback is not called.
var creationCallbackCalled2 = false;
var db2 = openDatabase("OpenDatabaseCreationCallback2", "1.0", "", 1);
db2 = openDatabase("OpenDatabaseCreationCallback2", "1.0", "", 1,
function(db) { creationCallbackCalled2 = true; });
db2.transaction(function(tx) {
if (creationCallbackCalled2) {
log("Creation callback for db2 should not have been called.");
finishTest();
}
if (++transactionsRun == 2)
finishTest();
});
}
</script>
</head>
<body onload="runTest()">
This test tests openDatabase()'s creation callback.
<pre id="console">
</pre>
</body>
</html>
2010-03-03 David Levin <levin@chromium.org>
No review, rolling out r55474.
The patch broke fast/frames/sandboxed-iframe-storage.html
Unfortunately, (the webkit-patch rollout and) I missed these in r55485.
* bindings/js/JSDatabaseCallback.cpp: Removed.
* bindings/js/JSDatabaseCallback.h: Removed.
* bindings/v8/custom/V8DatabaseCallback.cpp: Removed.
* bindings/v8/custom/V8DatabaseCallback.h: Removed.
* storage/DatabaseCallback.h: Removed.
2010-03-02 Dumitru Daniliuc <dumi@chromium.org>
Reviewed by Dimitri Glazkov.
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSDatabaseCallback.h"
#if ENABLE(DATABASE)
#include "Frame.h"
#include "JSDatabase.h"
#include "ScriptController.h"
#include "ScriptExecutionContext.h"
#include <runtime/JSLock.h>
#include <wtf/MainThread.h>
namespace WebCore {
using namespace JSC;
JSDatabaseCallback::JSDatabaseCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
: m_data(new JSCallbackData(callback, globalObject))
, m_isolatedWorld(DOMWrapperWorld::create(globalObject->globalData(), true))
{
}
JSDatabaseCallback::~JSDatabaseCallback()
{
callOnMainThread(JSCallbackData::deleteData, m_data);
#ifndef NDEBUG
m_data = 0;
#endif
}
void JSDatabaseCallback::handleEvent(ScriptExecutionContext* context, Database* database)
{
ASSERT(m_data);
ASSERT(context);
RefPtr<JSDatabaseCallback> protect(this);
JSC::JSLock lock(SilenceAssertionsOnly);
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
if (!globalObject)
return;
ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
args.append(toJS(exec, database));
bool ignored;
m_data->invokeCallback(args, &ignored);
}
}
#endif // ENABLE(DATABASE)
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef JSDatabaseCallback_h
#define JSDatabaseCallback_h
#if ENABLE(DATABASE)
#include "DatabaseCallback.h"
#include "JSCallbackData.h"
namespace WebCore {
class ScriptExecutionContext;
class JSDatabaseCallback : public DatabaseCallback {
public:
static PassRefPtr<JSDatabaseCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
{
return adoptRef(new JSDatabaseCallback(callback, globalObject));
}
virtual ~JSDatabaseCallback();
virtual void handleEvent(ScriptExecutionContext*, Database*);
private:
JSDatabaseCallback(JSC::JSObject* callback, JSDOMGlobalObject*);
JSCallbackData* m_data;
RefPtr<DOMWrapperWorld> m_isolatedWorld;
};
}
#endif // ENABLE(DATABASE)
#endif // JSDatabaseCallback_h
/*
* Copyright (c) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if ENABLE(DATABASE)
#include "V8DatabaseCallback.h"
#include "Frame.h"
#include "ScriptExecutionContext.h"
#include "V8CustomVoidCallback.h"
#include "V8Database.h"
namespace WebCore {
V8DatabaseCallback::V8DatabaseCallback(v8::Local<v8::Object> callback, Frame* frame)
: m_callback(v8::Persistent<v8::Object>::New(callback))
, m_frame(frame)
, m_worldContext(UseCurrentWorld)
{
}
V8DatabaseCallback::~V8DatabaseCallback()
{
m_callback.Dispose();
}
void V8DatabaseCallback::handleEvent(ScriptExecutionContext* context, Database* database)
{
v8::HandleScope handleScope;
v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
if (v8Context.IsEmpty())
return;
v8::Context::Scope scope(v8Context);
v8::Handle<v8::Value> argv[] = {
toV8(database)
};
// Protect the frame until the callback returns.
RefPtr<Frame> protector(m_frame);
bool callbackReturnValue = false;
invokeCallback(m_callback, 1, argv, callbackReturnValue);
}
} // namespace WebCore
#endif
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef V8DatabaseCallback_h
#define V8DatabaseCallback_h
#if ENABLE(DATABASE)
#include "DatabaseCallback.h"
#include "WorldContextHandle.h"
#include <v8.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class Frame;
class V8DatabaseCallback : public DatabaseCallback {
public:
static PassRefPtr<V8DatabaseCallback> create(v8::Local<v8::Value> value, Frame* frame)
{
ASSERT(value->IsObject());
return adoptRef(new V8DatabaseCallback(value->ToObject(), frame));
}
virtual ~V8DatabaseCallback();
virtual void handleEvent(ScriptExecutionContext*, Database*);
private:
V8DatabaseCallback(v8::Local<v8::Object>, Frame*);
v8::Persistent<v8::Object> m_callback;
RefPtr<Frame> m_frame;
WorldContextHandle m_worldContext;
};
} // namespace WebCore
#endif
#endif // V8DatabaseCallback_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DatabaseCallback_h
#define DatabaseCallback_h
#if ENABLE(DATABASE)
#include <wtf/Threading.h>
namespace WebCore {
class Database;
class ScriptExecutionContext;
class DatabaseCallback : public ThreadSafeShared<DatabaseCallback> {
public:
virtual ~DatabaseCallback() { }
virtual void handleEvent(ScriptExecutionContext*, Database*) = 0;
};
}
#endif
#endif // DatabaseCallback_h
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