Bug 1507229 - Argument sanity check at CreateMutableFile() to avoid assertion failure r=janv

CreateMutableFile() doesn't allow empty name, we should check it before
further processing to avoid assertion failure.

Differential Revision: https://phabricator.services.mozilla.com/D23999

--HG--
extra : moz-landing-system : lando
This commit is contained in:
violet 2019-03-22 14:01:31 +00:00
parent 0e0ec3037e
commit 44ea792130
3 changed files with 11 additions and 0 deletions

View File

@ -667,6 +667,11 @@ already_AddRefed<IDBRequest> IDBDatabase::CreateMutableFile(
ErrorResult& aRv) {
AssertIsOnOwningThread();
if (aName.IsEmpty()) {
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return nullptr;
}
if (QuotaManager::IsShuttingDown()) {
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);

View File

@ -0,0 +1,5 @@
<script>
window.indexedDB.open("hello").onsuccess = function(event) {
event.target.result.createMutableFile("");
}
</script>

View File

@ -1 +1,2 @@
load 726376-1.html
load 1507229-1.html