mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Merge inbound to mozilla-central r=merge a=merge
This commit is contained in:
commit
5a2831f643
@ -459,7 +459,9 @@ public:
|
|||||||
size_t Length = 0;
|
size_t Length = 0;
|
||||||
for (std::string &Line : Nodupes) {
|
for (std::string &Line : Nodupes) {
|
||||||
Length += Line.length();
|
Length += Line.length();
|
||||||
fwrite(Line.c_str(), Line.length(), 1, Fp);
|
if (fwrite(Line.c_str(), Line.length(), 1, Fp) != 1) {
|
||||||
|
fprintf(stderr, "Unable to write to output file %s\n", Filename.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose(Fp);
|
fclose(Fp);
|
||||||
|
|
||||||
|
@ -1542,28 +1542,6 @@ nsContentUtils::IsJavaScriptLanguage(const nsString& aName)
|
|||||||
aName.LowerCaseEqualsLiteral("javascript1.5");
|
aName.LowerCaseEqualsLiteral("javascript1.5");
|
||||||
}
|
}
|
||||||
|
|
||||||
JSVersion
|
|
||||||
nsContentUtils::ParseJavascriptVersion(const nsAString& aVersionStr)
|
|
||||||
{
|
|
||||||
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' ||
|
|
||||||
aVersionStr[1] != '.') {
|
|
||||||
return JSVERSION_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (aVersionStr[2]) {
|
|
||||||
case '0': /* fall through */
|
|
||||||
case '1': /* fall through */
|
|
||||||
case '2': /* fall through */
|
|
||||||
case '3': /* fall through */
|
|
||||||
case '4': /* fall through */
|
|
||||||
case '5': return JSVERSION_DEFAULT;
|
|
||||||
case '6': return JSVERSION_1_6;
|
|
||||||
case '7': return JSVERSION_1_7;
|
|
||||||
case '8': return JSVERSION_1_8;
|
|
||||||
default: return JSVERSION_UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsContentUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
|
nsContentUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||||
nsString& aParams)
|
nsString& aParams)
|
||||||
|
@ -2633,12 +2633,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
static bool IsJavaScriptLanguage(const nsString& aName);
|
static bool IsJavaScriptLanguage(const nsString& aName);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the JSVersion for a string of the form '1.n', n = 0, ..., 8, and
|
|
||||||
* JSVERSION_UNKNOWN for other strings.
|
|
||||||
*/
|
|
||||||
static JSVersion ParseJavascriptVersion(const nsAString& aVersionStr);
|
|
||||||
|
|
||||||
static bool IsJavascriptMIMEType(const nsAString& aMIMEType);
|
static bool IsJavascriptMIMEType(const nsAString& aMIMEType);
|
||||||
|
|
||||||
static void SplitMimeType(const nsAString& aValue, nsString& aType,
|
static void SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||||
|
@ -29,13 +29,13 @@ NS_IMPL_ADDREF_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
|||||||
NS_IMPL_RELEASE_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
NS_IMPL_RELEASE_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
||||||
|
|
||||||
ModuleLoadRequest::ModuleLoadRequest(nsIScriptElement* aElement,
|
ModuleLoadRequest::ModuleLoadRequest(nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
ValidJSVersion aValidJSVersion,
|
||||||
CORSMode aCORSMode,
|
CORSMode aCORSMode,
|
||||||
const SRIMetadata& aIntegrity,
|
const SRIMetadata& aIntegrity,
|
||||||
ScriptLoader* aLoader)
|
ScriptLoader* aLoader)
|
||||||
: ScriptLoadRequest(ScriptKind::Module,
|
: ScriptLoadRequest(ScriptKind::Module,
|
||||||
aElement,
|
aElement,
|
||||||
aVersion,
|
aValidJSVersion,
|
||||||
aCORSMode,
|
aCORSMode,
|
||||||
aIntegrity),
|
aIntegrity),
|
||||||
mIsTopLevel(true),
|
mIsTopLevel(true),
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
||||||
|
|
||||||
ModuleLoadRequest(nsIScriptElement* aElement,
|
ModuleLoadRequest(nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
ValidJSVersion aValidJSVersion,
|
||||||
CORSMode aCORSMode,
|
CORSMode aCORSMode,
|
||||||
const SRIMetadata& aIntegrity,
|
const SRIMetadata& aIntegrity,
|
||||||
ScriptLoader* aLoader);
|
ScriptLoader* aLoader);
|
||||||
|
@ -40,7 +40,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|||||||
|
|
||||||
ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
|
ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
|
||||||
nsIScriptElement* aElement,
|
nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
ValidJSVersion aValidJSVersion,
|
||||||
mozilla::CORSMode aCORSMode,
|
mozilla::CORSMode aCORSMode,
|
||||||
const mozilla::dom::SRIMetadata& aIntegrity)
|
const mozilla::dom::SRIMetadata& aIntegrity)
|
||||||
: mKind(aKind)
|
: mKind(aKind)
|
||||||
@ -63,7 +63,7 @@ ScriptLoadRequest::ScriptLoadRequest(ScriptKind aKind,
|
|||||||
, mScriptText()
|
, mScriptText()
|
||||||
, mScriptBytecode()
|
, mScriptBytecode()
|
||||||
, mBytecodeOffset(0)
|
, mBytecodeOffset(0)
|
||||||
, mJSVersion(aVersion)
|
, mValidJSVersion(aValidJSVersion)
|
||||||
, mLineNo(1)
|
, mLineNo(1)
|
||||||
, mCORSMode(aCORSMode)
|
, mCORSMode(aCORSMode)
|
||||||
, mIntegrity(aIntegrity)
|
, mIntegrity(aIntegrity)
|
||||||
|
@ -29,6 +29,11 @@ enum class ScriptKind {
|
|||||||
Module
|
Module
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class ValidJSVersion : bool {
|
||||||
|
Invalid,
|
||||||
|
Valid
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A class that handles loading and evaluation of <script> elements.
|
* A class that handles loading and evaluation of <script> elements.
|
||||||
*/
|
*/
|
||||||
@ -48,7 +53,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
ScriptLoadRequest(ScriptKind aKind,
|
ScriptLoadRequest(ScriptKind aKind,
|
||||||
nsIScriptElement* aElement,
|
nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
ValidJSVersion aValidJSVersion,
|
||||||
mozilla::CORSMode aCORSMode,
|
mozilla::CORSMode aCORSMode,
|
||||||
const mozilla::dom::SRIMetadata &aIntegrity);
|
const mozilla::dom::SRIMetadata &aIntegrity);
|
||||||
|
|
||||||
@ -178,7 +183,7 @@ public:
|
|||||||
mozilla::Vector<uint8_t> mScriptBytecode;
|
mozilla::Vector<uint8_t> mScriptBytecode;
|
||||||
uint32_t mBytecodeOffset; // Offset of the bytecode in mScriptBytecode
|
uint32_t mBytecodeOffset; // Offset of the bytecode in mScriptBytecode
|
||||||
|
|
||||||
uint32_t mJSVersion;
|
ValidJSVersion mValidJSVersion;
|
||||||
nsCOMPtr<nsIURI> mURI;
|
nsCOMPtr<nsIURI> mURI;
|
||||||
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
||||||
nsCOMPtr<nsIPrincipal> mOriginPrincipal;
|
nsCOMPtr<nsIPrincipal> mOriginPrincipal;
|
||||||
|
@ -746,7 +746,7 @@ ScriptLoader::StartFetchingModuleAndDependencies(ModuleLoadRequest* aRequest,
|
|||||||
MOZ_ASSERT(aURI);
|
MOZ_ASSERT(aURI);
|
||||||
|
|
||||||
RefPtr<ModuleLoadRequest> childRequest =
|
RefPtr<ModuleLoadRequest> childRequest =
|
||||||
new ModuleLoadRequest(aRequest->mElement, aRequest->mJSVersion,
|
new ModuleLoadRequest(aRequest->mElement, aRequest->mValidJSVersion,
|
||||||
aRequest->mCORSMode, aRequest->mIntegrity, this);
|
aRequest->mCORSMode, aRequest->mIntegrity, this);
|
||||||
|
|
||||||
childRequest->mIsTopLevel = false;
|
childRequest->mIsTopLevel = false;
|
||||||
@ -1039,7 +1039,7 @@ ScriptLoader::StartLoad(ScriptLoadRequest* aRequest)
|
|||||||
aRequest->mCacheInfo = nullptr;
|
aRequest->mCacheInfo = nullptr;
|
||||||
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
|
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
|
||||||
if (cic && nsContentUtils::IsBytecodeCacheEnabled() &&
|
if (cic && nsContentUtils::IsBytecodeCacheEnabled() &&
|
||||||
aRequest->mJSVersion == JSVERSION_DEFAULT) {
|
aRequest->mValidJSVersion == ValidJSVersion::Valid) {
|
||||||
if (!aRequest->IsLoadingSource()) {
|
if (!aRequest->IsLoadingSource()) {
|
||||||
// Inform the HTTP cache that we prefer to have information coming from the
|
// Inform the HTTP cache that we prefer to have information coming from the
|
||||||
// bytecode cache instead of the sources, if such entry is already registered.
|
// bytecode cache instead of the sources, if such entry is already registered.
|
||||||
@ -1169,12 +1169,29 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns ValidJSVersion::Valid if aVersionStr is a string of the form
|
||||||
|
* '1.n', n = 0, ..., 8, and ValidJSVersion::Invalid for other strings.
|
||||||
|
*/
|
||||||
|
static ValidJSVersion
|
||||||
|
ParseJavascriptVersion(const nsAString& aVersionStr)
|
||||||
|
{
|
||||||
|
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' ||
|
||||||
|
aVersionStr[1] != '.') {
|
||||||
|
return ValidJSVersion::Invalid;
|
||||||
|
}
|
||||||
|
if ('0' <= aVersionStr[2] && aVersionStr[2] <= '8') {
|
||||||
|
return ValidJSVersion::Valid;
|
||||||
|
}
|
||||||
|
return ValidJSVersion::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
|
ParseTypeAttribute(const nsAString& aType, ValidJSVersion* aVersion)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!aType.IsEmpty());
|
MOZ_ASSERT(!aType.IsEmpty());
|
||||||
MOZ_ASSERT(aVersion);
|
MOZ_ASSERT(aVersion);
|
||||||
MOZ_ASSERT(*aVersion == JSVERSION_DEFAULT);
|
MOZ_ASSERT(*aVersion == ValidJSVersion::Valid);
|
||||||
|
|
||||||
nsContentTypeParser parser(aType);
|
nsContentTypeParser parser(aType);
|
||||||
|
|
||||||
@ -1191,7 +1208,7 @@ ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
|
|||||||
rv = parser.GetParameter("version", versionName);
|
rv = parser.GetParameter("version", versionName);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
*aVersion = nsContentUtils::ParseJavascriptVersion(versionName);
|
*aVersion = ParseJavascriptVersion(versionName);
|
||||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1230,11 +1247,13 @@ CSPAllowsInlineScript(nsIScriptElement* aElement, nsIDocument* aDocument)
|
|||||||
ScriptLoadRequest*
|
ScriptLoadRequest*
|
||||||
ScriptLoader::CreateLoadRequest(ScriptKind aKind,
|
ScriptLoader::CreateLoadRequest(ScriptKind aKind,
|
||||||
nsIScriptElement* aElement,
|
nsIScriptElement* aElement,
|
||||||
uint32_t aVersion, CORSMode aCORSMode,
|
ValidJSVersion aValidJSVersion,
|
||||||
|
CORSMode aCORSMode,
|
||||||
const SRIMetadata& aIntegrity)
|
const SRIMetadata& aIntegrity)
|
||||||
{
|
{
|
||||||
if (aKind == ScriptKind::Classic) {
|
if (aKind == ScriptKind::Classic) {
|
||||||
ScriptLoadRequest* slr = new ScriptLoadRequest(aKind, aElement, aVersion, aCORSMode,
|
ScriptLoadRequest* slr = new ScriptLoadRequest(aKind, aElement,
|
||||||
|
aValidJSVersion, aCORSMode,
|
||||||
aIntegrity);
|
aIntegrity);
|
||||||
|
|
||||||
LOG(("ScriptLoader %p creates ScriptLoadRequest %p", this, slr));
|
LOG(("ScriptLoader %p creates ScriptLoadRequest %p", this, slr));
|
||||||
@ -1242,7 +1261,8 @@ ScriptLoader::CreateLoadRequest(ScriptKind aKind,
|
|||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(aKind == ScriptKind::Module);
|
MOZ_ASSERT(aKind == ScriptKind::Module);
|
||||||
return new ModuleLoadRequest(aElement, aVersion, aCORSMode, aIntegrity, this);
|
return new ModuleLoadRequest(aElement, aValidJSVersion, aCORSMode,
|
||||||
|
aIntegrity, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -1265,7 +1285,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSVersion version = JSVERSION_DEFAULT;
|
ValidJSVersion validJSVersion = ValidJSVersion::Valid;
|
||||||
|
|
||||||
// Check the type attribute to determine language and version.
|
// Check the type attribute to determine language and version.
|
||||||
// If type exists, it trumps the deprecated 'language='
|
// If type exists, it trumps the deprecated 'language='
|
||||||
@ -1277,7 +1297,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||||||
if (ModuleScriptsEnabled() && type.LowerCaseEqualsASCII("module")) {
|
if (ModuleScriptsEnabled() && type.LowerCaseEqualsASCII("module")) {
|
||||||
scriptKind = ScriptKind::Module;
|
scriptKind = ScriptKind::Module;
|
||||||
} else {
|
} else {
|
||||||
NS_ENSURE_TRUE(ParseTypeAttribute(type, &version), false);
|
NS_ENSURE_TRUE(ParseTypeAttribute(type, &validJSVersion), false);
|
||||||
}
|
}
|
||||||
} else if (!hasType) {
|
} else if (!hasType) {
|
||||||
// no 'type=' element
|
// no 'type=' element
|
||||||
@ -1380,7 +1400,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||||||
principal = scriptContent->NodePrincipal();
|
principal = scriptContent->NodePrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
request = CreateLoadRequest(scriptKind, aElement, version, ourCORSMode,
|
request = CreateLoadRequest(scriptKind, aElement, validJSVersion, ourCORSMode,
|
||||||
sriMetadata);
|
sriMetadata);
|
||||||
request->mURI = scriptURI;
|
request->mURI = scriptURI;
|
||||||
request->mTriggeringPrincipal = Move(principal);
|
request->mTriggeringPrincipal = Move(principal);
|
||||||
@ -1422,7 +1442,7 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||||||
NS_ASSERTION(!request->InCompilingStage(),
|
NS_ASSERTION(!request->InCompilingStage(),
|
||||||
"Request should not yet be in compiling stage.");
|
"Request should not yet be in compiling stage.");
|
||||||
|
|
||||||
request->mJSVersion = version;
|
request->mValidJSVersion = validJSVersion;
|
||||||
|
|
||||||
if (aElement->GetScriptAsync()) {
|
if (aElement->GetScriptAsync()) {
|
||||||
request->mIsAsync = true;
|
request->mIsAsync = true;
|
||||||
@ -1523,9 +1543,9 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement* aElement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inline scripts ignore ther CORS mode and are always CORS_NONE
|
// Inline scripts ignore ther CORS mode and are always CORS_NONE
|
||||||
request = CreateLoadRequest(scriptKind, aElement, version, CORS_NONE,
|
request = CreateLoadRequest(scriptKind, aElement, validJSVersion, CORS_NONE,
|
||||||
SRIMetadata()); // SRI doesn't apply
|
SRIMetadata()); // SRI doesn't apply
|
||||||
request->mJSVersion = version;
|
request->mValidJSVersion = validJSVersion;
|
||||||
request->mIsInline = true;
|
request->mIsInline = true;
|
||||||
request->mURI = mDocument->GetDocumentURI();
|
request->mURI = mDocument->GetDocumentURI();
|
||||||
request->mTriggeringPrincipal = mDocument->NodePrincipal();
|
request->mTriggeringPrincipal = mDocument->NodePrincipal();
|
||||||
@ -2145,8 +2165,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSVersion version = JSVersion(aRequest->mJSVersion);
|
if (aRequest->mValidJSVersion == ValidJSVersion::Invalid) {
|
||||||
if (version == JSVERSION_UNKNOWN) {
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3110,7 +3129,7 @@ ScriptLoader::PreloadURI(nsIURI* aURI, const nsAString& aCharset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<ScriptLoadRequest> request =
|
RefPtr<ScriptLoadRequest> request =
|
||||||
CreateLoadRequest(ScriptKind::Classic, nullptr, 0,
|
CreateLoadRequest(ScriptKind::Classic, nullptr, ValidJSVersion::Valid,
|
||||||
Element::StringToCORSMode(aCrossOrigin), sriMetadata);
|
Element::StringToCORSMode(aCrossOrigin), sriMetadata);
|
||||||
request->mURI = aURI;
|
request->mURI = aURI;
|
||||||
request->mTriggeringPrincipal = mDocument->NodePrincipal();
|
request->mTriggeringPrincipal = mDocument->NodePrincipal();
|
||||||
|
@ -341,7 +341,7 @@ private:
|
|||||||
|
|
||||||
ScriptLoadRequest* CreateLoadRequest(ScriptKind aKind,
|
ScriptLoadRequest* CreateLoadRequest(ScriptKind aKind,
|
||||||
nsIScriptElement* aElement,
|
nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
ValidJSVersion aValidJSVersion,
|
||||||
mozilla::CORSMode aCORSMode,
|
mozilla::CORSMode aCORSMode,
|
||||||
const mozilla::dom::SRIMetadata& aIntegrity);
|
const mozilla::dom::SRIMetadata& aIntegrity);
|
||||||
|
|
||||||
|
@ -835,7 +835,6 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
|
|||||||
const uint32_t aLineNumber)
|
const uint32_t aLineNumber)
|
||||||
{
|
{
|
||||||
bool isJavaScript = true;
|
bool isJavaScript = true;
|
||||||
uint32_t version = JSVERSION_DEFAULT;
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// Look for SRC attribute and look for a LANGUAGE attribute
|
// Look for SRC attribute and look for a LANGUAGE attribute
|
||||||
@ -861,7 +860,6 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
|
|||||||
|
|
||||||
if (nsContentUtils::IsJavascriptMIMEType(mimeType)) {
|
if (nsContentUtils::IsJavascriptMIMEType(mimeType)) {
|
||||||
isJavaScript = true;
|
isJavaScript = true;
|
||||||
version = JSVERSION_DEFAULT;
|
|
||||||
|
|
||||||
// Get the version string, and ensure that JavaScript supports it.
|
// Get the version string, and ensure that JavaScript supports it.
|
||||||
nsAutoString versionName;
|
nsAutoString versionName;
|
||||||
@ -888,7 +886,6 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
|
|||||||
nsAutoString lang(aAttributes[1]);
|
nsAutoString lang(aAttributes[1]);
|
||||||
if (nsContentUtils::IsJavaScriptLanguage(lang)) {
|
if (nsContentUtils::IsJavaScriptLanguage(lang)) {
|
||||||
isJavaScript = true;
|
isJavaScript = true;
|
||||||
version = JSVERSION_DEFAULT;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aAttributes += 2;
|
aAttributes += 2;
|
||||||
@ -904,7 +901,7 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
|
|||||||
if (doc)
|
if (doc)
|
||||||
globalObject = do_QueryInterface(doc->GetWindow());
|
globalObject = do_QueryInterface(doc->GetWindow());
|
||||||
RefPtr<nsXULPrototypeScript> script =
|
RefPtr<nsXULPrototypeScript> script =
|
||||||
new nsXULPrototypeScript(aLineNumber, version);
|
new nsXULPrototypeScript(aLineNumber);
|
||||||
|
|
||||||
// If there is a SRC attribute...
|
// If there is a SRC attribute...
|
||||||
if (! src.IsEmpty()) {
|
if (! src.IsEmpty()) {
|
||||||
|
@ -2251,7 +2251,7 @@ nsXULPrototypeElement::Deserialize(nsIObjectInputStream* aStream,
|
|||||||
break;
|
break;
|
||||||
case eType_Script: {
|
case eType_Script: {
|
||||||
// language version/options obtained during deserialization.
|
// language version/options obtained during deserialization.
|
||||||
RefPtr<nsXULPrototypeScript> script = new nsXULPrototypeScript(0, 0);
|
RefPtr<nsXULPrototypeScript> script = new nsXULPrototypeScript(0);
|
||||||
|
|
||||||
rv = aStream->ReadBoolean(&script->mOutOfLine);
|
rv = aStream->ReadBoolean(&script->mOutOfLine);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) return rv;
|
if (NS_WARN_IF(NS_FAILED(rv))) return rv;
|
||||||
@ -2392,13 +2392,12 @@ nsXULPrototypeElement::TraceAllScripts(JSTracer* aTrc)
|
|||||||
// nsXULPrototypeScript
|
// nsXULPrototypeScript
|
||||||
//
|
//
|
||||||
|
|
||||||
nsXULPrototypeScript::nsXULPrototypeScript(uint32_t aLineNo, uint32_t aVersion)
|
nsXULPrototypeScript::nsXULPrototypeScript(uint32_t aLineNo)
|
||||||
: nsXULPrototypeNode(eType_Script),
|
: nsXULPrototypeNode(eType_Script),
|
||||||
mLineNo(aLineNo),
|
mLineNo(aLineNo),
|
||||||
mSrcLoading(false),
|
mSrcLoading(false),
|
||||||
mOutOfLine(true),
|
mOutOfLine(true),
|
||||||
mSrcLoadWaiters(nullptr),
|
mSrcLoadWaiters(nullptr),
|
||||||
mLangVersion(aVersion),
|
|
||||||
mScriptObject(nullptr)
|
mScriptObject(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -2431,7 +2430,7 @@ nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream,
|
|||||||
nsresult rv;
|
nsresult rv;
|
||||||
rv = aStream->Write32(mLineNo);
|
rv = aStream->Write32(mLineNo);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
rv = aStream->Write32(mLangVersion);
|
rv = aStream->Write32(0); // See bug 1418294.
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
JSContext* cx = jsapi.cx();
|
JSContext* cx = jsapi.cx();
|
||||||
@ -2501,7 +2500,8 @@ nsXULPrototypeScript::Deserialize(nsIObjectInputStream* aStream,
|
|||||||
// Read basic prototype data
|
// Read basic prototype data
|
||||||
rv = aStream->Read32(&mLineNo);
|
rv = aStream->Read32(&mLineNo);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
rv = aStream->Read32(&mLangVersion);
|
uint32_t dummy;
|
||||||
|
rv = aStream->Read32(&dummy); // See bug 1418294.
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
AutoJSAPI jsapi;
|
AutoJSAPI jsapi;
|
||||||
@ -2696,7 +2696,6 @@ nsXULPrototypeScript::Compile(JS::SourceBufferHolder& aSrcBuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ok, compile it to create a prototype script object!
|
// Ok, compile it to create a prototype script object!
|
||||||
NS_ENSURE_TRUE(JSVersion(mLangVersion) != JSVERSION_UNKNOWN, NS_OK);
|
|
||||||
JS::CompileOptions options(cx);
|
JS::CompileOptions options(cx);
|
||||||
options.setIntroductionType("scriptElement")
|
options.setIntroductionType("scriptElement")
|
||||||
.setFileAndLine(urlspec.get(), aLineNo);
|
.setFileAndLine(urlspec.get(), aLineNo);
|
||||||
|
@ -212,7 +212,7 @@ class XULDocument;
|
|||||||
class nsXULPrototypeScript : public nsXULPrototypeNode
|
class nsXULPrototypeScript : public nsXULPrototypeNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsXULPrototypeScript(uint32_t aLineNo, uint32_t version);
|
explicit nsXULPrototypeScript(uint32_t aLineNo);
|
||||||
virtual ~nsXULPrototypeScript();
|
virtual ~nsXULPrototypeScript();
|
||||||
|
|
||||||
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
|
||||||
@ -269,7 +269,6 @@ public:
|
|||||||
bool mSrcLoading;
|
bool mSrcLoading;
|
||||||
bool mOutOfLine;
|
bool mOutOfLine;
|
||||||
mozilla::dom::XULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
|
mozilla::dom::XULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
|
||||||
uint32_t mLangVersion;
|
|
||||||
private:
|
private:
|
||||||
JS::Heap<JSScript*> mScriptObject;
|
JS::Heap<JSScript*> mScriptObject;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user