mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 15:15:23 +00:00
Merge backout
This commit is contained in:
commit
7ccafb949b
@ -637,8 +637,7 @@ mozJSComponentLoader::LoadModule(nsILocalFile* aComponentFile,
|
||||
if (!entry)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = GlobalForLocation(aComponentFile, &entry->global, &entry->location,
|
||||
nsnull);
|
||||
rv = GlobalForLocation(aComponentFile, &entry->global, &entry->location);
|
||||
if (NS_FAILED(rv)) {
|
||||
#ifdef DEBUG_shaver
|
||||
fprintf(stderr, "GlobalForLocation failed!\n");
|
||||
@ -1061,8 +1060,7 @@ mozJSComponentLoader::WriteScript(nsIFastLoadService *flSvc, JSScript *script,
|
||||
nsresult
|
||||
mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponent,
|
||||
JSObject **aGlobal,
|
||||
char **aLocation,
|
||||
jsval *exception)
|
||||
char **aLocation)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -1192,15 +1190,6 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponent,
|
||||
// The script wasn't in the fastload cache, so compile it now.
|
||||
LOG(("Slow loading %s\n", nativePath.get()));
|
||||
|
||||
// If |exception| is non-null, then our caller wants to propagate any
|
||||
// exceptions out to our caller. Ensure that the engine doesn't
|
||||
// eagerly report the exception.
|
||||
uint32 oldopts = 0;
|
||||
if (exception) {
|
||||
oldopts = JS_GetOptions(cx);
|
||||
JS_SetOptions(cx, oldopts | JSOPTION_DONT_REPORT_UNCAUGHT);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PR_MEMMAP
|
||||
PRInt64 fileSize;
|
||||
rv = aComponent->GetFileSize(&fileSize);
|
||||
@ -1262,19 +1251,8 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponent,
|
||||
fileHandle, jsPrincipals);
|
||||
|
||||
/* JS will close the filehandle after compilation is complete. */
|
||||
#endif /* HAVE_PR_MEMMAP */
|
||||
|
||||
// Propagate the exception, if one exists. Also, don't leave the stale
|
||||
// exception on this context.
|
||||
// NB: The caller must stick exception into a rooted slot (probably on
|
||||
// its context) as soon as possible to avoid GC hazards.
|
||||
if (exception) {
|
||||
JS_SetOptions(cx, oldopts);
|
||||
if (!script) {
|
||||
JS_GetPendingException(cx, exception);
|
||||
JS_ClearPendingException(cx);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_PR_MEMMAP */
|
||||
}
|
||||
|
||||
if (!script) {
|
||||
@ -1496,27 +1474,14 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
|
||||
if (!newEntry || !mInProgressImports.Put(lfhash, newEntry))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
jsval exception = JSVAL_VOID;
|
||||
rv = GlobalForLocation(componentFile, &newEntry->global,
|
||||
&newEntry->location, &exception);
|
||||
&newEntry->location);
|
||||
|
||||
mInProgressImports.Remove(lfhash);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*_retval = nsnull;
|
||||
|
||||
if (!JSVAL_IS_VOID(exception)) {
|
||||
// An exception was thrown during compilation. Propagate it
|
||||
// out to our caller so they can report it.
|
||||
JSContext *callercx;
|
||||
cc->GetJSContext(&callercx);
|
||||
JS_SetPendingException(callercx, exception);
|
||||
cc->SetExceptionWasThrown(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Something failed, but we don't know what it is, guess.
|
||||
return rv;
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
mod = newEntry;
|
||||
|
@ -110,8 +110,7 @@ class mozJSComponentLoader : public nsIModuleLoader,
|
||||
|
||||
nsresult GlobalForLocation(nsILocalFile *aComponent,
|
||||
JSObject **aGlobal,
|
||||
char **location,
|
||||
jsval *exception);
|
||||
char **location);
|
||||
|
||||
nsresult StartFastLoad(nsIFastLoadService *flSvc);
|
||||
nsresult ReadScript(nsIFastLoadService *flSvc, const char *nativePath,
|
||||
|
@ -1 +0,0 @@
|
||||
bogusjs)(
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2007
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dave Townsend <dtownsend@oxymoronical.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function run_test() {
|
||||
var file = do_get_file("js/src/xpconnect/tests/unit/syntax_error.jsm");
|
||||
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri = ios.newFileURI(file);
|
||||
|
||||
try {
|
||||
Components.utils.import(uri.spec);
|
||||
do_throw("Failed to report any error at all");
|
||||
} catch (e) {
|
||||
do_check_neq(/^SyntaxError:/(e + ''), null);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user