зеркало из https://github.com/mozilla/gecko-dev.git
Bug 834165 - Implement BlobEvent. r=smaug
--HG-- extra : rebase_source : 5d8f13baa4b2ff00a63300be54edb81ab2555bd9
This commit is contained in:
Родитель
993bc20af1
Коммит
adf4ce2388
|
@ -162,6 +162,47 @@ try {
|
|||
ok(ex, "Should have thrown an exception!");
|
||||
ex = false;
|
||||
|
||||
// BlobEvent
|
||||
|
||||
try {
|
||||
e = new BlobEvent();
|
||||
} catch(exp) {
|
||||
ex = true;
|
||||
}
|
||||
ok(ex, "First parameter is required!");
|
||||
ex = false;
|
||||
|
||||
e = new BlobEvent("hello");
|
||||
ok(e.type, "hello", "Wrong event type!");
|
||||
ok(!e.isTrusted, "Event shouldn't be trusted!");
|
||||
ok(!e.bubbles, "Event shouldn't bubble!");
|
||||
ok(!e.cancelable, "Event shouldn't be cancelable!");
|
||||
document.dispatchEvent(e);
|
||||
is(receivedEvent, e, "Wrong event!");
|
||||
|
||||
var blob = Blob();
|
||||
e = new BlobEvent("hello", { bubbles: true, cancelable: true, data: blob });
|
||||
ok(e.type, "hello", "Wrong event type!");
|
||||
ok(!e.isTrusted, "Event shouldn't be trusted!");
|
||||
ok(e.bubbles, "Event should bubble!");
|
||||
ok(e.cancelable, "Event should be cancelable!");
|
||||
is(e.data, blob , "Wrong event.data!");
|
||||
document.dispatchEvent(e);
|
||||
is(receivedEvent, e, "Wrong event!");
|
||||
|
||||
|
||||
e = new BlobEvent("hello", {data: blob});
|
||||
ok(e.type, "hello", "Wrong event type!");
|
||||
ok(!e.isTrusted, "Event shouldn't be trusted!");
|
||||
ok(!e.bubbles, "Event shouldn't bubble!");
|
||||
ok(!e.cancelable, "Event should be cancelable1!");
|
||||
is(e.data, blob , "Wrong event.data!");
|
||||
|
||||
e = new BlobEvent("hello", { data: null });
|
||||
is(e.data, null, "Wrong event.data!");
|
||||
ok(!e.bubbles, "Event shouldn't bubble!");
|
||||
ok(!e.cancelable, "Event shouldn't be cancelable!");
|
||||
blob = null;
|
||||
// CloseEvent
|
||||
|
||||
try {
|
||||
|
|
|
@ -58,6 +58,7 @@ XPIDLSRCS = \
|
|||
nsIDOMCustomEvent.idl \
|
||||
nsIDOMCompositionEvent.idl \
|
||||
nsIDOMWheelEvent.idl \
|
||||
nsIDOMBlobEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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"
|
||||
interface nsIDOMBlob;
|
||||
/**
|
||||
* The nsIDOMBlobEvent interface is used for server-sent events
|
||||
*
|
||||
* For more information on this interface, please see
|
||||
* https://dvcs.w3.org/hg/dap/raw-file/tip/media-stream-capture/RecordingProposal.html
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(84293ee0-68f5-11e2-9906-cf63ba8c6e43)]
|
||||
interface nsIDOMBlobEvent : nsIDOMEvent
|
||||
{
|
||||
/**
|
||||
* Custom blob data associated with this event.
|
||||
*/
|
||||
readonly attribute nsIDOMBlob data;
|
||||
|
||||
[noscript]
|
||||
void initBlobEvent(in DOMString aType,
|
||||
in boolean aCanBubble,
|
||||
in boolean aCancelable,
|
||||
in nsIDOMBlob aData);
|
||||
};
|
||||
|
||||
dictionary BlobEventInit : EventInit {
|
||||
nsIDOMBlob data;
|
||||
};
|
|
@ -532,7 +532,8 @@ var interfaceNamesInGlobalScope =
|
|||
"CSSGroupingRule",
|
||||
"AsyncScrollEventDetail",
|
||||
"MozSmsSegmentInfo",
|
||||
"DOMCursor"
|
||||
"DOMCursor",
|
||||
"BlobEvent"
|
||||
]
|
||||
|
||||
for (var i in SpecialPowers.Components.interfaces) {
|
||||
|
|
|
@ -28,11 +28,13 @@ dictionaries = [
|
|||
special_includes = [
|
||||
'nsContentUtils.h',
|
||||
'XPCQuickStubs.h',
|
||||
'nsIDOMApplicationRegistry.h'
|
||||
'nsIDOMApplicationRegistry.h',
|
||||
'nsIDOMFile.h'
|
||||
]
|
||||
|
||||
# name of the type to not include using #include "typename.h"
|
||||
exclude_automatic_type_include = [
|
||||
'nsISupports',
|
||||
'mozIDOMApplication'
|
||||
'mozIDOMApplication',
|
||||
'nsIDOMBlob'
|
||||
]
|
||||
|
|
|
@ -41,18 +41,21 @@ simple_events = [
|
|||
#endif
|
||||
'MozSmsEvent',
|
||||
'DeviceStorageChangeEvent',
|
||||
'PopupBlockedEvent'
|
||||
'PopupBlockedEvent',
|
||||
'BlobEvent'
|
||||
]
|
||||
|
||||
""" include file names """
|
||||
special_includes = [
|
||||
'DictionaryHelpers.h',
|
||||
'nsContentUtils.h',
|
||||
'nsIDOMApplicationRegistry.h'
|
||||
'nsIDOMApplicationRegistry.h',
|
||||
'nsIDOMFile.h'
|
||||
]
|
||||
|
||||
""" name of the type to not include using #include "typename.h" """
|
||||
exclude_automatic_type_include = [
|
||||
'nsISupports',
|
||||
'mozIDOMApplication'
|
||||
'mozIDOMApplication',
|
||||
'nsIDOMBlob'
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче