mirror of
https://github.com/servo/servo.git
synced 2025-08-26 23:58:20 +01:00
content: Make QuotaExceededError serializable (#38720)
Implements (de)serialization behavior for QuotaExceededError and enables the annotation on the WebIDL spec. Testing: Adds its own WPT tests Fixes: https://github.com/servo/servo/issues/38685 --------- Signed-off-by: Rahul Menon <menonrahul02@gmail.com>
This commit is contained in:
parent
e80d36783a
commit
389277fa72
8 changed files with 149 additions and 7 deletions
|
@ -11,12 +11,12 @@ use std::ptr;
|
||||||
|
|
||||||
use base::id::{
|
use base::id::{
|
||||||
BlobId, DomExceptionId, DomPointId, ImageBitmapId, Index, MessagePortId, NamespaceIndex,
|
BlobId, DomExceptionId, DomPointId, ImageBitmapId, Index, MessagePortId, NamespaceIndex,
|
||||||
OffscreenCanvasId, PipelineNamespaceId,
|
OffscreenCanvasId, PipelineNamespaceId, QuotaExceededErrorId,
|
||||||
};
|
};
|
||||||
use constellation_traits::{
|
use constellation_traits::{
|
||||||
BlobImpl, DomException, DomPoint, MessagePortImpl, Serializable as SerializableInterface,
|
BlobImpl, DomException, DomPoint, MessagePortImpl, Serializable as SerializableInterface,
|
||||||
SerializableImageBitmap, StructuredSerializedData, TransferableOffscreenCanvas,
|
SerializableImageBitmap, SerializableQuotaExceededError, StructuredSerializedData,
|
||||||
Transferrable as TransferrableInterface, TransformStreamData,
|
TransferableOffscreenCanvas, Transferrable as TransferrableInterface, TransformStreamData,
|
||||||
};
|
};
|
||||||
use js::gc::RootedVec;
|
use js::gc::RootedVec;
|
||||||
use js::glue::{
|
use js::glue::{
|
||||||
|
@ -49,7 +49,7 @@ use crate::dom::imagebitmap::ImageBitmap;
|
||||||
use crate::dom::messageport::MessagePort;
|
use crate::dom::messageport::MessagePort;
|
||||||
use crate::dom::offscreencanvas::OffscreenCanvas;
|
use crate::dom::offscreencanvas::OffscreenCanvas;
|
||||||
use crate::dom::readablestream::ReadableStream;
|
use crate::dom::readablestream::ReadableStream;
|
||||||
use crate::dom::types::{DOMException, TransformStream};
|
use crate::dom::types::{DOMException, QuotaExceededError, TransformStream};
|
||||||
use crate::dom::writablestream::WritableStream;
|
use crate::dom::writablestream::WritableStream;
|
||||||
use crate::realms::{AlreadyInRealm, InRealm, enter_realm};
|
use crate::realms::{AlreadyInRealm, InRealm, enter_realm};
|
||||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||||
|
@ -73,6 +73,7 @@ pub(super) enum StructuredCloneTags {
|
||||||
TransformStream = 0xFFFF8009,
|
TransformStream = 0xFFFF8009,
|
||||||
ImageBitmap = 0xFFFF800A,
|
ImageBitmap = 0xFFFF800A,
|
||||||
OffscreenCanvas = 0xFFFF800B,
|
OffscreenCanvas = 0xFFFF800B,
|
||||||
|
QuotaExceededError = 0xFFFF800C,
|
||||||
Max = 0xFFFFFFFF,
|
Max = 0xFFFFFFFF,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ impl From<SerializableInterface> for StructuredCloneTags {
|
||||||
SerializableInterface::DomPoint => StructuredCloneTags::DomPoint,
|
SerializableInterface::DomPoint => StructuredCloneTags::DomPoint,
|
||||||
SerializableInterface::DomException => StructuredCloneTags::DomException,
|
SerializableInterface::DomException => StructuredCloneTags::DomException,
|
||||||
SerializableInterface::ImageBitmap => StructuredCloneTags::ImageBitmap,
|
SerializableInterface::ImageBitmap => StructuredCloneTags::ImageBitmap,
|
||||||
|
SerializableInterface::QuotaExceededError => StructuredCloneTags::QuotaExceededError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +117,7 @@ fn reader_for_type(
|
||||||
SerializableInterface::DomPoint => read_object::<DOMPoint>,
|
SerializableInterface::DomPoint => read_object::<DOMPoint>,
|
||||||
SerializableInterface::DomException => read_object::<DOMException>,
|
SerializableInterface::DomException => read_object::<DOMException>,
|
||||||
SerializableInterface::ImageBitmap => read_object::<ImageBitmap>,
|
SerializableInterface::ImageBitmap => read_object::<ImageBitmap>,
|
||||||
|
SerializableInterface::QuotaExceededError => read_object::<QuotaExceededError>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +262,7 @@ fn serialize_for_type(val: SerializableInterface) -> SerializeOperation {
|
||||||
SerializableInterface::DomPoint => try_serialize::<DOMPoint>,
|
SerializableInterface::DomPoint => try_serialize::<DOMPoint>,
|
||||||
SerializableInterface::DomException => try_serialize::<DOMException>,
|
SerializableInterface::DomException => try_serialize::<DOMException>,
|
||||||
SerializableInterface::ImageBitmap => try_serialize::<ImageBitmap>,
|
SerializableInterface::ImageBitmap => try_serialize::<ImageBitmap>,
|
||||||
|
SerializableInterface::QuotaExceededError => try_serialize::<QuotaExceededError>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,6 +574,9 @@ pub(crate) struct StructuredDataReader<'a> {
|
||||||
pub(crate) points: Option<HashMap<DomPointId, DomPoint>>,
|
pub(crate) points: Option<HashMap<DomPointId, DomPoint>>,
|
||||||
/// A map of serialized exceptions.
|
/// A map of serialized exceptions.
|
||||||
pub(crate) exceptions: Option<HashMap<DomExceptionId, DomException>>,
|
pub(crate) exceptions: Option<HashMap<DomExceptionId, DomException>>,
|
||||||
|
/// A map of serialized quota exceeded errors.
|
||||||
|
pub(crate) quota_exceeded_errors:
|
||||||
|
Option<HashMap<QuotaExceededErrorId, SerializableQuotaExceededError>>,
|
||||||
// A map of serialized image bitmaps.
|
// A map of serialized image bitmaps.
|
||||||
pub(crate) image_bitmaps: Option<HashMap<ImageBitmapId, SerializableImageBitmap>>,
|
pub(crate) image_bitmaps: Option<HashMap<ImageBitmapId, SerializableImageBitmap>>,
|
||||||
/// A map of transferred image bitmaps.
|
/// A map of transferred image bitmaps.
|
||||||
|
@ -592,6 +599,9 @@ pub(crate) struct StructuredDataWriter {
|
||||||
pub(crate) points: Option<HashMap<DomPointId, DomPoint>>,
|
pub(crate) points: Option<HashMap<DomPointId, DomPoint>>,
|
||||||
/// Serialized exceptions.
|
/// Serialized exceptions.
|
||||||
pub(crate) exceptions: Option<HashMap<DomExceptionId, DomException>>,
|
pub(crate) exceptions: Option<HashMap<DomExceptionId, DomException>>,
|
||||||
|
/// Serialized quota exceeded errors.
|
||||||
|
pub(crate) quota_exceeded_errors:
|
||||||
|
Option<HashMap<QuotaExceededErrorId, SerializableQuotaExceededError>>,
|
||||||
/// Serialized blobs.
|
/// Serialized blobs.
|
||||||
pub(crate) blobs: Option<HashMap<BlobId, BlobImpl>>,
|
pub(crate) blobs: Option<HashMap<BlobId, BlobImpl>>,
|
||||||
/// Serialized image bitmaps.
|
/// Serialized image bitmaps.
|
||||||
|
@ -656,6 +666,7 @@ pub(crate) fn write(
|
||||||
transform_streams: sc_writer.transform_streams_port.take(),
|
transform_streams: sc_writer.transform_streams_port.take(),
|
||||||
points: sc_writer.points.take(),
|
points: sc_writer.points.take(),
|
||||||
exceptions: sc_writer.exceptions.take(),
|
exceptions: sc_writer.exceptions.take(),
|
||||||
|
quota_exceeded_errors: sc_writer.quota_exceeded_errors.take(),
|
||||||
blobs: sc_writer.blobs.take(),
|
blobs: sc_writer.blobs.take(),
|
||||||
image_bitmaps: sc_writer.image_bitmaps.take(),
|
image_bitmaps: sc_writer.image_bitmaps.take(),
|
||||||
transferred_image_bitmaps: sc_writer.transferred_image_bitmaps.take(),
|
transferred_image_bitmaps: sc_writer.transferred_image_bitmaps.take(),
|
||||||
|
@ -684,6 +695,7 @@ pub(crate) fn read(
|
||||||
blob_impls: data.blobs.take(),
|
blob_impls: data.blobs.take(),
|
||||||
points: data.points.take(),
|
points: data.points.take(),
|
||||||
exceptions: data.exceptions.take(),
|
exceptions: data.exceptions.take(),
|
||||||
|
quota_exceeded_errors: data.quota_exceeded_errors.take(),
|
||||||
image_bitmaps: data.image_bitmaps.take(),
|
image_bitmaps: data.image_bitmaps.take(),
|
||||||
transferred_image_bitmaps: data.transferred_image_bitmaps.take(),
|
transferred_image_bitmaps: data.transferred_image_bitmaps.take(),
|
||||||
offscreen_canvases: data.offscreen_canvases.take(),
|
offscreen_canvases: data.offscreen_canvases.take(),
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use base::id::{QuotaExceededErrorId, QuotaExceededErrorIndex};
|
||||||
|
use constellation_traits::SerializableQuotaExceededError;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::gc::HandleObject;
|
use js::gc::HandleObject;
|
||||||
use script_bindings::codegen::GenericBindings::QuotaExceededErrorBinding::{
|
use script_bindings::codegen::GenericBindings::QuotaExceededErrorBinding::{
|
||||||
|
@ -14,6 +18,8 @@ use script_bindings::str::DOMString;
|
||||||
|
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, reflect_dom_object_with_proto};
|
use crate::dom::bindings::reflector::{reflect_dom_object, reflect_dom_object_with_proto};
|
||||||
|
use crate::dom::bindings::serializable::Serializable;
|
||||||
|
use crate::dom::bindings::structuredclone::StructuredData;
|
||||||
use crate::dom::types::{DOMException, GlobalScope};
|
use crate::dom::types::{DOMException, GlobalScope};
|
||||||
|
|
||||||
/// <https://webidl.spec.whatwg.org/#quotaexceedederror>
|
/// <https://webidl.spec.whatwg.org/#quotaexceedederror>
|
||||||
|
@ -116,3 +122,53 @@ impl QuotaExceededErrorMethods<crate::DomTypeHolder> for QuotaExceededError {
|
||||||
self.requested
|
self.requested
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Serializable for QuotaExceededError {
|
||||||
|
type Index = QuotaExceededErrorIndex;
|
||||||
|
type Data = SerializableQuotaExceededError;
|
||||||
|
|
||||||
|
/// <https://webidl.spec.whatwg.org/#quotaexceedederror>
|
||||||
|
fn serialize(&self) -> Result<(QuotaExceededErrorId, Self::Data), ()> {
|
||||||
|
let (_, dom_exception) = self.dom_exception.serialize()?;
|
||||||
|
let serialized = SerializableQuotaExceededError {
|
||||||
|
dom_exception,
|
||||||
|
quota: self.quota.as_deref().copied(),
|
||||||
|
requested: self.requested.as_deref().copied(),
|
||||||
|
};
|
||||||
|
Ok((QuotaExceededErrorId::new(), serialized))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://webidl.spec.whatwg.org/#quotaexceedederror>
|
||||||
|
fn deserialize(
|
||||||
|
owner: &GlobalScope,
|
||||||
|
serialized: Self::Data,
|
||||||
|
can_gc: CanGc,
|
||||||
|
) -> Result<DomRoot<Self>, ()>
|
||||||
|
where
|
||||||
|
Self: Sized,
|
||||||
|
{
|
||||||
|
Ok(Self::new(
|
||||||
|
owner,
|
||||||
|
DOMString::from(serialized.dom_exception.message),
|
||||||
|
serialized
|
||||||
|
.quota
|
||||||
|
.map(|val| Finite::new(val).ok_or(()))
|
||||||
|
.transpose()?,
|
||||||
|
serialized
|
||||||
|
.requested
|
||||||
|
.map(|val| Finite::new(val).ok_or(()))
|
||||||
|
.transpose()?,
|
||||||
|
can_gc,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <https://webidl.spec.whatwg.org/#quotaexceedederror>
|
||||||
|
fn serialized_storage<'a>(
|
||||||
|
data: StructuredData<'a, '_>,
|
||||||
|
) -> &'a mut Option<HashMap<QuotaExceededErrorId, Self::Data>> {
|
||||||
|
match data {
|
||||||
|
StructuredData::Reader(reader) => &mut reader.quota_exceeded_errors,
|
||||||
|
StructuredData::Writer(writer) => &mut writer.quota_exceeded_errors,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
[
|
[
|
||||||
Exposed=(Window,Worker,Worklet,DissimilarOriginWindow),
|
Exposed=(Window,Worker,Worklet,DissimilarOriginWindow),
|
||||||
// Serializable
|
Serializable
|
||||||
]
|
]
|
||||||
interface QuotaExceededError : DOMException {
|
interface QuotaExceededError : DOMException {
|
||||||
[Throws] constructor(optional DOMString message = "", optional QuotaExceededErrorOptions options = {});
|
[Throws] constructor(optional DOMString message = "", optional QuotaExceededErrorOptions options = {});
|
||||||
|
|
|
@ -368,6 +368,8 @@ namespace_id! {DomPointId, DomPointIndex, "DomPoint"}
|
||||||
|
|
||||||
namespace_id! {DomExceptionId, DomExceptionIndex, "DomException"}
|
namespace_id! {DomExceptionId, DomExceptionIndex, "DomException"}
|
||||||
|
|
||||||
|
namespace_id! {QuotaExceededErrorId, QuotaExceededErrorIndex, "QuotaExceededError"}
|
||||||
|
|
||||||
namespace_id! {HistoryStateId, HistoryStateIndex, "HistoryState"}
|
namespace_id! {HistoryStateId, HistoryStateIndex, "HistoryState"}
|
||||||
|
|
||||||
namespace_id! {ImageBitmapId, ImageBitmapIndex, "ImageBitmap"}
|
namespace_id! {ImageBitmapId, ImageBitmapIndex, "ImageBitmap"}
|
||||||
|
|
|
@ -12,6 +12,7 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
use base::id::{
|
use base::id::{
|
||||||
BlobId, DomExceptionId, DomPointId, ImageBitmapId, MessagePortId, OffscreenCanvasId,
|
BlobId, DomExceptionId, DomPointId, ImageBitmapId, MessagePortId, OffscreenCanvasId,
|
||||||
|
QuotaExceededErrorId,
|
||||||
};
|
};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use malloc_size_of_derive::MallocSizeOf;
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
|
@ -32,6 +33,9 @@ pub struct StructuredSerializedData {
|
||||||
pub points: Option<HashMap<DomPointId, DomPoint>>,
|
pub points: Option<HashMap<DomPointId, DomPoint>>,
|
||||||
/// Serialized exception objects.
|
/// Serialized exception objects.
|
||||||
pub exceptions: Option<HashMap<DomExceptionId, DomException>>,
|
pub exceptions: Option<HashMap<DomExceptionId, DomException>>,
|
||||||
|
/// Serialized quota exceeded errors.
|
||||||
|
pub quota_exceeded_errors:
|
||||||
|
Option<HashMap<QuotaExceededErrorId, SerializableQuotaExceededError>>,
|
||||||
/// Transferred objects.
|
/// Transferred objects.
|
||||||
pub ports: Option<HashMap<MessagePortId, MessagePortImpl>>,
|
pub ports: Option<HashMap<MessagePortId, MessagePortImpl>>,
|
||||||
/// Transform streams transferred objects.
|
/// Transform streams transferred objects.
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use base::id::{BlobId, DomExceptionId, DomPointId, ImageBitmapId};
|
use base::id::{BlobId, DomExceptionId, DomPointId, ImageBitmapId, QuotaExceededErrorId};
|
||||||
use malloc_size_of_derive::MallocSizeOf;
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
use net_traits::filemanager_thread::RelativePos;
|
use net_traits::filemanager_thread::RelativePos;
|
||||||
use pixels::Snapshot;
|
use pixels::Snapshot;
|
||||||
|
@ -38,6 +38,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the DOM interfaces that can be serialized.
|
/// All the DOM interfaces that can be serialized.
|
||||||
|
///
|
||||||
|
/// NOTE: Variants which are derived from other serializable interfaces must come before their
|
||||||
|
/// parents because serialization is attempted in order of the variants.
|
||||||
#[derive(Clone, Copy, Debug, EnumIter)]
|
#[derive(Clone, Copy, Debug, EnumIter)]
|
||||||
pub enum Serializable {
|
pub enum Serializable {
|
||||||
/// The `Blob` interface.
|
/// The `Blob` interface.
|
||||||
|
@ -46,6 +49,8 @@ pub enum Serializable {
|
||||||
DomPoint,
|
DomPoint,
|
||||||
/// The `DOMPointReadOnly` interface.
|
/// The `DOMPointReadOnly` interface.
|
||||||
DomPointReadOnly,
|
DomPointReadOnly,
|
||||||
|
/// The `QuotaExceededError` interface.
|
||||||
|
QuotaExceededError,
|
||||||
/// The `DOMException` interface.
|
/// The `DOMException` interface.
|
||||||
DomException,
|
DomException,
|
||||||
/// The `ImageBitmap` interface.
|
/// The `ImageBitmap` interface.
|
||||||
|
@ -68,6 +73,9 @@ impl Serializable {
|
||||||
Serializable::ImageBitmap => {
|
Serializable::ImageBitmap => {
|
||||||
StructuredSerializedData::clone_all_of_type::<SerializableImageBitmap>
|
StructuredSerializedData::clone_all_of_type::<SerializableImageBitmap>
|
||||||
},
|
},
|
||||||
|
Serializable::QuotaExceededError => {
|
||||||
|
StructuredSerializedData::clone_all_of_type::<SerializableQuotaExceededError>
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,6 +327,30 @@ impl BroadcastClone for DomException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
|
/// A serializable version of the QuotaExceededError interface.
|
||||||
|
pub struct SerializableQuotaExceededError {
|
||||||
|
pub dom_exception: DomException,
|
||||||
|
pub quota: Option<f64>,
|
||||||
|
pub requested: Option<f64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BroadcastClone for SerializableQuotaExceededError {
|
||||||
|
type Id = QuotaExceededErrorId;
|
||||||
|
|
||||||
|
fn source(data: &StructuredSerializedData) -> &Option<HashMap<Self::Id, Self>> {
|
||||||
|
&data.quota_exceeded_errors
|
||||||
|
}
|
||||||
|
|
||||||
|
fn destination(data: &mut StructuredSerializedData) -> &mut Option<HashMap<Self::Id, Self>> {
|
||||||
|
&mut data.quota_exceeded_errors
|
||||||
|
}
|
||||||
|
|
||||||
|
fn clone_for_broadcast(&self) -> Option<Self> {
|
||||||
|
Some(self.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
/// A serializable version of the ImageBitmap interface.
|
/// A serializable version of the ImageBitmap interface.
|
||||||
pub struct SerializableImageBitmap {
|
pub struct SerializableImageBitmap {
|
||||||
|
|
2
tests/wpt/meta/MANIFEST.json
vendored
2
tests/wpt/meta/MANIFEST.json
vendored
|
@ -735329,7 +735329,7 @@
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"structuredclone_0.html": [
|
"structuredclone_0.html": [
|
||||||
"c8a6d38393c0217447992d47c994942e873e70ad",
|
"0d412baa701d5f1a5efb43bb470ca6aff849e082",
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -605,6 +605,42 @@
|
||||||
assert_unreached("Window must not be clonable");
|
assert_unreached("Window must not be clonable");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
function() {
|
||||||
|
var t = async_test("QuotaExceededError objects can be cloned");
|
||||||
|
t.id = 41;
|
||||||
|
worker.onmessage = t.step_func_done(function(e) {
|
||||||
|
assert_equals(Object.getPrototypeOf(e.data), QuotaExceededError.prototype, "Checking prototype");
|
||||||
|
assert_equals(e.data.constructor, QuotaExceededError, "Checking constructor");
|
||||||
|
assert_equals(e.data.name, "QuotaExceededError", "Checking name");
|
||||||
|
assert_equals(e.data.message, "some message", "Checking message");
|
||||||
|
assert_equals(e.data.code, DOMException.QUOTA_EXCEEDED_ERR, "Checking code");
|
||||||
|
assert_equals(e.data.quota, 0.1, "Checking quota");
|
||||||
|
assert_equals(e.data.requested, 1.0, "Checking requested");
|
||||||
|
assert_equals(e.data.foo, undefined, "Checking custom property");
|
||||||
|
});
|
||||||
|
t.step(function() {
|
||||||
|
const error = new QuotaExceededError(message = "some message", options = {quota: 0.1, requested: 1.0});
|
||||||
|
worker.postMessage(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
var t = async_test("QuotaExceededError objects with empty quota/requested can be cloned");
|
||||||
|
t.id = 42;
|
||||||
|
worker.onmessage = t.step_func_done(function(e) {
|
||||||
|
assert_equals(Object.getPrototypeOf(e.data), QuotaExceededError.prototype, "Checking prototype");
|
||||||
|
assert_equals(e.data.constructor, QuotaExceededError, "Checking constructor");
|
||||||
|
assert_equals(e.data.name, "QuotaExceededError", "Checking name");
|
||||||
|
assert_equals(e.data.message, "some message", "Checking message");
|
||||||
|
assert_equals(e.data.code, DOMException.QUOTA_EXCEEDED_ERR, "Checking code");
|
||||||
|
assert_equals(e.data.quota, null, "Checking quota");
|
||||||
|
assert_equals(e.data.requested, null, "Checking requested");
|
||||||
|
assert_equals(e.data.foo, undefined, "Checking custom property");
|
||||||
|
});
|
||||||
|
t.step(function() {
|
||||||
|
const error = new QuotaExceededError(message = "some message");
|
||||||
|
worker.postMessage(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}, {explicit_done:true});
|
}, {explicit_done:true});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue