mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1079919 - Part 4: Add Xray test for RegExp.prototype.toString. r=bholley
This commit is contained in:
parent
62f1f819cc
commit
53b1dbe84d
@ -589,14 +589,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
|
||||
function testRegExp() {
|
||||
testXray('RegExp', new iwin.RegExp('foo'), new iwin.RegExp());
|
||||
|
||||
// Test the self-hosted |flags| property.
|
||||
// Test the self-hosted |flags| property, toString, and toSource.
|
||||
for (var flags of ["", "g", "i", "m", "y", "gimy"]) {
|
||||
var re = new iwin.RegExp("foo", flags);
|
||||
is(re.flags, re.wrappedJSObject.flags, "Results match");
|
||||
|
||||
isnot(re.toString, Cu.unwaiveXrays(re.wrappedJSObject.toString), "Different function identities");
|
||||
is(Cu.getGlobalForObject(re.toString), window, "Xray global is correct");
|
||||
is(Cu.getGlobalForObject(re.wrappedJSObject.toString), iwin, "Underlying global is correct");
|
||||
is(re.toString(), re.wrappedJSObject.toString(), "Results match");
|
||||
|
||||
isnot(re.toSource, Cu.unwaiveXrays(re.wrappedJSObject.toSource), "Different function identities");
|
||||
is(Cu.getGlobalForObject(re.toSource), window, "Xray global is correct");
|
||||
is(Cu.getGlobalForObject(re.wrappedJSObject.toSource), iwin, "Underlying global is correct");
|
||||
is(re.toSource(), re.wrappedJSObject.toSource(), "Results match");
|
||||
|
||||
// Test with modified flags accessors
|
||||
iwin.eval(`
|
||||
var props = ["global", "ignoreCase", "multiline", "sticky"];
|
||||
var props = ["global", "ignoreCase", "multiline", "sticky", "source"];
|
||||
var origDescs = {};
|
||||
for (var prop of props) {
|
||||
origDescs[prop] = Object.getOwnPropertyDescriptor(RegExp.prototype, prop);
|
||||
@ -609,6 +619,8 @@ for (var prop of props) {
|
||||
`);
|
||||
try {
|
||||
is(re.flags, flags, "Unmodified flags accessors are called");
|
||||
is(re.toString(), "/foo/" + flags, "Unmodified flags and source accessors are called");
|
||||
is(re.toSource(), "/foo/" + flags, "Unmodified flags and source accessors are called");
|
||||
} finally {
|
||||
iwin.eval(`
|
||||
for (var prop of props) {
|
||||
|
Loading…
Reference in New Issue
Block a user