mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
script: Expose IDBVersionChangeEvent to worker globals. (#37573)
IDBVersionChangeEvent is already used internally from non-Window globals, but the constructor wasn't set up to expose the interface object in worker globals. Testing: The effort involved in adding a test for this does not seem worthwhile—we get this for free once we enable the indexeddb preference while our interfaces.worker.js test is running. Fixes: part of #6963 Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
b622157c10
commit
518729a4f5
2 changed files with 11 additions and 9 deletions
|
@ -11,12 +11,11 @@ use crate::dom::bindings::codegen::Bindings::IDBVersionChangeEventBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::import::module::HandleObject;
|
use crate::dom::bindings::import::module::HandleObject;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{DomGlobal, reflect_dom_object};
|
use crate::dom::bindings::reflector::reflect_dom_object_with_proto;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
|
||||||
use crate::script_runtime::CanGc;
|
use crate::script_runtime::CanGc;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -46,6 +45,7 @@ impl IDBVersionChangeEvent {
|
||||||
) -> DomRoot<IDBVersionChangeEvent> {
|
) -> DomRoot<IDBVersionChangeEvent> {
|
||||||
Self::new_with_proto(
|
Self::new_with_proto(
|
||||||
global,
|
global,
|
||||||
|
None,
|
||||||
type_,
|
type_,
|
||||||
bool::from(bubbles),
|
bool::from(bubbles),
|
||||||
bool::from(cancelable),
|
bool::from(cancelable),
|
||||||
|
@ -55,8 +55,10 @@ impl IDBVersionChangeEvent {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn new_with_proto(
|
fn new_with_proto(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: Atom,
|
type_: Atom,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
|
@ -64,12 +66,13 @@ impl IDBVersionChangeEvent {
|
||||||
new_version: Option<u64>,
|
new_version: Option<u64>,
|
||||||
can_gc: CanGc,
|
can_gc: CanGc,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
let ev = reflect_dom_object(
|
let ev = reflect_dom_object_with_proto(
|
||||||
Box::new(IDBVersionChangeEvent::new_inherited(
|
Box::new(IDBVersionChangeEvent::new_inherited(
|
||||||
old_version,
|
old_version,
|
||||||
new_version,
|
new_version,
|
||||||
)),
|
)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
can_gc,
|
can_gc,
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
|
@ -83,14 +86,15 @@ impl IDBVersionChangeEvent {
|
||||||
impl IDBVersionChangeEventMethods<crate::DomTypeHolder> for IDBVersionChangeEvent {
|
impl IDBVersionChangeEventMethods<crate::DomTypeHolder> for IDBVersionChangeEvent {
|
||||||
/// <https://w3c.github.io/IndexedDB/#dom-idbversionchangeevent-idbversionchangeevent>
|
/// <https://w3c.github.io/IndexedDB/#dom-idbversionchangeevent-idbversionchangeevent>
|
||||||
fn Constructor(
|
fn Constructor(
|
||||||
window: &Window,
|
global: &GlobalScope,
|
||||||
_proto: Option<HandleObject>,
|
proto: Option<HandleObject>,
|
||||||
can_gc: CanGc,
|
can_gc: CanGc,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &IDBVersionChangeEventInit,
|
init: &IDBVersionChangeEventInit,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
Self::new_with_proto(
|
Self::new_with_proto(
|
||||||
&window.global(),
|
global,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
|
|
|
@ -7,10 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// FIXME:(arihant2math) Expose to Worker too
|
|
||||||
|
|
||||||
// https://w3c.github.io/IndexedDB/#idbversionchangeevent
|
// https://w3c.github.io/IndexedDB/#idbversionchangeevent
|
||||||
[Pref="dom_indexeddb_enabled", Exposed=(Window)]
|
[Pref="dom_indexeddb_enabled", Exposed=(Window,Worker)]
|
||||||
interface IDBVersionChangeEvent : Event {
|
interface IDBVersionChangeEvent : Event {
|
||||||
constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict = {});
|
constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict = {});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue