diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html index 13078ffc2eeb..34d07df85a86 100644 --- a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html +++ b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html @@ -150,6 +150,28 @@ div > < +iframe +> +< +/ +iframe +> +< +! +- +- +used +for +grabbing +an +URIError +from +another +realm +- +- +> +< script type = @@ -4340,6 +4362,2401 @@ ) ; } +function +( +) +{ +var +t += +async_test +( +" +Empty +Error +objects +can +be +cloned +" +) +; +t +. +id += +27 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +Error +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +Error +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +Error +" +" +Checking +name +" +) +; +assert_false +( +e +. +data +. +hasOwnProperty +( +" +message +" +) +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +Error +( +) +; +assert_false +( +error +. +hasOwnProperty +( +" +message +" +) +" +Checking +message +on +the +source +realm +" +) +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +Error +objects +can +be +cloned +" +) +; +t +. +id += +28 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +Error +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +Error +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +Error +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +Error +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +EvalError +objects +can +be +cloned +" +) +; +t +. +id += +29 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +EvalError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +EvalError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +EvalError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +EvalError +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +RangeError +objects +can +be +cloned +" +) +; +t +. +id += +30 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +RangeError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +RangeError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +RangeError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +RangeError +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +ReferenceError +objects +can +be +cloned +" +) +; +t +. +id += +31 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +ReferenceError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +ReferenceError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +ReferenceError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +ReferenceError +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +SyntaxError +objects +can +be +cloned +" +) +; +t +. +id += +32 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +SyntaxError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +SyntaxError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +SyntaxError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +SyntaxError +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +TypeError +objects +can +be +cloned +" +) +; +t +. +id += +33 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +TypeError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +TypeError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +TypeError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +TypeError +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +URIError +objects +can +be +cloned +" +) +; +t +. +id += +34 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +URIError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +URIError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +URIError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +URIError +( +" +some +message +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +URIError +objects +from +other +realms +are +treated +as +Error +" +) +; +t +. +id += +35 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +Error +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +Error +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +Error +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +frames +[ +0 +] +. +URIError +( +" +some +message +" +) +; +assert_equals +( +Object +. +getPrototypeOf +( +error +) +frames +[ +0 +] +. +prototype +" +Checking +prototype +before +cloning +" +) +; +assert_equals +( +error +. +constructor +frames +[ +0 +] +. +URIError +" +Checking +constructor +before +cloning +" +) +; +assert_equals +( +error +. +name +" +URIError +" +" +Checking +name +before +cloning +" +) +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +Cloning +a +modified +Error +" +) +; +t +. +id += +36 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +SyntaxError +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +SyntaxError +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +SyntaxError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +another +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +URIError +( +" +some +message +" +) +; +Object +. +setPrototypeOf +( +error +SyntaxError +. +prototype +) +; +error +. +message += +{ +toString +: +( +) += +> +" +another +message +" +} +error +. +constructor += +RangeError +; +error +. +name += +" +TypeError +" +; +error +. +foo += +" +bar +" +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +Error +. +message +: +getter +is +ignored +when +cloning +" +) +; +t +. +id += +37 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +Error +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +Error +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +Error +" +" +Checking +name +" +) +; +assert_false +( +e +. +data +. +hasOwnProperty +( +" +message +" +) +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +Error +( +) +; +Object +. +defineProperty +( +error +" +message +" +{ +get +: +( +) += +> +" +hello +" +} +) +; +assert_equals +( +error +. +message +" +hello +" +" +Checking +message +on +the +source +realm +" +) +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +Error +. +message +: +undefined +property +is +stringified +" +) +; +t +. +id += +38 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +Error +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +Error +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +Error +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +undefined +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +Error +( +) +; +error +. +message += +undefined +; +assert_equals +( +error +. +message +undefined +" +Checking +message +on +the +source +realm +" +) +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +DOMException +objects +can +be +cloned +" +) +; +t +. +id += +39 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +DOMException +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +DOMException +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +name +" +IndexSizeError +" +" +Checking +name +" +) +; +assert_equals +( +e +. +data +. +message +" +some +message +" +" +Checking +message +" +) +; +assert_equals +( +e +. +data +. +code +DOMException +. +INDEX_SIZE_ERR +" +Checking +code +" +) +; +assert_equals +( +e +. +data +. +foo +undefined +" +Checking +custom +property +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +const +error += +new +DOMException +( +" +some +message +" +" +IndexSizeError +" +) +; +worker +. +postMessage +( +error +) +; +} +) +; +} +function +( +) +{ +var +t += +async_test +( +" +DOMException +objects +created +by +the +UA +can +be +cloned +" +) +; +t +. +id += +40 +; +worker +. +onmessage += +t +. +step_func_done +( +function +( +e +) +{ +assert_equals +( +Object +. +getPrototypeOf +( +e +. +data +) +DOMException +. +prototype +" +Checking +prototype +" +) +; +assert_equals +( +e +. +data +. +constructor +DOMException +" +Checking +constructor +" +) +; +assert_equals +( +e +. +data +. +code +DOMException +. +DATA_CLONE_ERR +" +Checking +code +" +) +; +assert_equals +( +e +. +data +. +name +" +DataCloneError +" +" +Checking +name +" +) +; +} +) +; +t +. +step +( +function +( +) +{ +try +{ +worker +. +postMessage +( +window +) +; +} +catch +( +error +) +{ +worker +. +postMessage +( +error +) +; +return +; +} +assert_unreached +( +" +Window +must +not +be +clonable +" +) +; +} +) +; +} ] ; }