mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1087925 - calling some NFCTag API should throw if the condition is not met. r=smaug, dimi
This commit is contained in:
parent
a76656b90f
commit
e515bfb51f
@ -72,6 +72,19 @@ MozNFCTagImpl.prototype = {
|
||||
throw new this._window.DOMError("InvalidStateError", "NFCTag object is invalid");
|
||||
}
|
||||
|
||||
if (this.isReadOnly) {
|
||||
throw new this._window.DOMError("InvalidAccessError", "NFCTag object is read-only");
|
||||
}
|
||||
|
||||
let ndefLen = 0;
|
||||
for (let record of records) {
|
||||
ndefLen += record.size;
|
||||
}
|
||||
|
||||
if (ndefLen > this.maxNDEFSize) {
|
||||
throw new this._window.DOMError("NotSupportedError", "Exceed max NDEF size");
|
||||
}
|
||||
|
||||
return this._nfcContentHelper.writeNDEF(records, this.session);
|
||||
},
|
||||
|
||||
@ -79,6 +92,12 @@ MozNFCTagImpl.prototype = {
|
||||
if (this.isLost) {
|
||||
throw new this._window.DOMError("InvalidStateError", "NFCTag object is invalid");
|
||||
}
|
||||
|
||||
if (!this.canBeMadeReadOnly) {
|
||||
throw new this._window.DOMError("InvalidAccessError",
|
||||
"NFCTag object cannot be made read-only");
|
||||
}
|
||||
|
||||
return this._nfcContentHelper.makeReadOnly(this.session);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user