mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1057137 - Broken menu: NS_ERROR_ILLEGAL_VALUE: id, attribute, or value too long. r=enn
This commit is contained in:
parent
a4067dc3d5
commit
eb28461a73
@ -201,8 +201,14 @@ XULStore.prototype = {
|
||||
}
|
||||
|
||||
// bug 319846 -- don't save really long attributes or values.
|
||||
if (id.length > 1024 || attr.length > 1024 || value.length > 1024)
|
||||
throw Components.Exception("id, attribute, or value too long", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
if (id.length > 512 || attr.length > 512) {
|
||||
throw Components.Exception("id or attribute name too long", Cr.NS_ERROR_ILLEGAL_VALUE);
|
||||
}
|
||||
|
||||
if (value.length > 4096) {
|
||||
Services.console.logStringMessage("XULStore: Warning, truncating long attribute value")
|
||||
value = value.substr(0, 4096);
|
||||
}
|
||||
|
||||
let obj = this._data;
|
||||
if (!(docURI in obj)) {
|
||||
|
@ -97,6 +97,21 @@ add_task(function* testImport(){
|
||||
checkOldStore();
|
||||
});
|
||||
|
||||
add_task(function* testTruncation() {
|
||||
let dos = Array(8192).join("~");
|
||||
// Long id names should trigger an exception
|
||||
Assert.throws(() => XULStore.setValue(browserURI, dos, "foo", "foo"), /NS_ERROR_ILLEGAL_VALUE/);
|
||||
|
||||
// Long attr names should trigger an exception
|
||||
Assert.throws(() => XULStore.setValue(browserURI, "foo", dos, "foo"), /NS_ERROR_ILLEGAL_VALUE/);
|
||||
|
||||
// Long values should be truncated
|
||||
XULStore.setValue(browserURI, "dos", "dos", dos);
|
||||
dos =XULStore.getValue(browserURI, "dos", "dos");
|
||||
do_check_true(dos.length == 4096)
|
||||
XULStore.removeValue(browserURI, "dos", "dos")
|
||||
});
|
||||
|
||||
add_task(function* testGetValue() {
|
||||
// Get non-existing property
|
||||
checkValue(browserURI, "side-window", "height", "");
|
||||
|
Loading…
Reference in New Issue
Block a user