Files
tubestation/js/xpconnect/loader/mozJSSubScriptLoader.h
Andrew McCreight 3e76dfaaf2 Bug 1186409 - Use a single global for all JSMs. r=kmag
This patch adds a preference jsloader.shareGlobal that makes it so
that JSMs share a single global, in order to reduce memory usage. The
pref is disabled by default, and will be enabled in a later bug. Each
JSM gets its own NonSyntacticVariablesObject (NSVO), which is used for
top level variable bindings and as the value of |this| within the JSM.

For the module loader, the main change is setting up the shared
global, and the NSVO for each JSM. A number of files are blacklisted
from the shared global, because they do things to the global that
would interfer with other JSMs. This is detailed in
mozJSComponentLoader::ReuseGlobal().

MozReview-Commit-ID: 3qVAc1c5aMI
2017-07-18 14:47:27 -07:00

56 lines
2.1 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=99: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h"
#include "mozIJSSubScriptLoader.h"
class nsIPrincipal;
class nsIURI;
class LoadSubScriptOptions;
#define MOZ_JSSUBSCRIPTLOADER_CID \
{ /* 829814d6-1dd2-11b2-8e08-82fa0a339b00 */ \
0x929814d6, \
0x1dd2, \
0x11b2, \
{0x8e, 0x08, 0x82, 0xfa, 0x0a, 0x33, 0x9b, 0x00} \
}
class nsIIOService;
class mozJSSubScriptLoader : public mozIJSSubScriptLoader
{
public:
mozJSSubScriptLoader();
// all the interface method declarations...
NS_DECL_ISUPPORTS
NS_DECL_MOZIJSSUBSCRIPTLOADER
private:
virtual ~mozJSSubScriptLoader();
bool ReadScript(nsIURI* uri, JSContext* cx, JS::HandleObject targetObj,
const nsAString& charset, const char* uriStr,
nsIIOService* serv,
bool wantReturnValue,
JS::MutableHandleScript script);
nsresult ReadScriptAsync(nsIURI* uri,
JS::HandleObject targetObj,
JS::HandleObject loadScope,
const nsAString& charset,
nsIIOService* serv,
bool wantReturnValue,
bool cache,
JS::MutableHandleValue retval);
nsresult DoLoadSubScriptWithOptions(const nsAString& url,
LoadSubScriptOptions& options,
JSContext* cx,
JS::MutableHandleValue retval);
};