Backed out changeset 457400a5938c (bug 1016053) for bustage.

This commit is contained in:
Ryan VanderMeulen 2014-05-28 16:28:24 -04:00
parent 62fb948444
commit 930d3a8b39
9 changed files with 1 additions and 289 deletions

View File

@ -832,10 +832,6 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
return NS_NewDOMMozSmsEvent(aDOMEvent, aOwner, aPresContext, nullptr);
if (aEventType.LowerCaseEqualsLiteral("mozmmsevent"))
return NS_NewDOMMozMmsEvent(aDOMEvent, aOwner, aPresContext, nullptr);
if (aEventType.LowerCaseEqualsLiteral("storageevent")) {
return NS_NEWDOMStorageEvent(aDOMEvent, aOwner);
}
// NEW EVENT TYPES SHOULD NOT BE ADDED HERE; THEY SHOULD USE ONLY EVENT
// CONSTRUCTORS

View File

@ -1,115 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 "mozilla/dom/StorageEvent.h"
#include "nsIDOMStorage.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_CLASS(StorageEvent)
NS_IMPL_ADDREF_INHERITED(StorageEvent, Event)
NS_IMPL_RELEASE_INHERITED(StorageEvent, Event)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(StorageEvent, Event)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStorageArea)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(StorageEvent, Event)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(StorageEvent, Event)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mStorageArea)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(StorageEvent)
NS_INTERFACE_MAP_END_INHERITING(Event)
StorageEvent::StorageEvent(EventTarget* aOwner)
: Event(aOwner, nullptr, nullptr)
{
}
StorageEvent::~StorageEvent()
{
}
StorageEvent*
StorageEvent::AsStorageEvent()
{
return this;
}
JSObject*
StorageEvent::WrapObject(JSContext* aCx)
{
return StorageEventBinding::Wrap(aCx, this);
}
already_AddRefed<StorageEvent>
StorageEvent::Constructor(EventTarget* aOwner,
const nsAString& aType,
const StorageEventInit& aEventInitDict)
{
nsRefPtr<StorageEvent> e = new StorageEvent(aOwner);
bool trusted = e->Init(aOwner);
e->InitEvent(aType, aEventInitDict.mBubbles, aEventInitDict.mCancelable);
e->mKey = aEventInitDict.mKey;
e->mOldValue = aEventInitDict.mOldValue;
e->mNewValue = aEventInitDict.mNewValue;
e->mUrl = aEventInitDict.mUrl;
e->mStorageArea = aEventInitDict.mStorageArea;
e->SetTrusted(trusted);
return e.forget();
}
already_AddRefed<StorageEvent>
StorageEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const StorageEventInit& aEventInitDict,
ErrorResult& aRv)
{
nsCOMPtr<EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
return Constructor(owner, aType, aEventInitDict);
}
void
StorageEvent::InitStorageEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable, const nsAString& aKey,
const nsAString& aOldValue,
const nsAString& aNewValue,
const nsAString& aURL,
nsIDOMStorage* aStorageArea,
ErrorResult& aRv)
{
aRv = InitEvent(aType, aCanBubble, aCancelable);
if (aRv.Failed()) {
return;
}
mKey = aKey;
mOldValue = aOldValue;
mNewValue = aNewValue;
mUrl = aURL;
mStorageArea = aStorageArea;
}
nsresult
NS_NEWDOMStorageEvent(nsIDOMEvent** aDOMEvent, EventTarget* aOwner)
{
nsRefPtr<StorageEvent> e = new StorageEvent(aOwner);
e->SetTrusted(e->Init(aOwner));
e.forget(aDOMEvent);
return NS_OK;
}
} // namespace dom
} // namespace mozilla

View File

