Current code handles omitted deleteCount but assumes it to be zero in that case. Instead an omitted deleteCount means delete everything from `start`.
This prevents Adobe sign-in page from loading.
-- v6: jscript: fix Array.prototype.splice with omitted deleteCount in ES5+ mode
From: Yuxuan Shui yshui@codeweavers.com
--- dlls/jscript/array.c | 2 ++ dlls/jscript/tests/api.js | 4 ++-- dlls/mshtml/tests/es5.js | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index 4e1af864a8e..48f665da576 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -870,6 +870,8 @@ static HRESULT Array_splice(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign }
add_args = argc-2; + } else if (argc && ctx->version >= SCRIPTLANGUAGEVERSION_ES5) { + delete_cnt = length-start; }
if(r) { diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 0fc683c20cb..aea412347b9 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1310,8 +1310,8 @@ ok(arr.toString() == "1,2,3,4,5", "arr.splice(2,-1) is " + arr.toString());
arr = [1,2,3,4,5]; tmp = arr.splice(2); -ok(tmp.toString() == "", "arr.splice(2,-1) returned " + tmp.toString()); -ok(arr.toString() == "1,2,3,4,5", "arr.splice(2,-1) is " + arr.toString()); +ok(tmp.toString() == "", "arr.splice(2) returned " + tmp.toString()); +ok(arr.toString() == "1,2,3,4,5", "arr.splice(2) is " + arr.toString());
arr = [1,2,3,4,5]; tmp = arr.splice(); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 38a70740698..65cf85965a0 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -374,6 +374,13 @@ sync_test("isArray", function() { expect_array(new C(), false); });
+sync_test("array_splice", function() { + var arr = [1,2,3,4,5] + tmp = arr.splice(2); + ok(arr.toString() === "1,2", "arr = " + arr); + ok(tmp.toString() === "3,4,5", "tmp = " + tmp); +}); + sync_test("array_map", function() { var calls, m, arr, ctx;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=136213
Your paranoid android.
=== debian11b (64 bit WoW report) ===
reg.exe: import.c:3555: Test failed: got data size 8, expected 7 import.c:3555: Test failed: registry data does not match
Gabriel Ivăncescu (@insn) commented about dlls/mshtml/tests/es5.js:
expect_array(new C(), false);
});
+sync_test("array_splice", function() {
- var arr = [1,2,3,4,5]
- tmp = arr.splice(2);
Sorry, missed this, please add `var` before tmp, so you don't end up creating a global variable (and put semi-colon after arr decl).