зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322083 - Fix Reps with safeGetterValues; r=ntim
Sometimes (e.g. for window.applicationCache), Reps was shown with a negative number before the "more..." label. This was due to displaying the children of safeGeterValues property but not taking them into account for the total number of properties in the object when displaying the "more..." label. We fix this and add a test case to make sure we won't have this bug later MozReview-Commit-ID: 1qBCvehV0Jc --HG-- extra : rebase_source : 44461f378681407665c6426c0b30be87ae95488a
This commit is contained in:
Родитель
4e144a06a3
Коммит
beaeb0e42e
|
@ -104,7 +104,7 @@ define(function (require, exports, module) {
|
|||
props.push(Caption({
|
||||
object: objectLink({
|
||||
object: object
|
||||
}, `${object.ownPropertyLength - max} more…`)
|
||||
}, `${propertiesLength - max} more…`)
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ window.onload = Task.async(function* () {
|
|||
yield testProxy();
|
||||
yield testArrayBuffer();
|
||||
yield testSharedArrayBuffer();
|
||||
yield testApplicationCache();
|
||||
|
||||
// Test property iterator
|
||||
yield testMaxProps();
|
||||
|
@ -288,6 +289,43 @@ window.onload = Task.async(function* () {
|
|||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testApplicationCache() {
|
||||
// Test object: `window.applicationCache`
|
||||
const testName = "testApplicationCache";
|
||||
|
||||
// Test that correct rep is chosen
|
||||
const gripStub = getGripStub(testName);
|
||||
const renderedRep = shallowRenderComponent(Rep, { object: gripStub });
|
||||
is(renderedRep.type, Grip.rep, `Rep correctly selects ${Grip.rep.displayName}`);
|
||||
|
||||
// Test rendering
|
||||
const defaultOutput =
|
||||
"OfflineResourceList { status: 0, onchecking: null, onerror: null, 7 more… }";
|
||||
|
||||
const modeTests = [
|
||||
{
|
||||
mode: undefined,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.TINY,
|
||||
expectedOutput: "OfflineResourceList",
|
||||
},
|
||||
{
|
||||
mode: MODE.SHORT,
|
||||
expectedOutput: defaultOutput,
|
||||
},
|
||||
{
|
||||
mode: MODE.LONG,
|
||||
expectedOutput: "OfflineResourceList { status: 0, onchecking: null, " +
|
||||
"onerror: null, onnoupdate: null, ondownloading: null, onprogress: null, " +
|
||||
"onupdateready: null, oncached: null, onobsolete: null, mozItems: [] }",
|
||||
}
|
||||
];
|
||||
|
||||
testRepRenderModes(modeTests, testName, componentUnderTest, getGripStub(testName));
|
||||
}
|
||||
|
||||
function testMaxProps() {
|
||||
// Test object: `{a: "a", b: "b", c: "c"}`;
|
||||
const testName = "testMaxProps";
|
||||
|
@ -878,6 +916,108 @@ window.onload = Task.async(function* () {
|
|||
}
|
||||
}
|
||||
};
|
||||
case "testApplicationCache":
|
||||
return {
|
||||
"type": "object",
|
||||
"actor": "server2.conn1.child2/obj45",
|
||||
"class": "OfflineResourceList",
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "Object",
|
||||
"ownProperties": {},
|
||||
"ownPropertiesLength": 0,
|
||||
"safeGetterValues": {
|
||||
"status": {
|
||||
"getterValue": 0,
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"onchecking": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"onerror": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"onnoupdate": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"ondownloading": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"onprogress": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"onupdateready": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"oncached": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"onobsolete": {
|
||||
"getterValue": {
|
||||
"type": "null"
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
},
|
||||
"mozItems": {
|
||||
"getterValue": {
|
||||
"type": "object",
|
||||
"actor": "server2.conn1.child2/obj46",
|
||||
"class": "DOMStringList",
|
||||
"extensible": true,
|
||||
"frozen": false,
|
||||
"sealed": false,
|
||||
"ownPropertyLength": 0,
|
||||
"preview": {
|
||||
"kind": "ArrayLike",
|
||||
"length": 0
|
||||
}
|
||||
},
|
||||
"getterPrototypeLevel": 1,
|
||||
"enumerable": true,
|
||||
"writable": true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче