Bug 945568 - Properly handle OOM in ReadFile. r=terrence

--HG--
extra : rebase_source : 4734a64a1c89b43421f8dab0bda417cf7b8978c3
This commit is contained in:
Christian Holler 2013-12-03 03:33:55 +01:00
parent 3b387245d0
commit ae901ef97f

View File

@ -3390,6 +3390,9 @@ ReadFile(JSContext *cx, unsigned argc, jsval *vp, bool scriptRelative)
RootedString givenPath(cx, args[0].toString()); RootedString givenPath(cx, args[0].toString());
RootedString str(cx, ResolvePath(cx, givenPath, scriptRelative)); RootedString str(cx, ResolvePath(cx, givenPath, scriptRelative));
if (!str)
return false;
JSAutoByteString filename(cx, str); JSAutoByteString filename(cx, str);
if (!filename) if (!filename)
return false; return false;