Cover cfxjs_engine.cpp's CallHandler() success case. Change-Id: I62df922ed62e00cc30d4179945e5eb4b6d2cc0d6 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63510 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/resources/javascript/icons.in b/testing/resources/javascript/icons.in index 8f6ef4c..1b035db 100644 --- a/testing/resources/javascript/icons.in +++ b/testing/resources/javascript/icons.in
@@ -26,6 +26,23 @@ " and " + icon2_again.name); app.alert("but they are made anew each time since " + (icon1 == icon1_again) + " is returned from comparison"); + app.alert("Prototype comparison is " + (icon1.__proto__ == icon1_again.__proto__)); + + // Icons are "dynamic" objects, so theoretically we can make them from + // the JS side as well, although they will not be bound on the fxjs side. + var dubious = new icon1.constructor(); + app.alert("Made anew from JS side since comparison is " + (dubious == icon1)); + app.alert("Prototype comparison is " + (dubious.__proto__ == icon1.__proto__)); + + // Can't retrieve the name because no fxjs binding present. + app.alert("Dubious name is " + dubious.name); + + // No error setting the name because for an unbound object, control doesn't + // get far enough to reach the readonly check in the property handler. + dubious.name = "pebble"; + + // The previous was a silent no-op under the covers. + app.alert("name is unchanged from " + dubious.name); } catch (e) { app.alert("error: " + e); }
diff --git a/testing/resources/javascript/icons_expected.txt b/testing/resources/javascript/icons_expected.txt index bace26d..833c28b 100644 --- a/testing/resources/javascript/icons_expected.txt +++ b/testing/resources/javascript/icons_expected.txt
@@ -4,4 +4,9 @@ Alert: they are named icon1 and icon2 Alert: they are also named icon1 and icon2 Alert: but they are made anew each time since false is returned from comparison +Alert: Prototype comparison is true +Alert: Made anew from JS side since comparison is false +Alert: Prototype comparison is true +Alert: Dubious name is undefined +Alert: name is unchanged from undefined Alert: As expected, trying to change the name gave: Icon.name: Cannot assign to readonly property.