1818import org .htmlunit .corejs .javascript .Function ;
1919import org .htmlunit .corejs .javascript .Scriptable ;
2020import org .htmlunit .corejs .javascript .ScriptableObject ;
21+ import org .htmlunit .corejs .javascript .TopLevel ;
2122import org .htmlunit .corejs .javascript .typedarrays .NativeArrayBuffer ;
2223import org .htmlunit .corejs .javascript .typedarrays .NativeUint8ClampedArray ;
2324import org .htmlunit .javascript .HtmlUnitScriptable ;
@@ -72,7 +73,7 @@ public static ImageData jsConstructor(final Context cx, final Scriptable scope,
7273 data = array ;
7374 if (data .getArrayLength () % 4 != 0 ) {
7475 throw JavaScriptEngine .asJavaScriptException (
75- (HtmlUnitScriptable ) JavaScriptEngine .getTopCallScope (),
76+ (HtmlUnitScriptable ) (( TopLevel ) JavaScriptEngine .getTopCallScope ()). getGlobalThis (),
7677 "ImageData ctor - data length mod 4 not zero" ,
7778 DOMException .INVALID_STATE_ERR );
7879 }
@@ -83,7 +84,7 @@ public static ImageData jsConstructor(final Context cx, final Scriptable scope,
8384
8485 if (data .getArrayLength () != 4 * width * height ) {
8586 throw JavaScriptEngine .asJavaScriptException (
86- (HtmlUnitScriptable ) JavaScriptEngine .getTopCallScope (),
87+ (HtmlUnitScriptable ) (( TopLevel ) JavaScriptEngine .getTopCallScope ()). getGlobalThis (),
8788 "ImageData ctor - width not correct" ,
8889 DOMException .INDEX_SIZE_ERR );
8990 }
@@ -94,7 +95,7 @@ public static ImageData jsConstructor(final Context cx, final Scriptable scope,
9495
9596 if (data .getArrayLength () != 4 * width * height ) {
9697 throw JavaScriptEngine .asJavaScriptException (
97- (HtmlUnitScriptable ) JavaScriptEngine .getTopCallScope (),
98+ (HtmlUnitScriptable ) (( TopLevel ) JavaScriptEngine .getTopCallScope ()). getGlobalThis (),
9899 "ImageData ctor - width/height not correct" ,
99100 DOMException .INDEX_SIZE_ERR );
100101 }
@@ -106,13 +107,13 @@ public static ImageData jsConstructor(final Context cx, final Scriptable scope,
106107
107108 if (width < 0 ) {
108109 throw JavaScriptEngine .asJavaScriptException (
109- (HtmlUnitScriptable ) JavaScriptEngine .getTopCallScope (),
110+ (HtmlUnitScriptable ) (( TopLevel ) JavaScriptEngine .getTopCallScope ()). getGlobalThis (),
110111 "ImageData ctor - width negative" ,
111112 DOMException .INDEX_SIZE_ERR );
112113 }
113114 if (height < 0 ) {
114115 throw JavaScriptEngine .asJavaScriptException (
115- (HtmlUnitScriptable ) JavaScriptEngine .getTopCallScope (),
116+ (HtmlUnitScriptable ) (( TopLevel ) JavaScriptEngine .getTopCallScope ()). getGlobalThis (),
116117 "ImageData ctor - height negative" ,
117118 DOMException .INDEX_SIZE_ERR );
118119 }
0 commit comments