@ -1,90 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#ifndef mozilla_dom_StorageEvent_h
#define mozilla_dom_StorageEvent_h
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/StorageEventBinding.h"
class nsIDOMStorage;
namespace mozilla {
namespace dom {
// Helper for EventDispatcher.
nsresult NS_NEWDOMStorageEvent(nsIDOMEvent** aDOMEvent, EventTarget* aOwner);
class StorageEvent : public Event
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(StorageEvent, Event)
StorageEvent(EventTarget* aOwner);
virtual ~StorageEvent();
protected:
nsString mKey;
nsString mOldValue;
nsString mNewValue;
nsString mUrl;
nsCOMPtr<nsIDOMStorage> mStorageArea;
public:
virtual StorageEvent* AsStorageEvent();
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
static already_AddRefed<StorageEvent>
Constructor(EventTarget* aOwner, const nsAString& aType,
const StorageEventInit& aEventInitDict);
static already_AddRefed<StorageEvent>
Constructor(const GlobalObject& aGlobal, const nsAString& aType,
const StorageEventInit& aEventInitDict, ErrorResult& aRv);
void InitStorageEvent(const nsAString& aType, bool aCanBubble,
bool aCancelable, const nsAString& aKey,
const nsAString& aOldValue,
const nsAString& aNewValue,
const nsAString& aURL,
nsIDOMStorage* aStorageArea,
ErrorResult& aRv);
void GetKey(nsString& aRetVal) const
{
aRetVal = mKey;
}
void GetOldValue(nsString& aRetVal) const
{
aRetVal = mOldValue;
}
void GetNewValue(nsString& aRetVal) const
{
aRetVal = mNewValue;
}
void GetUrl(nsString& aRetVal) const
{
aRetVal = mUrl;
}
nsIDOMStorage* GetStorageArea() const
{
return mStorageArea;
}
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_StorageEvent_h

View File

@ -54,7 +54,6 @@ EXPORTS.mozilla.dom += [
'PointerEvent.h',
'ScrollAreaEvent.h',
'SimpleGestureEvent.h',
'StorageEvent.h',
'Touch.h',
'TouchEvent.h',
'TransitionEvent.h',
@ -99,7 +98,6 @@ UNIFIED_SOURCES += [
'PointerEvent.cpp',
'ScrollAreaEvent.cpp',
'SimpleGestureEvent.cpp',
'StorageEvent.cpp',
'TextComposition.cpp',
'Touch.cpp',
'TouchEvent.cpp',

View File

@ -155,4 +155,3 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
[test_wheel_default_action.html]
skip-if = buildapp == 'b2g' || e10s
[test_bug985988.html]
[test_dom_storage_event.html]

View File

@ -1,62 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for DOM StorageEvent</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
const kTests = [
{ createEventArg: "StorageEvent",
type: "aaa", bubbles: true, cancelable: true,
key: null, oldValue: 'a', newValue: 'b', url: 'c', storageArea: null },
{ createEventArg: "storageevent",
type: "bbb", bubbles: false, cancelable: true,
key: 'key', oldValue: null, newValue: 'b', url: 'c', storageArea: null },
{ createEventArg: "Storageevent",
type: "ccc", bubbles: true, cancelable: false,
key: 'key', oldValue: 'a', newValue: null, url: 'c', storageArea: null },
{ createEventArg: "storageEvent",
type: "ddd", bubbles: false, cancelable: false,
key: 'key', oldValue: 'a', newValue: 'b', url: null, storageArea: null },
{ createEventArg: "StorageEvent",
type: "eee", bubbles: true, cancelable: true,
key: 'key', oldValue: 'a', newValue: 'b', url: 'c', storageArea: null },
{ createEventArg: "storageevent",
type: "fff", bubbles: false, cancelable: true,
key: null, oldValue: null, newValue: null, url: null, storageArea: null },
];
for (var i = 0; i < kTests.length; i++) {
var description = "test, Index: " + i + ", ";
const kTest = kTests[i];
var e = document.createEvent(kTest.createEventArg);
e.initStorageEvent(kTest.type, kTest.bubbles, kTest.cancelable,
kTest.key, kTest.oldValue, kTest.newValue, kTest.url,
kTest.storageArea);
for (var attr in kTest) {
if (attr == 'createEventArg')
continue;
is(e[attr], kTest[attr], description + attr + " returns wrong value");
}
is(e.isTrusted, false, description + "isTrusted returns wrong value");
}
</script>
</pre>
</body>
</html>

View File

@ -559,9 +559,6 @@ is(receivedEvent, e, "Wrong event!");
// StorageEvent
e = document.createEvent("StorageEvent");
ok(e, "Should have created an event!");
try {
e = new StorageEvent();
} catch(exp) {

View File

@ -19,17 +19,6 @@ interface StorageEvent : Event
readonly attribute DOMString? newValue;
readonly attribute DOMString? url;
readonly attribute Storage? storageArea;
// Bug 1016053 - This is not spec compliant.
[Throws]
void initStorageEvent(DOMString type,
boolean canBubble,
boolean cancelable,
DOMString? key,
DOMString? oldValue,
DOMString? newValue,
DOMString? url,
Storage? storageArea);
};
dictionary StorageEventInit : EventInit

View File

@ -314,7 +314,6 @@ WEBIDL_FILES = [
'SimpleGestureEvent.webidl',
'SourceBuffer.webidl',
'SourceBufferList.webidl',
'StorageEvent.webidl',
'StorageType.webidl',
'StyleSheet.webidl',
'StyleSheetList.webidl',
@ -641,6 +640,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
'RTCPeerConnectionIceEvent.webidl',
'RTCPeerConnectionIdentityErrorEvent.webidl',
'RTCPeerConnectionIdentityEvent.webidl',
'StorageEvent.webidl',
'TrackEvent.webidl',
'UserProximityEvent.webidl',
'USSDReceivedEvent.webidl',