Bug 1232966 - Adapt Xrays tests for SharedArrayBuffer.prototype.slice. r=bz

--HG--
extra : rebase_source : 3274877fbffb56153ffaa7e08f27d79898cdbee1
This commit is contained in:
Lars T Hansen 2016-11-01 10:00:34 +01:00
Родитель b2476bcf51
Коммит 03a640d849
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -258,7 +258,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
constructorProps(["isView", "slice", Symbol.species]);
if (!isReleaseOrBeta) {
gPrototypeProperties['SharedArrayBuffer'] = ["constructor", "byteLength", Symbol.toStringTag];
gPrototypeProperties['SharedArrayBuffer'] = ["constructor", "slice", "byteLength", Symbol.toStringTag];
gConstructorProperties['SharedArrayBuffer'] = constructorProps([Symbol.species]);
} else {
is(typeof SharedArrayBuffer, "undefined", "Enable tests!");
@ -904,8 +904,6 @@ for (var prop of props) {
if (!isReleaseOrBeta) {
constructors.push('SharedArrayBuffer');
// If this fails enable the test a bit below.
is(typeof SharedArrayBuffer.prototype.slice, "undefined", "SharedArrayBuffer doesn't have slice");
}
for (const c of constructors) {
@ -914,10 +912,12 @@ for (var prop of props) {
var t = new iwin[c](12);
is(t.byteLength, 12, `${c} byteLength is correct`);
is(t.slice(4).byteLength, 8, `${c} byteLength is correct after slicing`);
is(Cu.getGlobalForObject(t.slice(4)), iwin, "Slice results lives in the target compartment");
is(Object.getPrototypeOf(t.slice(4)), iwin[c].prototype, "Slice results proto lives in target compartment")
// SharedArrayBuffer does not have static slice method
if (c === 'ArrayBuffer') {
is(t.slice(4).byteLength, 8, `${c} byteLength is correct after slicing`);
is(Cu.getGlobalForObject(t.slice(4)), iwin, "Slice results lives in the target compartment");
is(Object.getPrototypeOf(t.slice(4)), iwin[c].prototype, "Slice results proto lives in target compartment")
is(ArrayBuffer.slice(t, 4).byteLength, 8, `${c}.slice (deprecated) works`);
}