Backed out changeset 121171dddc5b (bug 890405) for Jetpack test failures

Landed on a CLOSED TREE
This commit is contained in:
Ehsan Akhgari 2013-07-11 13:33:19 -04:00
parent 3cd652a520
commit f6d334b2c9
6 changed files with 72 additions and 20 deletions

View File

@ -56,6 +56,7 @@ exports.DOMException = Ci.nsIDOMDOMException;
exports.IDBCursor = Ci.nsIIDBCursor;
exports.IDBTransaction = Ci.nsIIDBTransaction;
exports.IDBOpenDBRequest = Ci.nsIIDBOpenDBRequest;
exports.IDBVersionChangeEvent = Ci.nsIIDBVersionChangeEvent;
exports.IDBDatabase = Ci.nsIIDBDatabase;
exports.IDBIndex = Ci.nsIIDBIndex;
exports.IDBObjectStore = Ci.nsIIDBObjectStore;

View File

@ -16,8 +16,6 @@
USING_INDEXEDDB_NAMESPACE
using namespace mozilla::dom;
NS_DEFINE_STATIC_IID_ACCESSOR(IDBVersionChangeEvent, IDBVERSIONCHANGEEVENT_IID)
namespace {
class EventFiringRunnable : public nsRunnable
@ -97,5 +95,29 @@ NS_IMPL_ADDREF_INHERITED(IDBVersionChangeEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(IDBVersionChangeEvent, nsDOMEvent)
NS_INTERFACE_MAP_BEGIN(IDBVersionChangeEvent)
NS_INTERFACE_MAP_ENTRY(IDBVersionChangeEvent)
NS_INTERFACE_MAP_ENTRY(nsIIDBVersionChangeEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMETHODIMP
IDBVersionChangeEvent::GetOldVersion(uint64_t* aOldVersion)
{
NS_ENSURE_ARG_POINTER(aOldVersion);
*aOldVersion = mOldVersion;
return NS_OK;
}
NS_IMETHODIMP
IDBVersionChangeEvent::GetNewVersion(JSContext* aCx,
JS::Value* aNewVersion)
{
NS_ENSURE_ARG_POINTER(aNewVersion);
if (!mNewVersion) {
*aNewVersion = JSVAL_NULL;
}
else {
*aNewVersion = JS_NumberValue(double(mNewVersion));
}
return NS_OK;
}

View File

@ -9,6 +9,7 @@
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
#include "nsIIDBVersionChangeEvent.h"
#include "nsIRunnable.h"
#include "nsDOMEvent.h"
@ -24,10 +25,6 @@
#define BLOCKED_EVT_STR "blocked"
#define UPGRADENEEDED_EVT_STR "upgradeneeded"
#define IDBVERSIONCHANGEEVENT_IID \
{ 0x3b65d4c3, 0x73ad, 0x492e, \
{ 0xb1, 0x2d, 0x15, 0xf9, 0xda, 0xc2, 0x08, 0x4b } }
BEGIN_INDEXEDDB_NAMESPACE
enum Bubbles {
@ -46,12 +43,13 @@ CreateGenericEvent(mozilla::dom::EventTarget* aOwner,
Bubbles aBubbles,
Cancelable aCancelable);
class IDBVersionChangeEvent : public nsDOMEvent
class IDBVersionChangeEvent : public nsDOMEvent,
public nsIIDBVersionChangeEvent
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_TO_NSDOMEVENT
NS_DECLARE_STATIC_IID_ACCESSOR(IDBVERSIONCHANGEEVENT_IID)
NS_DECL_NSIIDBVERSIONCHANGEEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -8,6 +8,7 @@
#include "nsIDOMFile.h"
#include "nsIDOMEvent.h"
#include "nsIIDBVersionChangeEvent.h"
#include "nsIXPConnect.h"
#include "mozilla/AppProcessChecker.h"
@ -368,10 +369,12 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
if (aType.EqualsLiteral(BLOCKED_EVT_STR)) {
MOZ_ASSERT(!mDatabase);
nsCOMPtr<IDBVersionChangeEvent> changeEvent = do_QueryInterface(aEvent);
nsCOMPtr<nsIIDBVersionChangeEvent> changeEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(changeEvent, NS_ERROR_FAILURE);
uint64_t oldVersion = changeEvent->OldVersion();
uint64_t oldVersion;
rv = changeEvent->GetOldVersion(&oldVersion);
NS_ENSURE_SUCCESS(rv, rv);
if (!SendBlocked(oldVersion)) {
return NS_ERROR_FAILURE;
@ -477,10 +480,12 @@ IndexedDBDatabaseParent::HandleRequestEvent(nsIDOMEvent* aEvent,
return NS_ERROR_FAILURE;
}
nsCOMPtr<IDBVersionChangeEvent> changeEvent = do_QueryInterface(aEvent);
nsCOMPtr<nsIIDBVersionChangeEvent> changeEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(changeEvent, NS_ERROR_FAILURE);
uint64_t oldVersion = changeEvent->OldVersion();
uint64_t oldVersion;
rv = changeEvent->GetOldVersion(&oldVersion);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoPtr<IndexedDBVersionChangeTransactionParent> actor(
new IndexedDBVersionChangeTransactionParent());
@ -516,23 +521,30 @@ IndexedDBDatabaseParent::HandleDatabaseEvent(nsIDOMEvent* aEvent,
"Should never get error events in the parent process!");
MOZ_ASSERT(!IsDisconnected());
nsresult rv;
if (aType.EqualsLiteral(VERSIONCHANGE_EVT_STR)) {
AutoSafeJSContext cx;
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
nsCOMPtr<IDBVersionChangeEvent> changeEvent = do_QueryInterface(aEvent);
nsCOMPtr<nsIIDBVersionChangeEvent> changeEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(changeEvent, NS_ERROR_FAILURE);
uint64_t oldVersion = changeEvent->OldVersion();
uint64_t oldVersion;
rv = changeEvent->GetOldVersion(&oldVersion);
NS_ENSURE_SUCCESS(rv, rv);
Nullable<uint64_t> newVersionVal = changeEvent->GetNewVersion();
JS::Rooted<JS::Value> newVersionVal(cx);
rv = changeEvent->GetNewVersion(cx, newVersionVal.address());
NS_ENSURE_SUCCESS(rv, rv);
uint64_t newVersion;
if (newVersionVal.IsNull()) {
if (newVersionVal.isNull()) {
newVersion = 0;
}
else {
newVersion = newVersionVal.Value();
MOZ_ASSERT(newVersionVal.isNumber());
newVersion = static_cast<uint64_t>(newVersionVal.toNumber());
}
if (!SendVersionChange(oldVersion, newVersion)) {
@ -2100,10 +2112,12 @@ IndexedDBDeleteDatabaseRequestParent::HandleEvent(nsIDOMEvent* aEvent)
NS_ENSURE_SUCCESS(rv, rv);
if (type.EqualsASCII(BLOCKED_EVT_STR)) {
nsCOMPtr<IDBVersionChangeEvent> event = do_QueryInterface(aEvent);
nsCOMPtr<nsIIDBVersionChangeEvent> event = do_QueryInterface(aEvent);
MOZ_ASSERT(event);
uint64_t currentVersion = event->OldVersion();
uint64_t currentVersion;
rv = event->GetOldVersion(&currentVersion);
NS_ENSURE_SUCCESS(rv, rv);
if (!SendBlocked(currentVersion)) {
return NS_ERROR_FAILURE;

View File

@ -17,6 +17,7 @@ XPIDL_SOURCES += [
'nsIIDBOpenDBRequest.idl',
'nsIIDBRequest.idl',
'nsIIDBTransaction.idl',
'nsIIDBVersionChangeEvent.idl',
'nsIIndexedDatabaseManager.idl',
]

View File

@ -0,0 +1,16 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMEvent.idl"
[scriptable, builtinclass, uuid(08a6b8b1-92fa-4f80-98cc-370143b11ff3)]
interface nsIIDBVersionChangeEvent : nsIDOMEvent
{
readonly attribute unsigned long long oldVersion;
[implicit_jscontext]
readonly attribute jsval newVersion;
};