mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 02:57:29 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
bd5506d13c
59 changed files with 1121 additions and 955 deletions
|
|
@ -439,6 +439,7 @@ pref("browser.link.open_newwindow.disabled_in_fullscreen", false);
|
||||||
// Tabbed browser
|
// Tabbed browser
|
||||||
pref("browser.tabs.autoHide", false);
|
pref("browser.tabs.autoHide", false);
|
||||||
pref("browser.tabs.closeWindowWithLastTab", true);
|
pref("browser.tabs.closeWindowWithLastTab", true);
|
||||||
|
pref("browser.tabs.insertAllAfterCurrent", false);
|
||||||
pref("browser.tabs.insertRelatedAfterCurrent", true);
|
pref("browser.tabs.insertRelatedAfterCurrent", true);
|
||||||
pref("browser.tabs.warnOnClose", true);
|
pref("browser.tabs.warnOnClose", true);
|
||||||
pref("browser.tabs.warnOnCloseOtherTabs", true);
|
pref("browser.tabs.warnOnCloseOtherTabs", true);
|
||||||
|
|
|
||||||
|
|
@ -1740,13 +1740,15 @@
|
||||||
this._outerWindowIDBrowserMap.set(b.outerWindowID, b);
|
this._outerWindowIDBrowserMap.set(b.outerWindowID, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we're opening a tab related to the current tab and
|
// Check if the user prefers inserting all new tabs after the current tab.
|
||||||
// move it to after the current tab.
|
// If not, check if we're opening a tab related to the current tab.
|
||||||
// aReferrerURI is null or undefined if the tab is opened from
|
// If either condition is met, move the new tab to after the current tab.
|
||||||
|
// Note: aReferrerURI is null or undefined if the tab is opened from
|
||||||
// an external application or bookmark, i.e. somewhere other
|
// an external application or bookmark, i.e. somewhere other
|
||||||
// than the current tab.
|
// than the current tab.
|
||||||
if ((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
|
if (Services.prefs.getBoolPref("browser.tabs.insertAllAfterCurrent", false) ||
|
||||||
Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent")) {
|
((aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent) &&
|
||||||
|
Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent"))) {
|
||||||
let newTabPos = (this._lastRelatedTab ||
|
let newTabPos = (this._lastRelatedTab ||
|
||||||
this.selectedTab)._tPos + 1;
|
this.selectedTab)._tPos + 1;
|
||||||
if (this._lastRelatedTab)
|
if (this._lastRelatedTab)
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "ImportManager.h"
|
#include "ImportManager.h"
|
||||||
|
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
#include "HTMLLinkElement.h"
|
#include "HTMLLinkElement.h"
|
||||||
#include "nsContentPolicyUtils.h"
|
#include "nsContentPolicyUtils.h"
|
||||||
|
|
@ -18,7 +19,6 @@
|
||||||
#include "nsIDOMEvent.h"
|
#include "nsIDOMEvent.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
@ -156,7 +156,7 @@ ImportLoader::Updater::UpdateMainReferrer(uint32_t aNewIdx)
|
||||||
// Our nearest predecessor has changed. So let's add the ScriptLoader to the
|
// Our nearest predecessor has changed. So let's add the ScriptLoader to the
|
||||||
// new one if there is any. And remove it from the old one.
|
// new one if there is any. And remove it from the old one.
|
||||||
RefPtr<ImportManager> manager = mLoader->Manager();
|
RefPtr<ImportManager> manager = mLoader->Manager();
|
||||||
nsScriptLoader* loader = mLoader->mDocument->ScriptLoader();
|
ScriptLoader* loader = mLoader->mDocument->ScriptLoader();
|
||||||
ImportLoader*& pred = mLoader->mBlockingPredecessor;
|
ImportLoader*& pred = mLoader->mBlockingPredecessor;
|
||||||
ImportLoader* newPred = manager->GetNearestPredecessor(newMainReferrer);
|
ImportLoader* newPred = manager->GetNearestPredecessor(newMainReferrer);
|
||||||
if (pred) {
|
if (pred) {
|
||||||
|
|
@ -339,7 +339,7 @@ ImportLoader::DispatchEventIfFinished(nsINode* aNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader)
|
ImportLoader::AddBlockedScriptLoader(ScriptLoader* aScriptLoader)
|
||||||
{
|
{
|
||||||
if (mBlockedScriptLoaders.Contains(aScriptLoader)) {
|
if (mBlockedScriptLoaders.Contains(aScriptLoader)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -352,7 +352,7 @@ ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ImportLoader::RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader)
|
ImportLoader::RemoveBlockedScriptLoader(ScriptLoader* aScriptLoader)
|
||||||
{
|
{
|
||||||
aScriptLoader->RemoveParserBlockingScriptExecutionBlocker();
|
aScriptLoader->RemoveParserBlockingScriptExecutionBlocker();
|
||||||
return mBlockedScriptLoaders.RemoveElement(aScriptLoader);
|
return mBlockedScriptLoaders.RemoveElement(aScriptLoader);
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@
|
||||||
#include "nsIStreamListener.h"
|
#include "nsIStreamListener.h"
|
||||||
#include "nsIWeakReferenceUtils.h"
|
#include "nsIWeakReferenceUtils.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsURIHashKey.h"
|
#include "nsURIHashKey.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
class nsIPrincipal;
|
class nsIPrincipal;
|
||||||
|
|
@ -184,8 +184,8 @@ public:
|
||||||
// and wait for that to run its scripts. We keep track of all the
|
// and wait for that to run its scripts. We keep track of all the
|
||||||
// ScriptRunners that are waiting for this import. NOTE: updating
|
// ScriptRunners that are waiting for this import. NOTE: updating
|
||||||
// the main referrer might change this list.
|
// the main referrer might change this list.
|
||||||
void AddBlockedScriptLoader(nsScriptLoader* aScriptLoader);
|
void AddBlockedScriptLoader(ScriptLoader* aScriptLoader);
|
||||||
bool RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader);
|
bool RemoveBlockedScriptLoader(ScriptLoader* aScriptLoader);
|
||||||
void SetBlockingPredecessor(ImportLoader* aLoader);
|
void SetBlockingPredecessor(ImportLoader* aLoader);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -230,7 +230,7 @@ private:
|
||||||
|
|
||||||
// List of pending ScriptLoaders that are waiting for this import
|
// List of pending ScriptLoaders that are waiting for this import
|
||||||
// to finish.
|
// to finish.
|
||||||
nsTArray<RefPtr<nsScriptLoader>> mBlockedScriptLoaders;
|
nsTArray<RefPtr<ScriptLoader>> mBlockedScriptLoaders;
|
||||||
|
|
||||||
// There is always exactly one referrer link that is flagged as
|
// There is always exactly one referrer link that is flagged as
|
||||||
// the main referrer the primary link. This is the one that is
|
// the main referrer the primary link. This is the one that is
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsNullPrincipal.h"
|
#include "nsNullPrincipal.h"
|
||||||
#include "ScriptSettings.h"
|
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "mozilla/dom/LocationBinding.h"
|
#include "mozilla/dom/LocationBinding.h"
|
||||||
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ XPIDL_SOURCES += [
|
||||||
'nsIObjectLoadingContent.idl',
|
'nsIObjectLoadingContent.idl',
|
||||||
'nsIRemoteWindowContext.idl',
|
'nsIRemoteWindowContext.idl',
|
||||||
'nsIScriptChannel.idl',
|
'nsIScriptChannel.idl',
|
||||||
'nsIScriptLoaderObserver.idl',
|
|
||||||
'nsISelection.idl',
|
'nsISelection.idl',
|
||||||
'nsISelectionController.idl',
|
'nsISelectionController.idl',
|
||||||
'nsISelectionDisplay.idl',
|
'nsISelectionDisplay.idl',
|
||||||
|
|
@ -97,7 +96,6 @@ EXPORTS += [
|
||||||
'nsINode.h',
|
'nsINode.h',
|
||||||
'nsINodeList.h',
|
'nsINodeList.h',
|
||||||
'nsIScriptContext.h',
|
'nsIScriptContext.h',
|
||||||
'nsIScriptElement.h',
|
|
||||||
'nsIScriptGlobalObject.h',
|
'nsIScriptGlobalObject.h',
|
||||||
'nsIScriptNameSpaceManager.h',
|
'nsIScriptNameSpaceManager.h',
|
||||||
'nsIScriptObjectPrincipal.h',
|
'nsIScriptObjectPrincipal.h',
|
||||||
|
|
@ -118,7 +116,6 @@ EXPORTS += [
|
||||||
'nsRange.h',
|
'nsRange.h',
|
||||||
'nsReferencedElement.h',
|
'nsReferencedElement.h',
|
||||||
'nsSandboxFlags.h',
|
'nsSandboxFlags.h',
|
||||||
'nsScriptLoader.h',
|
|
||||||
'nsStructuredCloneContainer.h',
|
'nsStructuredCloneContainer.h',
|
||||||
'nsStubAnimationObserver.h',
|
'nsStubAnimationObserver.h',
|
||||||
'nsStubDocumentObserver.h',
|
'nsStubDocumentObserver.h',
|
||||||
|
|
@ -210,7 +207,6 @@ EXPORTS.mozilla.dom += [
|
||||||
'ResponsiveImageSelector.h',
|
'ResponsiveImageSelector.h',
|
||||||
'SameProcessMessageQueue.h',
|
'SameProcessMessageQueue.h',
|
||||||
'ScreenOrientation.h',
|
'ScreenOrientation.h',
|
||||||
'ScriptSettings.h',
|
|
||||||
'ShadowRoot.h',
|
'ShadowRoot.h',
|
||||||
'SimpleTreeIterator.h',
|
'SimpleTreeIterator.h',
|
||||||
'StructuredCloneHolder.h',
|
'StructuredCloneHolder.h',
|
||||||
|
|
@ -331,8 +327,6 @@ SOURCES += [
|
||||||
'nsRange.cpp',
|
'nsRange.cpp',
|
||||||
'nsReferencedElement.cpp',
|
'nsReferencedElement.cpp',
|
||||||
'nsScreen.cpp',
|
'nsScreen.cpp',
|
||||||
'nsScriptElement.cpp',
|
|
||||||
'nsScriptLoader.cpp',
|
|
||||||
'nsScriptNameSpaceManager.cpp',
|
'nsScriptNameSpaceManager.cpp',
|
||||||
'nsStructuredCloneContainer.cpp',
|
'nsStructuredCloneContainer.cpp',
|
||||||
'nsStubAnimationObserver.cpp',
|
'nsStubAnimationObserver.cpp',
|
||||||
|
|
@ -359,7 +353,6 @@ SOURCES += [
|
||||||
'ResponsiveImageSelector.cpp',
|
'ResponsiveImageSelector.cpp',
|
||||||
'SameProcessMessageQueue.cpp',
|
'SameProcessMessageQueue.cpp',
|
||||||
'ScreenOrientation.cpp',
|
'ScreenOrientation.cpp',
|
||||||
'ScriptSettings.cpp',
|
|
||||||
'ShadowRoot.cpp',
|
'ShadowRoot.cpp',
|
||||||
'StructuredCloneHolder.cpp',
|
'StructuredCloneHolder.cpp',
|
||||||
'StyleSheetList.cpp',
|
'StyleSheetList.cpp',
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,8 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMEvent.h"
|
#include "nsIDOMEvent.h"
|
||||||
#include "nsWeakPtr.h"
|
#include "nsWeakPtr.h"
|
||||||
#include "ScriptSettings.h"
|
|
||||||
|
|
||||||
using mozilla::Unused; // <snicker>
|
using mozilla::Unused;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsContentSink.h"
|
#include "nsContentSink.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "mozilla/css/Loader.h"
|
#include "mozilla/css/Loader.h"
|
||||||
|
|
@ -49,6 +48,7 @@
|
||||||
#include "nsHTMLDNSPrefetch.h"
|
#include "nsHTMLDNSPrefetch.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "nsParserConstants.h"
|
#include "nsParserConstants.h"
|
||||||
#include "nsSandboxFlags.h"
|
#include "nsSandboxFlags.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,16 @@ class nsIAtom;
|
||||||
class nsIChannel;
|
class nsIChannel;
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsNodeInfoManager;
|
class nsNodeInfoManager;
|
||||||
class nsScriptLoader;
|
|
||||||
class nsIApplicationCache;
|
class nsIApplicationCache;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace css {
|
namespace css {
|
||||||
class Loader;
|
class Loader;
|
||||||
} // namespace css
|
} // namespace css
|
||||||
|
|
||||||
|
namespace dom {
|
||||||
|
class ScriptLoader;
|
||||||
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
@ -273,7 +276,7 @@ protected:
|
||||||
nsCOMPtr<nsIDocShell> mDocShell;
|
nsCOMPtr<nsIDocShell> mDocShell;
|
||||||
RefPtr<mozilla::css::Loader> mCSSLoader;
|
RefPtr<mozilla::css::Loader> mCSSLoader;
|
||||||
RefPtr<nsNodeInfoManager> mNodeInfoManager;
|
RefPtr<nsNodeInfoManager> mNodeInfoManager;
|
||||||
RefPtr<nsScriptLoader> mScriptLoader;
|
RefPtr<mozilla::dom::ScriptLoader> mScriptLoader;
|
||||||
|
|
||||||
// back off timer notification after count
|
// back off timer notification after count
|
||||||
int32_t mBackoffCount;
|
int32_t mBackoffCount;
|
||||||
|
|
|
||||||
|
|
@ -1834,7 +1834,7 @@ nsDocument::Init()
|
||||||
mScopeObject = do_GetWeakReference(global);
|
mScopeObject = do_GetWeakReference(global);
|
||||||
MOZ_ASSERT(mScopeObject);
|
MOZ_ASSERT(mScopeObject);
|
||||||
|
|
||||||
mScriptLoader = new nsScriptLoader(this);
|
mScriptLoader = new dom::ScriptLoader(this);
|
||||||
|
|
||||||
mozilla::HoldJSObjects(this);
|
mozilla::HoldJSObjects(this);
|
||||||
|
|
||||||
|
|
@ -4623,7 +4623,7 @@ nsDocument::GetWindowInternal() const
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsScriptLoader*
|
ScriptLoader*
|
||||||
nsDocument::ScriptLoader()
|
nsDocument::ScriptLoader()
|
||||||
{
|
{
|
||||||
return mScriptLoader;
|
return mScriptLoader;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
#include "nsJSThingHashtable.h"
|
#include "nsJSThingHashtable.h"
|
||||||
#include "nsIScriptObjectPrincipal.h"
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIRadioGroupContainer.h"
|
#include "nsIRadioGroupContainer.h"
|
||||||
#include "nsILayoutHistoryState.h"
|
#include "nsILayoutHistoryState.h"
|
||||||
#include "nsIRequest.h"
|
#include "nsIRequest.h"
|
||||||
|
|
@ -61,6 +60,7 @@
|
||||||
#include "mozilla/MemoryReporting.h"
|
#include "mozilla/MemoryReporting.h"
|
||||||
#include "mozilla/PendingAnimationTracker.h"
|
#include "mozilla/PendingAnimationTracker.h"
|
||||||
#include "mozilla/dom/DOMImplementation.h"
|
#include "mozilla/dom/DOMImplementation.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/StyleSheetList.h"
|
#include "mozilla/dom/StyleSheetList.h"
|
||||||
#include "nsDataHashtable.h"
|
#include "nsDataHashtable.h"
|
||||||
#include "mozilla/TimeStamp.h"
|
#include "mozilla/TimeStamp.h"
|
||||||
|
|
@ -491,7 +491,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the script loader for this document
|
* Get the script loader for this document
|
||||||
*/
|
*/
|
||||||
virtual nsScriptLoader* ScriptLoader() override;
|
virtual mozilla::dom::ScriptLoader* ScriptLoader() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add/Remove an element to the document's id and name hashes
|
* Add/Remove an element to the document's id and name hashes
|
||||||
|
|
@ -1205,7 +1205,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||||
RefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
|
RefPtr<nsDOMStyleSheetSetList> mStyleSheetSetList;
|
||||||
RefPtr<nsScriptLoader> mScriptLoader;
|
RefPtr<mozilla::dom::ScriptLoader> mScriptLoader;
|
||||||
nsDocHeaderData* mHeaderData;
|
nsDocHeaderData* mHeaderData;
|
||||||
|
|
||||||
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
|
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
#include "nsJSPrincipals.h"
|
#include "nsJSPrincipals.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsFrameLoader.h"
|
#include "nsFrameLoader.h"
|
||||||
#include "nsIXULRuntime.h"
|
#include "nsIXULRuntime.h"
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
|
|
@ -38,6 +37,7 @@
|
||||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||||
#include "mozilla/dom/ProcessGlobal.h"
|
#include "mozilla/dom/ProcessGlobal.h"
|
||||||
#include "mozilla/dom/SameProcessMessageQueue.h"
|
#include "mozilla/dom/SameProcessMessageQueue.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/dom/ipc/BlobChild.h"
|
#include "mozilla/dom/ipc/BlobChild.h"
|
||||||
#include "mozilla/dom/ipc/BlobParent.h"
|
#include "mozilla/dom/ipc/BlobParent.h"
|
||||||
|
|
@ -1786,7 +1786,7 @@ nsMessageManagerScriptExecutor::TryCacheLoadAndCompileScript(
|
||||||
if (NS_FAILED(NS_ReadInputStreamToString(input, buffer, avail))) {
|
if (NS_FAILED(NS_ReadInputStreamToString(input, buffer, avail))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nsScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail,
|
ScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail,
|
||||||
EmptyString(), nullptr,
|
EmptyString(), nullptr,
|
||||||
dataStringBuf, dataStringLength);
|
dataStringBuf, dataStringLength);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsDOMClassInfo.h"
|
#include "nsDOMClassInfo.h"
|
||||||
#include "nsJSEnvironment.h"
|
#include "nsJSEnvironment.h"
|
||||||
#include "ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "mozilla/Sprintf.h"
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,6 @@ class nsIVariant;
|
||||||
class nsViewManager;
|
class nsViewManager;
|
||||||
class nsPresContext;
|
class nsPresContext;
|
||||||
class nsRange;
|
class nsRange;
|
||||||
class nsScriptLoader;
|
|
||||||
class nsSMILAnimationController;
|
class nsSMILAnimationController;
|
||||||
class nsTextNode;
|
class nsTextNode;
|
||||||
class nsWindowSizes;
|
class nsWindowSizes;
|
||||||
|
|
@ -153,6 +152,7 @@ enum class OrientationType : uint32_t;
|
||||||
class ProcessingInstruction;
|
class ProcessingInstruction;
|
||||||
class Promise;
|
class Promise;
|
||||||
class Selection;
|
class Selection;
|
||||||
|
class ScriptLoader;
|
||||||
class StyleSheetList;
|
class StyleSheetList;
|
||||||
class SVGDocument;
|
class SVGDocument;
|
||||||
class SVGSVGElement;
|
class SVGSVGElement;
|
||||||
|
|
@ -1278,7 +1278,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the script loader for this document
|
* Get the script loader for this document
|
||||||
*/
|
*/
|
||||||
virtual nsScriptLoader* ScriptLoader() = 0;
|
virtual mozilla::dom::ScriptLoader* ScriptLoader() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add/Remove an element to the document's id and name hashes
|
* Add/Remove an element to the document's id and name hashes
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsFrameLoader.h"
|
#include "nsFrameLoader.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
#include "nsIMozBrowserFrame.h"
|
||||||
#include "nsDOMClassInfoID.h"
|
#include "nsDOMClassInfoID.h"
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/dom/SameProcessMessageQueue.h"
|
#include "mozilla/dom/SameProcessMessageQueue.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
#include "nsXPCOMCIDInternal.h"
|
#include "nsXPCOMCIDInternal.h"
|
||||||
#include "nsIXULRuntime.h"
|
#include "nsIXULRuntime.h"
|
||||||
#include "nsTextFormatter.h"
|
#include "nsTextFormatter.h"
|
||||||
#include "ScriptSettings.h"
|
|
||||||
|
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
|
|
||||||
|
|
@ -55,6 +54,7 @@
|
||||||
#include "mozilla/dom/DOMException.h"
|
#include "mozilla/dom/DOMException.h"
|
||||||
#include "mozilla/dom/DOMExceptionBinding.h"
|
#include "mozilla/dom/DOMExceptionBinding.h"
|
||||||
#include "mozilla/dom/ErrorEvent.h"
|
#include "mozilla/dom/ErrorEvent.h"
|
||||||
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "nsAXPCNativeCallContext.h"
|
#include "nsAXPCNativeCallContext.h"
|
||||||
#include "mozilla/CycleCollectedJSContext.h"
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsIContentSerializer.h"
|
#include "nsIContentSerializer.h"
|
||||||
#include "nsIDocumentEncoder.h"
|
#include "nsIDocumentEncoder.h"
|
||||||
#include "nsILineBreaker.h"
|
#include "nsILineBreaker.h"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include "mozilla/dom/File.h"
|
#include "mozilla/dom/File.h"
|
||||||
#include "mozilla/dom/FunctionBinding.h"
|
#include "mozilla/dom/FunctionBinding.h"
|
||||||
#include "mozilla/dom/Performance.h"
|
#include "mozilla/dom/Performance.h"
|
||||||
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/dom/StructuredCloneHolder.h"
|
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||||
#include "mozilla/dom/ToJSValue.h"
|
#include "mozilla/dom/ToJSValue.h"
|
||||||
#include "mozilla/dom/WorkletGlobalScope.h"
|
#include "mozilla/dom/WorkletGlobalScope.h"
|
||||||
|
|
@ -22,7 +23,6 @@
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "ScriptSettings.h"
|
|
||||||
#include "WorkerPrivate.h"
|
#include "WorkerPrivate.h"
|
||||||
#include "WorkerRunnable.h"
|
#include "WorkerRunnable.h"
|
||||||
#include "WorkerScope.h"
|
#include "WorkerScope.h"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "mozilla/Sprintf.h"
|
#include "mozilla/Sprintf.h"
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
#include "ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/DOMEventTargetHelper.h"
|
#include "mozilla/DOMEventTargetHelper.h"
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/EventListenerManager.h"
|
#include "mozilla/EventListenerManager.h"
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ HTMLScriptElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||||
HTMLScriptElement::HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
HTMLScriptElement::HTMLScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||||
FromParser aFromParser)
|
FromParser aFromParser)
|
||||||
: nsGenericHTMLElement(aNodeInfo)
|
: nsGenericHTMLElement(aNodeInfo)
|
||||||
, nsScriptElement(aFromParser)
|
, ScriptElement(aFromParser)
|
||||||
{
|
{
|
||||||
AddMutationObserver(this);
|
AddMutationObserver(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,16 @@
|
||||||
#define mozilla_dom_HTMLScriptElement_h
|
#define mozilla_dom_HTMLScriptElement_h
|
||||||
|
|
||||||
#include "nsIDOMHTMLScriptElement.h"
|
#include "nsIDOMHTMLScriptElement.h"
|
||||||
#include "nsScriptElement.h"
|
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/dom/ScriptElement.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class HTMLScriptElement final : public nsGenericHTMLElement,
|
class HTMLScriptElement final : public nsGenericHTMLElement,
|
||||||
public nsIDOMHTMLScriptElement,
|
public nsIDOMHTMLScriptElement,
|
||||||
public nsScriptElement
|
public ScriptElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Element::GetText;
|
using Element::GetText;
|
||||||
|
|
@ -98,7 +98,8 @@ protected:
|
||||||
virtual ~HTMLScriptElement();
|
virtual ~HTMLScriptElement();
|
||||||
|
|
||||||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
// nsScriptElement
|
|
||||||
|
// ScriptElement
|
||||||
virtual bool HasScriptContent() override;
|
virtual bool HasScriptContent() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsNameSpaceManager.h"
|
#include "nsNameSpaceManager.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsRuleData.h"
|
#include "nsRuleData.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
|
|
@ -92,6 +91,7 @@
|
||||||
#include "mozilla/dom/FromParser.h"
|
#include "mozilla/dom/FromParser.h"
|
||||||
#include "mozilla/dom/Link.h"
|
#include "mozilla/dom/Link.h"
|
||||||
#include "mozilla/BloomFilter.h"
|
#include "mozilla/BloomFilter.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
#include "nsVariant.h"
|
#include "nsVariant.h"
|
||||||
#include "nsDOMTokenList.h"
|
#include "nsDOMTokenList.h"
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
#include "nsIHTMLContentSink.h"
|
#include "nsIHTMLContentSink.h"
|
||||||
#include "nsIInterfaceRequestor.h"
|
#include "nsIInterfaceRequestor.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "mozilla/dom/NodeInfo.h"
|
#include "mozilla/dom/NodeInfo.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "nsToken.h"
|
#include "nsToken.h"
|
||||||
#include "nsIAppShell.h"
|
#include "nsIAppShell.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
#include "mozilla/dom/MessagePortBinding.h"
|
#include "mozilla/dom/MessagePortBinding.h"
|
||||||
#include "mozilla/dom/MessagePortChild.h"
|
#include "mozilla/dom/MessagePortChild.h"
|
||||||
#include "mozilla/dom/PMessagePort.h"
|
#include "mozilla/dom/PMessagePort.h"
|
||||||
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/dom/StructuredCloneTags.h"
|
#include "mozilla/dom/StructuredCloneTags.h"
|
||||||
#include "mozilla/dom/WorkerPrivate.h"
|
#include "mozilla/dom/WorkerPrivate.h"
|
||||||
#include "mozilla/dom/WorkerScope.h"
|
#include "mozilla/dom/WorkerScope.h"
|
||||||
|
|
@ -28,7 +29,6 @@
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "ScriptSettings.h"
|
|
||||||
#include "SharedMessagePortMessage.h"
|
#include "SharedMessagePortMessage.h"
|
||||||
|
|
||||||
#include "nsIBFCacheEntry.h"
|
#include "nsIBFCacheEntry.h"
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ DIRS += [
|
||||||
'performance',
|
'performance',
|
||||||
'xhr',
|
'xhr',
|
||||||
'worklet',
|
'worklet',
|
||||||
|
'script',
|
||||||
]
|
]
|
||||||
|
|
||||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||||
|
|
|
||||||
102
dom/script/ModuleLoadRequest.cpp
Normal file
102
dom/script/ModuleLoadRequest.cpp
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* 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 "ModuleLoadRequest.h"
|
||||||
|
#include "ModuleScript.h"
|
||||||
|
#include "ScriptLoader.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ModuleLoadRequest)
|
||||||
|
NS_INTERFACE_MAP_END_INHERITING(ScriptLoadRequest)
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(ModuleLoadRequest, ScriptLoadRequest,
|
||||||
|
mBaseURL,
|
||||||
|
mLoader,
|
||||||
|
mParent,
|
||||||
|
mModuleScript,
|
||||||
|
mImports)
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
||||||
|
NS_IMPL_RELEASE_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
||||||
|
|
||||||
|
ModuleLoadRequest::ModuleLoadRequest(nsIScriptElement* aElement,
|
||||||
|
uint32_t aVersion,
|
||||||
|
CORSMode aCORSMode,
|
||||||
|
const SRIMetadata &aIntegrity,
|
||||||
|
ScriptLoader* aLoader)
|
||||||
|
: ScriptLoadRequest(ScriptKind::Module,
|
||||||
|
aElement,
|
||||||
|
aVersion,
|
||||||
|
aCORSMode,
|
||||||
|
aIntegrity),
|
||||||
|
mIsTopLevel(true),
|
||||||
|
mLoader(aLoader)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void ModuleLoadRequest::Cancel()
|
||||||
|
{
|
||||||
|
ScriptLoadRequest::Cancel();
|
||||||
|
mModuleScript = nullptr;
|
||||||
|
mProgress = ScriptLoadRequest::Progress::Ready;
|
||||||
|
for (size_t i = 0; i < mImports.Length(); i++) {
|
||||||
|
mImports[i]->Cancel();
|
||||||
|
}
|
||||||
|
mReady.RejectIfExists(NS_ERROR_FAILURE, __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ModuleLoadRequest::SetReady()
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
for (size_t i = 0; i < mImports.Length(); i++) {
|
||||||
|
MOZ_ASSERT(mImports[i]->IsReadyToRun());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ScriptLoadRequest::SetReady();
|
||||||
|
mReady.ResolveIfExists(true, __func__);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ModuleLoadRequest::ModuleLoaded()
|
||||||
|
{
|
||||||
|
// A module that was found to be marked as fetching in the module map has now
|
||||||
|
// been loaded.
|
||||||
|
|
||||||
|
mModuleScript = mLoader->GetFetchedModule(mURI);
|
||||||
|
mLoader->StartFetchingModuleDependencies(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ModuleLoadRequest::DependenciesLoaded()
|
||||||
|
{
|
||||||
|
// The module and all of its dependencies have been successfully fetched and
|
||||||
|
// compiled.
|
||||||
|
|
||||||
|
if (!mLoader->InstantiateModuleTree(this)) {
|
||||||
|
LoadFailed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetReady();
|
||||||
|
mLoader->ProcessLoadedModuleTree(this);
|
||||||
|
mLoader = nullptr;
|
||||||
|
mParent = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ModuleLoadRequest::LoadFailed()
|
||||||
|
{
|
||||||
|
Cancel();
|
||||||
|
mLoader->ProcessLoadedModuleTree(this);
|
||||||
|
mLoader = nullptr;
|
||||||
|
mParent = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
||||||
81
dom/script/ModuleLoadRequest.h
Normal file
81
dom/script/ModuleLoadRequest.h
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_ModuleLoadRequest_h
|
||||||
|
#define mozilla_dom_ModuleLoadRequest_h
|
||||||
|
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
#include "mozilla/MozPromise.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class ModuleScript;
|
||||||
|
class ScriptLoader;
|
||||||
|
|
||||||
|
// A load request for a module, created for every top level module script and
|
||||||
|
// every module import. Load request can share a ModuleScript if there are
|
||||||
|
// multiple imports of the same module.
|
||||||
|
|
||||||
|
class ModuleLoadRequest final : public ScriptLoadRequest
|
||||||
|
{
|
||||||
|
~ModuleLoadRequest() {}
|
||||||
|
|
||||||
|
ModuleLoadRequest(const ModuleLoadRequest& aOther) = delete;
|
||||||
|
ModuleLoadRequest(ModuleLoadRequest&& aOther) = delete;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ModuleLoadRequest, ScriptLoadRequest)
|
||||||
|
|
||||||
|
ModuleLoadRequest(nsIScriptElement* aElement,
|
||||||
|
uint32_t aVersion,
|
||||||
|
CORSMode aCORSMode,
|
||||||
|
const SRIMetadata& aIntegrity,
|
||||||
|
ScriptLoader* aLoader);
|
||||||
|
|
||||||
|
bool IsTopLevel() const {
|
||||||
|
return mIsTopLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetReady() override;
|
||||||
|
void Cancel() override;
|
||||||
|
|
||||||
|
void ModuleLoaded();
|
||||||
|
void DependenciesLoaded();
|
||||||
|
void LoadFailed();
|
||||||
|
|
||||||
|
// Is this a request for a top level module script or an import?
|
||||||
|
bool mIsTopLevel;
|
||||||
|
|
||||||
|
// The base URL used for resolving relative module imports.
|
||||||
|
nsCOMPtr<nsIURI> mBaseURL;
|
||||||
|
|
||||||
|
// Pointer to the script loader, used to trigger actions when the module load
|
||||||
|
// finishes.
|
||||||
|
RefPtr<ScriptLoader> mLoader;
|
||||||
|
|
||||||
|
// The importing module, or nullptr for top level module scripts. Used to
|
||||||
|
// implement the ancestor list checked when fetching module dependencies.
|
||||||
|
RefPtr<ModuleLoadRequest> mParent;
|
||||||
|
|
||||||
|
// Set to a module script object after a successful load or nullptr on
|
||||||
|
// failure.
|
||||||
|
RefPtr<ModuleScript> mModuleScript;
|
||||||
|
|
||||||
|
// A promise that is completed on successful load of this module and all of
|
||||||
|
// its dependencies, indicating that the module is ready for instantiation and
|
||||||
|
// evaluation.
|
||||||
|
MozPromiseHolder<GenericPromise> mReady;
|
||||||
|
|
||||||
|
// Array of imported modules.
|
||||||
|
nsTArray<RefPtr<ModuleLoadRequest>> mImports;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
||||||
|
|
||||||
|
#endif // mozilla_dom_ModuleLoadRequest_h
|
||||||
100
dom/script/ModuleScript.cpp
Normal file
100
dom/script/ModuleScript.cpp
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A class that handles loading and evaluation of <script> elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ModuleScript.h"
|
||||||
|
#include "mozilla/HoldDropJSObjects.h"
|
||||||
|
#include "ScriptLoader.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
// A single module script. May be used to satisfy multiple load requests.
|
||||||
|
|
||||||
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ModuleScript)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_CLASS(ModuleScript)
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ModuleScript)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoader)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBaseURL)
|
||||||
|
tmp->UnlinkModuleRecord();
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ModuleScript)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLoader)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ModuleScript)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mModuleRecord)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mException)
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||||
|
|
||||||
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(ModuleScript)
|
||||||
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(ModuleScript)
|
||||||
|
|
||||||
|
ModuleScript::ModuleScript(ScriptLoader *aLoader, nsIURI* aBaseURL,
|
||||||
|
JS::Handle<JSObject*> aModuleRecord)
|
||||||
|
: mLoader(aLoader),
|
||||||
|
mBaseURL(aBaseURL),
|
||||||
|
mModuleRecord(aModuleRecord),
|
||||||
|
mInstantiationState(Uninstantiated)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mLoader);
|
||||||
|
MOZ_ASSERT(mBaseURL);
|
||||||
|
MOZ_ASSERT(mModuleRecord);
|
||||||
|
MOZ_ASSERT(mException.isUndefined());
|
||||||
|
|
||||||
|
// Make module's host defined field point to this module script object.
|
||||||
|
// This is cleared in the UnlinkModuleRecord().
|
||||||
|
JS::SetModuleHostDefinedField(mModuleRecord, JS::PrivateValue(this));
|
||||||
|
HoldJSObjects(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ModuleScript::UnlinkModuleRecord()
|
||||||
|
{
|
||||||
|
// Remove module's back reference to this object request if present.
|
||||||
|
if (mModuleRecord) {
|
||||||
|
MOZ_ASSERT(JS::GetModuleHostDefinedField(mModuleRecord).toPrivate() ==
|
||||||
|
this);
|
||||||
|
JS::SetModuleHostDefinedField(mModuleRecord, JS::UndefinedValue());
|
||||||
|
}
|
||||||
|
mModuleRecord = nullptr;
|
||||||
|
mException.setUndefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleScript::~ModuleScript()
|
||||||
|
{
|
||||||
|
if (mModuleRecord) {
|
||||||
|
// The object may be destroyed without being unlinked first.
|
||||||
|
UnlinkModuleRecord();
|
||||||
|
}
|
||||||
|
DropJSObjects(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ModuleScript::SetInstantiationResult(JS::Handle<JS::Value> aMaybeException)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mInstantiationState == Uninstantiated);
|
||||||
|
MOZ_ASSERT(mModuleRecord);
|
||||||
|
MOZ_ASSERT(mException.isUndefined());
|
||||||
|
|
||||||
|
if (aMaybeException.isUndefined()) {
|
||||||
|
mInstantiationState = Instantiated;
|
||||||
|
} else {
|
||||||
|
mModuleRecord = nullptr;
|
||||||
|
mException = aMaybeException;
|
||||||
|
mInstantiationState = Errored;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
||||||
67
dom/script/ModuleScript.h
Normal file
67
dom/script/ModuleScript.h
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_ModuleScript_h
|
||||||
|
#define mozilla_dom_ModuleScript_h
|
||||||
|
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
#include "jsapi.h"
|
||||||
|
|
||||||
|
class nsIURI;
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class ScriptLoader;
|
||||||
|
|
||||||
|
class ModuleScript final : public nsISupports
|
||||||
|
{
|
||||||
|
enum InstantiationState {
|
||||||
|
Uninstantiated,
|
||||||
|
Instantiated,
|
||||||
|
Errored
|
||||||
|
};
|
||||||
|
|
||||||
|
RefPtr<ScriptLoader> mLoader;
|
||||||
|
nsCOMPtr<nsIURI> mBaseURL;
|
||||||
|
JS::Heap<JSObject*> mModuleRecord;
|
||||||
|
JS::Heap<JS::Value> mException;
|
||||||
|
InstantiationState mInstantiationState;
|
||||||
|
|
||||||
|
~ModuleScript();
|
||||||
|
|
||||||
|
public:
|
||||||
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ModuleScript)
|
||||||
|
|
||||||
|
ModuleScript(ScriptLoader* aLoader,
|
||||||
|
nsIURI* aBaseURL,
|
||||||
|
JS::Handle<JSObject*> aModuleRecord);
|
||||||
|
|
||||||
|
ScriptLoader* Loader() const { return mLoader; }
|
||||||
|
JSObject* ModuleRecord() const { return mModuleRecord; }
|
||||||
|
JS::Value Exception() const { return mException; }
|
||||||
|
nsIURI* BaseURL() const { return mBaseURL; }
|
||||||
|
|
||||||
|
void SetInstantiationResult(JS::Handle<JS::Value> aMaybeException);
|
||||||
|
bool IsUninstantiated() const {
|
||||||
|
return mInstantiationState == Uninstantiated;
|
||||||
|
}
|
||||||
|
bool IsInstantiated() const {
|
||||||
|
return mInstantiationState == Instantiated;
|
||||||
|
}
|
||||||
|
bool InstantiationFailed() const {
|
||||||
|
return mInstantiationState == Errored;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnlinkModuleRecord();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
||||||
|
|
||||||
|
#endif // mozilla_dom_ModuleScript_h
|
||||||
|
|
@ -4,13 +4,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "nsScriptElement.h"
|
#include "ScriptElement.h"
|
||||||
|
#include "ScriptLoader.h"
|
||||||
#include "mozilla/BasicEvents.h"
|
#include "mozilla/BasicEvents.h"
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsPresContext.h"
|
#include "nsPresContext.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsContentSink.h"
|
#include "nsContentSink.h"
|
||||||
|
|
@ -19,7 +19,7 @@ using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsScriptElement::ScriptAvailable(nsresult aResult,
|
ScriptElement::ScriptAvailable(nsresult aResult,
|
||||||
nsIScriptElement *aElement,
|
nsIScriptElement *aElement,
|
||||||
bool aIsInline,
|
bool aIsInline,
|
||||||
nsIURI *aURI,
|
nsIURI *aURI,
|
||||||
|
|
@ -40,7 +40,7 @@ nsScriptElement::ScriptAvailable(nsresult aResult,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ nsresult
|
/* virtual */ nsresult
|
||||||
nsScriptElement::FireErrorEvent()
|
ScriptElement::FireErrorEvent()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIContent> cont =
|
nsCOMPtr<nsIContent> cont =
|
||||||
do_QueryInterface((nsIScriptElement*) this);
|
do_QueryInterface((nsIScriptElement*) this);
|
||||||
|
|
@ -53,7 +53,7 @@ nsScriptElement::FireErrorEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsScriptElement::ScriptEvaluated(nsresult aResult,
|
ScriptElement::ScriptEvaluated(nsresult aResult,
|
||||||
nsIScriptElement *aElement,
|
nsIScriptElement *aElement,
|
||||||
bool aIsInline)
|
bool aIsInline)
|
||||||
{
|
{
|
||||||
|
|
@ -78,7 +78,7 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::CharacterDataChanged(nsIDocument *aDocument,
|
ScriptElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
CharacterDataChangeInfo* aInfo)
|
CharacterDataChangeInfo* aInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -86,7 +86,7 @@ nsScriptElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::AttributeChanged(nsIDocument* aDocument,
|
ScriptElement::AttributeChanged(nsIDocument* aDocument,
|
||||||
Element* aElement,
|
Element* aElement,
|
||||||
int32_t aNameSpaceID,
|
int32_t aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
|
|
@ -97,7 +97,7 @@ nsScriptElement::AttributeChanged(nsIDocument* aDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::ContentAppended(nsIDocument* aDocument,
|
ScriptElement::ContentAppended(nsIDocument* aDocument,
|
||||||
nsIContent* aContainer,
|
nsIContent* aContainer,
|
||||||
nsIContent* aFirstNewContent,
|
nsIContent* aFirstNewContent,
|
||||||
int32_t aNewIndexInContainer)
|
int32_t aNewIndexInContainer)
|
||||||
|
|
@ -106,7 +106,7 @@ nsScriptElement::ContentAppended(nsIDocument* aDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::ContentInserted(nsIDocument *aDocument,
|
ScriptElement::ContentInserted(nsIDocument *aDocument,
|
||||||
nsIContent* aContainer,
|
nsIContent* aContainer,
|
||||||
nsIContent* aChild,
|
nsIContent* aChild,
|
||||||
int32_t aIndexInContainer)
|
int32_t aIndexInContainer)
|
||||||
|
|
@ -115,7 +115,7 @@ nsScriptElement::ContentInserted(nsIDocument *aDocument,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsScriptElement::MaybeProcessScript()
|
ScriptElement::MaybeProcessScript()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIContent> cont =
|
nsCOMPtr<nsIContent> cont =
|
||||||
do_QueryInterface((nsIScriptElement*) this);
|
do_QueryInterface((nsIScriptElement*) this);
|
||||||
|
|
@ -145,6 +145,6 @@ nsScriptElement::MaybeProcessScript()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsScriptLoader> loader = ownerDoc->ScriptLoader();
|
RefPtr<ScriptLoader> loader = ownerDoc->ScriptLoader();
|
||||||
return loader->ProcessScriptElement(this);
|
return loader->ProcessScriptElement(this);
|
||||||
}
|
}
|
||||||
|
|
@ -4,21 +4,24 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef nsScriptElement_h
|
#ifndef mozilla_dom_ScriptElement_h
|
||||||
#define nsScriptElement_h
|
#define mozilla_dom_ScriptElement_h
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsIScriptLoaderObserver.h"
|
#include "nsIScriptLoaderObserver.h"
|
||||||
#include "nsIScriptElement.h"
|
#include "nsIScriptElement.h"
|
||||||
#include "nsStubMutationObserver.h"
|
#include "nsStubMutationObserver.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Baseclass useful for script elements (such as <xhtml:script> and
|
* Baseclass useful for script elements (such as <xhtml:script> and
|
||||||
* <svg:script>). Currently the class assumes that only the 'src'
|
* <svg:script>). Currently the class assumes that only the 'src'
|
||||||
* attribute and the children of the class affect what script to execute.
|
* attribute and the children of the class affect what script to execute.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class nsScriptElement : public nsIScriptElement,
|
class ScriptElement : public nsIScriptElement,
|
||||||
public nsStubMutationObserver
|
public nsStubMutationObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -31,7 +34,7 @@ public:
|
||||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
||||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||||
|
|
||||||
explicit nsScriptElement(mozilla::dom::FromParser aFromParser)
|
explicit ScriptElement(FromParser aFromParser)
|
||||||
: nsIScriptElement(aFromParser)
|
: nsIScriptElement(aFromParser)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -49,4 +52,7 @@ protected:
|
||||||
virtual bool MaybeProcessScript() override;
|
virtual bool MaybeProcessScript() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsScriptElement_h
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
||||||
|
|
||||||
|
#endif // mozilla_dom_ScriptElement_h
|
||||||
216
dom/script/ScriptLoadHandler.cpp
Normal file
216
dom/script/ScriptLoadHandler.cpp
Normal file
|
|
@ -0,0 +1,216 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A class that handles loading and evaluation of <script> elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ScriptLoadHandler.h"
|
||||||
|
#include "ScriptLoader.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
#include "mozilla/dom/EncodingUtils.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
ScriptLoadHandler::ScriptLoadHandler(ScriptLoader *aScriptLoader,
|
||||||
|
ScriptLoadRequest *aRequest,
|
||||||
|
mozilla::dom::SRICheckDataVerifier *aSRIDataVerifier)
|
||||||
|
: mScriptLoader(aScriptLoader),
|
||||||
|
mRequest(aRequest),
|
||||||
|
mSRIDataVerifier(aSRIDataVerifier),
|
||||||
|
mSRIStatus(NS_OK),
|
||||||
|
mDecoder(),
|
||||||
|
mBuffer()
|
||||||
|
{}
|
||||||
|
|
||||||
|
ScriptLoadHandler::~ScriptLoadHandler()
|
||||||
|
{}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS(ScriptLoadHandler, nsIIncrementalStreamLoaderObserver)
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ScriptLoadHandler::OnIncrementalData(nsIIncrementalStreamLoader* aLoader,
|
||||||
|
nsISupports* aContext,
|
||||||
|
uint32_t aDataLength,
|
||||||
|
const uint8_t* aData,
|
||||||
|
uint32_t *aConsumedLength)
|
||||||
|
{
|
||||||
|
if (mRequest->IsCanceled()) {
|
||||||
|
// If request cancelled, ignore any incoming data.
|
||||||
|
*aConsumedLength = aDataLength;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EnsureDecoder(aLoader, aData, aDataLength,
|
||||||
|
/* aEndOfStream = */ false)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Below we will/shall consume entire data chunk.
|
||||||
|
*aConsumedLength = aDataLength;
|
||||||
|
|
||||||
|
// Decoder has already been initialized. -- trying to decode all loaded bytes.
|
||||||
|
nsresult rv = TryDecodeRawData(aData, aDataLength,
|
||||||
|
/* aEndOfStream = */ false);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
// If SRI is required for this load, appending new bytes to the hash.
|
||||||
|
if (mSRIDataVerifier && NS_SUCCEEDED(mSRIStatus)) {
|
||||||
|
mSRIStatus = mSRIDataVerifier->Update(aDataLength, aData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
ScriptLoadHandler::TryDecodeRawData(const uint8_t* aData,
|
||||||
|
uint32_t aDataLength,
|
||||||
|
bool aEndOfStream)
|
||||||
|
{
|
||||||
|
int32_t srcLen = aDataLength;
|
||||||
|
const char* src = reinterpret_cast<const char *>(aData);
|
||||||
|
int32_t dstLen;
|
||||||
|
nsresult rv =
|
||||||
|
mDecoder->GetMaxLength(src, srcLen, &dstLen);
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
uint32_t haveRead = mBuffer.length();
|
||||||
|
|
||||||
|
CheckedInt<uint32_t> capacity = haveRead;
|
||||||
|
capacity += dstLen;
|
||||||
|
|
||||||
|
if (!capacity.isValid() || !mBuffer.reserve(capacity.value())) {
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = mDecoder->Convert(src,
|
||||||
|
&srcLen,
|
||||||
|
mBuffer.begin() + haveRead,
|
||||||
|
&dstLen);
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
haveRead += dstLen;
|
||||||
|
MOZ_ASSERT(haveRead <= capacity.value(), "mDecoder produced more data than expected");
|
||||||
|
MOZ_ALWAYS_TRUE(mBuffer.resizeUninitialized(haveRead));
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ScriptLoadHandler::EnsureDecoder(nsIIncrementalStreamLoader *aLoader,
|
||||||
|
const uint8_t* aData,
|
||||||
|
uint32_t aDataLength,
|
||||||
|
bool aEndOfStream)
|
||||||
|
{
|
||||||
|
// Check if decoder has already been created.
|
||||||
|
if (mDecoder) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsAutoCString charset;
|
||||||
|
|
||||||
|
// JavaScript modules are always UTF-8.
|
||||||
|
if (mRequest->IsModuleRequest()) {
|
||||||
|
charset = "UTF-8";
|
||||||
|
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if BOM check should be done. This occurs either
|
||||||
|
// if end-of-stream has been reached, or at least 3 bytes have
|
||||||
|
// been read from input.
|
||||||
|
if (!aEndOfStream && (aDataLength < 3)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do BOM detection.
|
||||||
|
if (nsContentUtils::CheckForBOM(aData, aDataLength, charset)) {
|
||||||
|
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BOM detection failed, check content stream for charset.
|
||||||
|
nsCOMPtr<nsIRequest> req;
|
||||||
|
nsresult rv = aLoader->GetRequest(getter_AddRefs(req));
|
||||||
|
NS_ASSERTION(req, "StreamLoader's request went away prematurely");
|
||||||
|
NS_ENSURE_SUCCESS(rv, false);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIChannel> channel = do_QueryInterface(req);
|
||||||
|
|
||||||
|
if (channel &&
|
||||||
|
NS_SUCCEEDED(channel->GetContentCharset(charset)) &&
|
||||||
|
EncodingUtils::FindEncodingForLabel(charset, charset)) {
|
||||||
|
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the hint charset from the script element or preload
|
||||||
|
// request.
|
||||||
|
nsAutoString hintCharset;
|
||||||
|
if (!mRequest->IsPreload()) {
|
||||||
|
mRequest->mElement->GetScriptCharset(hintCharset);
|
||||||
|
} else {
|
||||||
|
nsTArray<ScriptLoader::PreloadInfo>::index_type i =
|
||||||
|
mScriptLoader->mPreloads.IndexOf(mRequest, 0,
|
||||||
|
ScriptLoader::PreloadRequestComparator());
|
||||||
|
|
||||||
|
NS_ASSERTION(i != mScriptLoader->mPreloads.NoIndex,
|
||||||
|
"Incorrect preload bookkeeping");
|
||||||
|
hintCharset = mScriptLoader->mPreloads[i].mCharset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EncodingUtils::FindEncodingForLabel(hintCharset, charset)) {
|
||||||
|
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the charset from the charset of the document.
|
||||||
|
if (mScriptLoader->mDocument) {
|
||||||
|
charset = mScriptLoader->mDocument->GetDocumentCharacterSet();
|
||||||
|
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Curiously, there are various callers that don't pass aDocument. The
|
||||||
|
// fallback in the old code was ISO-8859-1, which behaved like
|
||||||
|
// windows-1252. Saying windows-1252 for clarity and for compliance
|
||||||
|
// with the Encoding Standard.
|
||||||
|
charset = "windows-1252";
|
||||||
|
mDecoder = EncodingUtils::DecoderForEncoding(charset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
ScriptLoadHandler::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
||||||
|
nsISupports* aContext,
|
||||||
|
nsresult aStatus,
|
||||||
|
uint32_t aDataLength,
|
||||||
|
const uint8_t* aData)
|
||||||
|
{
|
||||||
|
if (!mRequest->IsCanceled()) {
|
||||||
|
DebugOnly<bool> encoderSet =
|
||||||
|
EnsureDecoder(aLoader, aData, aDataLength, /* aEndOfStream = */ true);
|
||||||
|
MOZ_ASSERT(encoderSet);
|
||||||
|
DebugOnly<nsresult> rv = TryDecodeRawData(aData, aDataLength,
|
||||||
|
/* aEndOfStream = */ true);
|
||||||
|
|
||||||
|
// If SRI is required for this load, appending new bytes to the hash.
|
||||||
|
if (mSRIDataVerifier && NS_SUCCEEDED(mSRIStatus)) {
|
||||||
|
mSRIStatus = mSRIDataVerifier->Update(aDataLength, aData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we have to mediate and use mRequest.
|
||||||
|
return mScriptLoader->OnStreamComplete(aLoader, mRequest, aStatus, mSRIStatus,
|
||||||
|
mBuffer, mSRIDataVerifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // dom namespace
|
||||||
|
} // mozilla namespace
|
||||||
76
dom/script/ScriptLoadHandler.h
Normal file
76
dom/script/ScriptLoadHandler.h
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A class that handles loading and evaluation of <script> elements.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef mozilla_dom_ScriptLoadHandler_h
|
||||||
|
#define mozilla_dom_ScriptLoadHandler_h
|
||||||
|
|
||||||
|
#include "nsIIncrementalStreamLoader.h"
|
||||||
|
#include "nsIUnicodeDecoder.h"
|
||||||
|
#include "nsAutoPtr.h"
|
||||||
|
#include "mozilla/Vector.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class ScriptLoadRequest;
|
||||||
|
class ScriptLoader;
|
||||||
|
class SRICheckDataVerifier;
|
||||||
|
|
||||||
|
class ScriptLoadHandler final : public nsIIncrementalStreamLoaderObserver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ScriptLoadHandler(ScriptLoader* aScriptLoader,
|
||||||
|
ScriptLoadRequest* aRequest,
|
||||||
|
SRICheckDataVerifier* aSRIDataVerifier);
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
NS_DECL_NSIINCREMENTALSTREAMLOADEROBSERVER
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual ~ScriptLoadHandler();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to decode some raw data.
|
||||||
|
*/
|
||||||
|
nsresult TryDecodeRawData(const uint8_t* aData, uint32_t aDataLength,
|
||||||
|
bool aEndOfStream);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Discover the charset by looking at the stream data, the script
|
||||||
|
* tag, and other indicators. Returns true if charset has been
|
||||||
|
* discovered.
|
||||||
|
*/
|
||||||
|
bool EnsureDecoder(nsIIncrementalStreamLoader *aLoader,
|
||||||
|
const uint8_t* aData, uint32_t aDataLength,
|
||||||
|
bool aEndOfStream);
|
||||||
|
|
||||||
|
// ScriptLoader which will handle the parsed script.
|
||||||
|
RefPtr<ScriptLoader> mScriptLoader;
|
||||||
|
|
||||||
|
// The ScriptLoadRequest for this load.
|
||||||
|
RefPtr<ScriptLoadRequest> mRequest;
|
||||||
|
|
||||||
|
// SRI data verifier.
|
||||||
|
nsAutoPtr<SRICheckDataVerifier> mSRIDataVerifier;
|
||||||
|
|
||||||
|
// Status of SRI data operations.
|
||||||
|
nsresult mSRIStatus;
|
||||||
|
|
||||||
|
// Unicode decoder for charset.
|
||||||
|
nsCOMPtr<nsIUnicodeDecoder> mDecoder;
|
||||||
|
|
||||||
|
// Accumulated decoded char buffer.
|
||||||
|
mozilla::Vector<char16_t> mBuffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif //mozilla_dom_ScriptLoader_h
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,12 +4,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/*
|
#ifndef mozilla_dom_ScriptLoader_h
|
||||||
* A class that handles loading and evaluation of <script> elements.
|
#define mozilla_dom_ScriptLoader_h
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __nsScriptLoader_h__
|
|
||||||
#define __nsScriptLoader_h__
|
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
|
|
@ -25,14 +21,10 @@
|
||||||
#include "mozilla/CORSMode.h"
|
#include "mozilla/CORSMode.h"
|
||||||
#include "mozilla/dom/SRIMetadata.h"
|
#include "mozilla/dom/SRIMetadata.h"
|
||||||
#include "mozilla/dom/SRICheck.h"
|
#include "mozilla/dom/SRICheck.h"
|
||||||
#include "mozilla/LinkedList.h"
|
|
||||||
#include "mozilla/MozPromise.h"
|
#include "mozilla/MozPromise.h"
|
||||||
#include "mozilla/net/ReferrerPolicy.h"
|
#include "mozilla/net/ReferrerPolicy.h"
|
||||||
#include "mozilla/Vector.h"
|
#include "mozilla/Vector.h"
|
||||||
|
|
||||||
class nsModuleLoadRequest;
|
|
||||||
class nsModuleScript;
|
|
||||||
class nsScriptLoadRequestList;
|
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
|
|
||||||
namespace JS {
|
namespace JS {
|
||||||
|
|
@ -41,33 +33,35 @@ namespace JS {
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
class AutoJSAPI;
|
class AutoJSAPI;
|
||||||
} // namespace dom
|
class ModuleLoadRequest;
|
||||||
} // namespace mozilla
|
class ModuleScript;
|
||||||
|
class ScriptLoadRequestList;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Per-request data structure
|
// Per-request data structure
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
enum class nsScriptKind {
|
enum class ScriptKind {
|
||||||
Classic,
|
Classic,
|
||||||
Module
|
Module
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsScriptLoadRequest : public nsISupports,
|
class ScriptLoadRequest : public nsISupports,
|
||||||
private mozilla::LinkedListElement<nsScriptLoadRequest>
|
private mozilla::LinkedListElement<ScriptLoadRequest>
|
||||||
{
|
{
|
||||||
typedef LinkedListElement<nsScriptLoadRequest> super;
|
typedef LinkedListElement<ScriptLoadRequest> super;
|
||||||
|
|
||||||
// Allow LinkedListElement<nsScriptLoadRequest> to cast us to itself as needed.
|
// Allow LinkedListElement<ScriptLoadRequest> to cast us to itself as needed.
|
||||||
friend class mozilla::LinkedListElement<nsScriptLoadRequest>;
|
friend class mozilla::LinkedListElement<ScriptLoadRequest>;
|
||||||
friend class nsScriptLoadRequestList;
|
friend class ScriptLoadRequestList;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsScriptLoadRequest();
|
virtual ~ScriptLoadRequest();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsScriptLoadRequest(nsScriptKind aKind,
|
ScriptLoadRequest(ScriptKind aKind,
|
||||||
nsIScriptElement* aElement,
|
nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
uint32_t aVersion,
|
||||||
mozilla::CORSMode aCORSMode,
|
mozilla::CORSMode aCORSMode,
|
||||||
|
|
@ -95,14 +89,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsScriptLoadRequest)
|
NS_DECL_CYCLE_COLLECTION_CLASS(ScriptLoadRequest)
|
||||||
|
|
||||||
bool IsModuleRequest() const
|
bool IsModuleRequest() const
|
||||||
{
|
{
|
||||||
return mKind == nsScriptKind::Module;
|
return mKind == ScriptKind::Module;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsModuleLoadRequest* AsModuleRequest();
|
ModuleLoadRequest* AsModuleRequest();
|
||||||
|
|
||||||
void FireScriptAvailable(nsresult aResult)
|
void FireScriptAvailable(nsresult aResult)
|
||||||
{
|
{
|
||||||
|
|
@ -154,7 +148,7 @@ public:
|
||||||
using super::getNext;
|
using super::getNext;
|
||||||
using super::isInList;
|
using super::isInList;
|
||||||
|
|
||||||
const nsScriptKind mKind;
|
const ScriptKind mKind;
|
||||||
nsCOMPtr<nsIScriptElement> mElement;
|
nsCOMPtr<nsIScriptElement> mElement;
|
||||||
Progress mProgress; // Are we still waiting for a load to complete?
|
Progress mProgress; // Are we still waiting for a load to complete?
|
||||||
bool mIsInline; // Is the script inline or loaded?
|
bool mIsInline; // Is the script inline or loaded?
|
||||||
|
|
@ -179,23 +173,23 @@ public:
|
||||||
mozilla::net::ReferrerPolicy mReferrerPolicy;
|
mozilla::net::ReferrerPolicy mReferrerPolicy;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsScriptLoadRequestList : private mozilla::LinkedList<nsScriptLoadRequest>
|
class ScriptLoadRequestList : private mozilla::LinkedList<ScriptLoadRequest>
|
||||||
{
|
{
|
||||||
typedef mozilla::LinkedList<nsScriptLoadRequest> super;
|
typedef mozilla::LinkedList<ScriptLoadRequest> super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~nsScriptLoadRequestList();
|
~ScriptLoadRequestList();
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool Contains(nsScriptLoadRequest* aElem) const;
|
bool Contains(ScriptLoadRequest* aElem) const;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
using super::getFirst;
|
using super::getFirst;
|
||||||
using super::isEmpty;
|
using super::isEmpty;
|
||||||
|
|
||||||
void AppendElement(nsScriptLoadRequest* aElem)
|
void AppendElement(ScriptLoadRequest* aElem)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!aElem->isInList());
|
MOZ_ASSERT(!aElem->isInList());
|
||||||
NS_ADDREF(aElem);
|
NS_ADDREF(aElem);
|
||||||
|
|
@ -203,36 +197,37 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_MUST_USE
|
MOZ_MUST_USE
|
||||||
already_AddRefed<nsScriptLoadRequest> Steal(nsScriptLoadRequest* aElem)
|
already_AddRefed<ScriptLoadRequest> Steal(ScriptLoadRequest* aElem)
|
||||||
{
|
{
|
||||||
aElem->removeFrom(*this);
|
aElem->removeFrom(*this);
|
||||||
return dont_AddRef(aElem);
|
return dont_AddRef(aElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_MUST_USE
|
MOZ_MUST_USE
|
||||||
already_AddRefed<nsScriptLoadRequest> StealFirst()
|
already_AddRefed<ScriptLoadRequest> StealFirst()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!isEmpty());
|
MOZ_ASSERT(!isEmpty());
|
||||||
return Steal(getFirst());
|
return Steal(getFirst());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Remove(nsScriptLoadRequest* aElem)
|
void Remove(ScriptLoadRequest* aElem)
|
||||||
{
|
{
|
||||||
aElem->removeFrom(*this);
|
aElem->removeFrom(*this);
|
||||||
NS_RELEASE(aElem);
|
NS_RELEASE(aElem);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
class ScriptLoadHandler;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Script loader implementation
|
// Script loader implementation
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class nsScriptLoader final : public nsISupports
|
class ScriptLoader final : public nsISupports
|
||||||
{
|
{
|
||||||
class MOZ_STACK_CLASS AutoCurrentScriptUpdater
|
class MOZ_STACK_CLASS AutoCurrentScriptUpdater
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoCurrentScriptUpdater(nsScriptLoader* aScriptLoader,
|
AutoCurrentScriptUpdater(ScriptLoader* aScriptLoader,
|
||||||
nsIScriptElement* aCurrentScript)
|
nsIScriptElement* aCurrentScript)
|
||||||
: mOldScript(aScriptLoader->mCurrentScript)
|
: mOldScript(aScriptLoader->mCurrentScript)
|
||||||
, mScriptLoader(aScriptLoader)
|
, mScriptLoader(aScriptLoader)
|
||||||
|
|
@ -245,19 +240,19 @@ class nsScriptLoader final : public nsISupports
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIScriptElement> mOldScript;
|
nsCOMPtr<nsIScriptElement> mOldScript;
|
||||||
nsScriptLoader* mScriptLoader;
|
ScriptLoader* mScriptLoader;
|
||||||
};
|
};
|
||||||
|
|
||||||
friend class nsModuleLoadRequest;
|
friend class ModuleLoadRequest;
|
||||||
friend class nsScriptRequestProcessor;
|
friend class ScriptRequestProcessor;
|
||||||
friend class nsScriptLoadHandler;
|
friend class ScriptLoadHandler;
|
||||||
friend class AutoCurrentScriptUpdater;
|
friend class AutoCurrentScriptUpdater;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit nsScriptLoader(nsIDocument* aDocument);
|
explicit ScriptLoader(nsIDocument* aDocument);
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsScriptLoader)
|
NS_DECL_CYCLE_COLLECTION_CLASS(ScriptLoader)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The loader maintains a weak reference to the document with
|
* The loader maintains a weak reference to the document with
|
||||||
|
|
@ -395,7 +390,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the completion of a stream. This is called by the
|
* Handle the completion of a stream. This is called by the
|
||||||
* nsScriptLoadHandler object which observes the IncrementalStreamLoader
|
* ScriptLoadHandler object which observes the IncrementalStreamLoader
|
||||||
* loading the script.
|
* loading the script.
|
||||||
*/
|
*/
|
||||||
nsresult OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
nsresult OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
||||||
|
|
@ -463,17 +458,17 @@ public:
|
||||||
* Process a request that was deferred so that the script could be compiled
|
* Process a request that was deferred so that the script could be compiled
|
||||||
* off thread.
|
* off thread.
|
||||||
*/
|
*/
|
||||||
nsresult ProcessOffThreadRequest(nsScriptLoadRequest *aRequest);
|
nsresult ProcessOffThreadRequest(ScriptLoadRequest *aRequest);
|
||||||
|
|
||||||
bool AddPendingChildLoader(nsScriptLoader* aChild) {
|
bool AddPendingChildLoader(ScriptLoader* aChild) {
|
||||||
return mPendingChildLoaders.AppendElement(aChild) != nullptr;
|
return mPendingChildLoaders.AppendElement(aChild) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~nsScriptLoader();
|
virtual ~ScriptLoader();
|
||||||
|
|
||||||
nsScriptLoadRequest* CreateLoadRequest(
|
ScriptLoadRequest* CreateLoadRequest(
|
||||||
nsScriptKind aKind,
|
ScriptKind aKind,
|
||||||
nsIScriptElement* aElement,
|
nsIScriptElement* aElement,
|
||||||
uint32_t aVersion,
|
uint32_t aVersion,
|
||||||
mozilla::CORSMode aCORSMode,
|
mozilla::CORSMode aCORSMode,
|
||||||
|
|
@ -482,12 +477,12 @@ private:
|
||||||
/**
|
/**
|
||||||
* Unblocks the creator parser of the parser-blocking scripts.
|
* Unblocks the creator parser of the parser-blocking scripts.
|
||||||
*/
|
*/
|
||||||
void UnblockParser(nsScriptLoadRequest* aParserBlockingRequest);
|
void UnblockParser(ScriptLoadRequest* aParserBlockingRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronously resumes the creator parser of the parser-blocking scripts.
|
* Asynchronously resumes the creator parser of the parser-blocking scripts.
|
||||||
*/
|
*/
|
||||||
void ContinueParserAsync(nsScriptLoadRequest* aParserBlockingRequest);
|
void ContinueParserAsync(ScriptLoadRequest* aParserBlockingRequest);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -502,7 +497,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* Start a load for aRequest's URI.
|
* Start a load for aRequest's URI.
|
||||||
*/
|
*/
|
||||||
nsresult StartLoad(nsScriptLoadRequest *aRequest, const nsAString &aType,
|
nsresult StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType,
|
||||||
bool aScriptFromHead);
|
bool aScriptFromHead);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -539,83 +534,83 @@ private:
|
||||||
return mEnabled && !mBlockerCount;
|
return mEnabled && !mBlockerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult AttemptAsyncScriptCompile(nsScriptLoadRequest* aRequest);
|
nsresult AttemptAsyncScriptCompile(ScriptLoadRequest* aRequest);
|
||||||
nsresult ProcessRequest(nsScriptLoadRequest* aRequest);
|
nsresult ProcessRequest(ScriptLoadRequest* aRequest);
|
||||||
nsresult CompileOffThreadOrProcessRequest(nsScriptLoadRequest* aRequest);
|
nsresult CompileOffThreadOrProcessRequest(ScriptLoadRequest* aRequest);
|
||||||
void FireScriptAvailable(nsresult aResult,
|
void FireScriptAvailable(nsresult aResult,
|
||||||
nsScriptLoadRequest* aRequest);
|
ScriptLoadRequest* aRequest);
|
||||||
void FireScriptEvaluated(nsresult aResult,
|
void FireScriptEvaluated(nsresult aResult,
|
||||||
nsScriptLoadRequest* aRequest);
|
ScriptLoadRequest* aRequest);
|
||||||
nsresult EvaluateScript(nsScriptLoadRequest* aRequest);
|
nsresult EvaluateScript(ScriptLoadRequest* aRequest);
|
||||||
|
|
||||||
already_AddRefed<nsIScriptGlobalObject> GetScriptGlobalObject();
|
already_AddRefed<nsIScriptGlobalObject> GetScriptGlobalObject();
|
||||||
nsresult FillCompileOptionsForRequest(const mozilla::dom::AutoJSAPI& jsapi,
|
nsresult FillCompileOptionsForRequest(const mozilla::dom::AutoJSAPI& jsapi,
|
||||||
nsScriptLoadRequest* aRequest,
|
ScriptLoadRequest* aRequest,
|
||||||
JS::Handle<JSObject*> aScopeChain,
|
JS::Handle<JSObject*> aScopeChain,
|
||||||
JS::CompileOptions* aOptions);
|
JS::CompileOptions* aOptions);
|
||||||
|
|
||||||
uint32_t NumberOfProcessors();
|
uint32_t NumberOfProcessors();
|
||||||
nsresult PrepareLoadedRequest(nsScriptLoadRequest* aRequest,
|
nsresult PrepareLoadedRequest(ScriptLoadRequest* aRequest,
|
||||||
nsIIncrementalStreamLoader* aLoader,
|
nsIIncrementalStreamLoader* aLoader,
|
||||||
nsresult aStatus,
|
nsresult aStatus,
|
||||||
mozilla::Vector<char16_t> &aString);
|
mozilla::Vector<char16_t> &aString);
|
||||||
|
|
||||||
void AddDeferRequest(nsScriptLoadRequest* aRequest);
|
void AddDeferRequest(ScriptLoadRequest* aRequest);
|
||||||
bool MaybeRemovedDeferRequests();
|
bool MaybeRemovedDeferRequests();
|
||||||
|
|
||||||
void MaybeMoveToLoadedList(nsScriptLoadRequest* aRequest);
|
void MaybeMoveToLoadedList(ScriptLoadRequest* aRequest);
|
||||||
|
|
||||||
JS::SourceBufferHolder GetScriptSource(nsScriptLoadRequest* aRequest,
|
JS::SourceBufferHolder GetScriptSource(ScriptLoadRequest* aRequest,
|
||||||
nsAutoString& inlineData);
|
nsAutoString& inlineData);
|
||||||
|
|
||||||
bool ModuleScriptsEnabled();
|
bool ModuleScriptsEnabled();
|
||||||
|
|
||||||
void SetModuleFetchStarted(nsModuleLoadRequest *aRequest);
|
void SetModuleFetchStarted(ModuleLoadRequest *aRequest);
|
||||||
void SetModuleFetchFinishedAndResumeWaitingRequests(nsModuleLoadRequest *aRequest,
|
void SetModuleFetchFinishedAndResumeWaitingRequests(ModuleLoadRequest *aRequest,
|
||||||
nsresult aResult);
|
nsresult aResult);
|
||||||
|
|
||||||
bool IsFetchingModule(nsModuleLoadRequest *aRequest) const;
|
bool IsFetchingModule(ModuleLoadRequest *aRequest) const;
|
||||||
|
|
||||||
bool ModuleMapContainsModule(nsModuleLoadRequest *aRequest) const;
|
bool ModuleMapContainsModule(ModuleLoadRequest *aRequest) const;
|
||||||
RefPtr<mozilla::GenericPromise> WaitForModuleFetch(nsModuleLoadRequest *aRequest);
|
RefPtr<mozilla::GenericPromise> WaitForModuleFetch(ModuleLoadRequest *aRequest);
|
||||||
nsModuleScript* GetFetchedModule(nsIURI* aURL) const;
|
ModuleScript* GetFetchedModule(nsIURI* aURL) const;
|
||||||
|
|
||||||
friend bool
|
friend bool
|
||||||
HostResolveImportedModule(JSContext* aCx, unsigned argc, JS::Value* vp);
|
HostResolveImportedModule(JSContext* aCx, unsigned argc, JS::Value* vp);
|
||||||
|
|
||||||
nsresult CreateModuleScript(nsModuleLoadRequest* aRequest);
|
nsresult CreateModuleScript(ModuleLoadRequest* aRequest);
|
||||||
nsresult ProcessFetchedModuleSource(nsModuleLoadRequest* aRequest);
|
nsresult ProcessFetchedModuleSource(ModuleLoadRequest* aRequest);
|
||||||
void ProcessLoadedModuleTree(nsModuleLoadRequest* aRequest);
|
void ProcessLoadedModuleTree(ModuleLoadRequest* aRequest);
|
||||||
bool InstantiateModuleTree(nsModuleLoadRequest* aRequest);
|
bool InstantiateModuleTree(ModuleLoadRequest* aRequest);
|
||||||
void StartFetchingModuleDependencies(nsModuleLoadRequest* aRequest);
|
void StartFetchingModuleDependencies(ModuleLoadRequest* aRequest);
|
||||||
|
|
||||||
RefPtr<mozilla::GenericPromise>
|
RefPtr<mozilla::GenericPromise>
|
||||||
StartFetchingModuleAndDependencies(nsModuleLoadRequest* aRequest, nsIURI* aURI);
|
StartFetchingModuleAndDependencies(ModuleLoadRequest* aRequest, nsIURI* aURI);
|
||||||
|
|
||||||
nsIDocument* mDocument; // [WEAK]
|
nsIDocument* mDocument; // [WEAK]
|
||||||
nsCOMArray<nsIScriptLoaderObserver> mObservers;
|
nsCOMArray<nsIScriptLoaderObserver> mObservers;
|
||||||
nsScriptLoadRequestList mNonAsyncExternalScriptInsertedRequests;
|
ScriptLoadRequestList mNonAsyncExternalScriptInsertedRequests;
|
||||||
// mLoadingAsyncRequests holds async requests while they're loading; when they
|
// mLoadingAsyncRequests holds async requests while they're loading; when they
|
||||||
// have been loaded they are moved to mLoadedAsyncRequests.
|
// have been loaded they are moved to mLoadedAsyncRequests.
|
||||||
nsScriptLoadRequestList mLoadingAsyncRequests;
|
ScriptLoadRequestList mLoadingAsyncRequests;
|
||||||
nsScriptLoadRequestList mLoadedAsyncRequests;
|
ScriptLoadRequestList mLoadedAsyncRequests;
|
||||||
nsScriptLoadRequestList mDeferRequests;
|
ScriptLoadRequestList mDeferRequests;
|
||||||
nsScriptLoadRequestList mXSLTRequests;
|
ScriptLoadRequestList mXSLTRequests;
|
||||||
RefPtr<nsScriptLoadRequest> mParserBlockingRequest;
|
RefPtr<ScriptLoadRequest> mParserBlockingRequest;
|
||||||
|
|
||||||
// In mRequests, the additional information here is stored by the element.
|
// In mRequests, the additional information here is stored by the element.
|
||||||
struct PreloadInfo {
|
struct PreloadInfo {
|
||||||
RefPtr<nsScriptLoadRequest> mRequest;
|
RefPtr<ScriptLoadRequest> mRequest;
|
||||||
nsString mCharset;
|
nsString mCharset;
|
||||||
};
|
};
|
||||||
|
|
||||||
friend void ImplCycleCollectionUnlink(nsScriptLoader::PreloadInfo& aField);
|
friend void ImplCycleCollectionUnlink(ScriptLoader::PreloadInfo& aField);
|
||||||
friend void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
friend void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
|
||||||
nsScriptLoader::PreloadInfo& aField,
|
ScriptLoader::PreloadInfo& aField,
|
||||||
const char* aName, uint32_t aFlags);
|
const char* aName, uint32_t aFlags);
|
||||||
|
|
||||||
struct PreloadRequestComparator {
|
struct PreloadRequestComparator {
|
||||||
bool Equals(const PreloadInfo &aPi, nsScriptLoadRequest * const &aRequest)
|
bool Equals(const PreloadInfo &aPi, ScriptLoadRequest * const &aRequest)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return aRequest == aPi.mRequest;
|
return aRequest == aPi.mRequest;
|
||||||
|
|
@ -628,7 +623,7 @@ private:
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptElement> mCurrentScript;
|
nsCOMPtr<nsIScriptElement> mCurrentScript;
|
||||||
nsCOMPtr<nsIScriptElement> mCurrentParserInsertedScript;
|
nsCOMPtr<nsIScriptElement> mCurrentParserInsertedScript;
|
||||||
nsTArray< RefPtr<nsScriptLoader> > mPendingChildLoaders;
|
nsTArray< RefPtr<ScriptLoader> > mPendingChildLoaders;
|
||||||
uint32_t mParserBlockingBlockerCount;
|
uint32_t mParserBlockingBlockerCount;
|
||||||
uint32_t mBlockerCount;
|
uint32_t mBlockerCount;
|
||||||
uint32_t mNumberOfProcessors;
|
uint32_t mNumberOfProcessors;
|
||||||
|
|
@ -639,58 +634,11 @@ private:
|
||||||
|
|
||||||
// Module map
|
// Module map
|
||||||
nsRefPtrHashtable<nsURIHashKey, mozilla::GenericPromise::Private> mFetchingModules;
|
nsRefPtrHashtable<nsURIHashKey, mozilla::GenericPromise::Private> mFetchingModules;
|
||||||
nsRefPtrHashtable<nsURIHashKey, nsModuleScript> mFetchedModules;
|
nsRefPtrHashtable<nsURIHashKey, ModuleScript> mFetchedModules;
|
||||||
|
|
||||||
nsCOMPtr<nsIConsoleReportCollector> mReporter;
|
nsCOMPtr<nsIConsoleReportCollector> mReporter;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsScriptLoadHandler final : public nsIIncrementalStreamLoaderObserver
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit nsScriptLoadHandler(nsScriptLoader* aScriptLoader,
|
|
||||||
nsScriptLoadRequest *aRequest,
|
|
||||||
mozilla::dom::SRICheckDataVerifier *aSRIDataVerifier);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIINCREMENTALSTREAMLOADEROBSERVER
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual ~nsScriptLoadHandler();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Try to decode some raw data.
|
|
||||||
*/
|
|
||||||
nsresult TryDecodeRawData(const uint8_t* aData, uint32_t aDataLength,
|
|
||||||
bool aEndOfStream);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Discover the charset by looking at the stream data, the script
|
|
||||||
* tag, and other indicators. Returns true if charset has been
|
|
||||||
* discovered.
|
|
||||||
*/
|
|
||||||
bool EnsureDecoder(nsIIncrementalStreamLoader *aLoader,
|
|
||||||
const uint8_t* aData, uint32_t aDataLength,
|
|
||||||
bool aEndOfStream);
|
|
||||||
|
|
||||||
// ScriptLoader which will handle the parsed script.
|
|
||||||
RefPtr<nsScriptLoader> mScriptLoader;
|
|
||||||
|
|
||||||
// The nsScriptLoadRequest for this load.
|
|
||||||
RefPtr<nsScriptLoadRequest> mRequest;
|
|
||||||
|
|
||||||
// SRI data verifier.
|
|
||||||
nsAutoPtr<mozilla::dom::SRICheckDataVerifier> mSRIDataVerifier;
|
|
||||||
|
|
||||||
// Status of SRI data operations.
|
|
||||||
nsresult mSRIStatus;
|
|
||||||
|
|
||||||
// Unicode decoder for charset.
|
|
||||||
nsCOMPtr<nsIUnicodeDecoder> mDecoder;
|
|
||||||
|
|
||||||
// Accumulated decoded char buffer.
|
|
||||||
mozilla::Vector<char16_t> mBuffer;
|
|
||||||
};
|
|
||||||
|
|
||||||
class nsAutoScriptLoaderDisabler
|
class nsAutoScriptLoaderDisabler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -711,7 +659,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mWasEnabled;
|
bool mWasEnabled;
|
||||||
RefPtr<nsScriptLoader> mLoader;
|
RefPtr<ScriptLoader> mLoader;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__nsScriptLoader_h__
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif //mozilla_dom_ScriptLoader_h
|
||||||
|
|
@ -485,7 +485,13 @@ AutoJSAPI::Init(nsIGlobalObject* aGlobalObject)
|
||||||
bool
|
bool
|
||||||
AutoJSAPI::Init(JSObject* aObject)
|
AutoJSAPI::Init(JSObject* aObject)
|
||||||
{
|
{
|
||||||
return Init(xpc::NativeGlobal(aObject));
|
nsIGlobalObject* global = nullptr;
|
||||||
|
if (aObject)
|
||||||
|
global = xpc::NativeGlobal(aObject);
|
||||||
|
if (global)
|
||||||
|
return Init(global);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
36
dom/script/moz.build
Normal file
36
dom/script/moz.build
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||||
|
# 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/.
|
||||||
|
|
||||||
|
XPIDL_SOURCES += [
|
||||||
|
'nsIScriptLoaderObserver.idl',
|
||||||
|
]
|
||||||
|
|
||||||
|
XPIDL_MODULE = 'dom'
|
||||||
|
|
||||||
|
EXPORTS += ['nsIScriptElement.h']
|
||||||
|
|
||||||
|
EXPORTS.mozilla.dom += [
|
||||||
|
'ScriptElement.h',
|
||||||
|
'ScriptLoader.h',
|
||||||
|
'ScriptSettings.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
SOURCES += [
|
||||||
|
'ModuleLoadRequest.cpp',
|
||||||
|
'ModuleScript.cpp',
|
||||||
|
'ScriptElement.cpp',
|
||||||
|
'ScriptLoader.cpp',
|
||||||
|
'ScriptLoadHandler.cpp',
|
||||||
|
'ScriptSettings.cpp',
|
||||||
|
]
|
||||||
|
|
||||||
|
LOCAL_INCLUDES += [
|
||||||
|
'/dom/base',
|
||||||
|
'/dom/workers',
|
||||||
|
]
|
||||||
|
|
||||||
|
include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
@ -42,7 +42,7 @@ NS_IMPL_ISUPPORTS_INHERITED(SVGScriptElement, SVGScriptElementBase,
|
||||||
SVGScriptElement::SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
SVGScriptElement::SVGScriptElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
||||||
FromParser aFromParser)
|
FromParser aFromParser)
|
||||||
: SVGScriptElementBase(aNodeInfo)
|
: SVGScriptElementBase(aNodeInfo)
|
||||||
, nsScriptElement(aFromParser)
|
, ScriptElement(aFromParser)
|
||||||
{
|
{
|
||||||
AddMutationObserver(this);
|
AddMutationObserver(this);
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +168,7 @@ SVGScriptElement::FreezeUriAsyncDefer()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsScriptElement methods
|
// ScriptElement methods
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SVGScriptElement::HasScriptContent()
|
SVGScriptElement::HasScriptContent()
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include "nsSVGElement.h"
|
#include "nsSVGElement.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsSVGString.h"
|
#include "nsSVGString.h"
|
||||||
#include "nsScriptElement.h"
|
#include "mozilla/dom/ScriptElement.h"
|
||||||
|
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace dom {
|
||||||
typedef nsSVGElement SVGScriptElementBase;
|
typedef nsSVGElement SVGScriptElementBase;
|
||||||
|
|
||||||
class SVGScriptElement final : public SVGScriptElementBase,
|
class SVGScriptElement final : public SVGScriptElementBase,
|
||||||
public nsScriptElement
|
public ScriptElement
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
friend nsresult (::NS_NewSVGScriptElement(nsIContent **aResult,
|
friend nsresult (::NS_NewSVGScriptElement(nsIContent **aResult,
|
||||||
|
|
@ -47,7 +47,7 @@ public:
|
||||||
virtual void FreezeUriAsyncDefer() override;
|
virtual void FreezeUriAsyncDefer() override;
|
||||||
virtual CORSMode GetCORSMode() const override;
|
virtual CORSMode GetCORSMode() const override;
|
||||||
|
|
||||||
// nsScriptElement
|
// ScriptElement
|
||||||
virtual bool HasScriptContent() override;
|
virtual bool HasScriptContent() override;
|
||||||
|
|
||||||
// nsIContent specializations:
|
// nsIContent specializations:
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
#include "nsIPipe.h"
|
#include "nsIPipe.h"
|
||||||
#include "nsIOutputStream.h"
|
#include "nsIOutputStream.h"
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsStreamUtils.h"
|
#include "nsStreamUtils.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
|
@ -58,6 +57,7 @@
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||||
#include "mozilla/dom/Response.h"
|
#include "mozilla/dom/Response.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "mozilla/dom/SRILogHelper.h"
|
#include "mozilla/dom/SRILogHelper.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
|
|
@ -1075,11 +1075,11 @@ private:
|
||||||
// May be null.
|
// May be null.
|
||||||
nsIDocument* parentDoc = mWorkerPrivate->GetDocument();
|
nsIDocument* parentDoc = mWorkerPrivate->GetDocument();
|
||||||
|
|
||||||
// Use the regular nsScriptLoader for this grunt work! Should be just fine
|
// Use the regular ScriptLoader for this grunt work! Should be just fine
|
||||||
// because we're running on the main thread.
|
// because we're running on the main thread.
|
||||||
// Unlike <script> tags, Worker scripts are always decoded as UTF-8,
|
// Unlike <script> tags, Worker scripts are always decoded as UTF-8,
|
||||||
// per spec. So we explicitly pass in the charset hint.
|
// per spec. So we explicitly pass in the charset hint.
|
||||||
rv = nsScriptLoader::ConvertToUTF16(aLoadInfo.mChannel, aString, aStringLen,
|
rv = ScriptLoader::ConvertToUTF16(aLoadInfo.mChannel, aString, aStringLen,
|
||||||
NS_LITERAL_STRING("UTF-8"), parentDoc,
|
NS_LITERAL_STRING("UTF-8"), parentDoc,
|
||||||
aLoadInfo.mScriptTextBuf,
|
aLoadInfo.mScriptTextBuf,
|
||||||
aLoadInfo.mScriptTextLength);
|
aLoadInfo.mScriptTextLength);
|
||||||
|
|
@ -1289,7 +1289,7 @@ private:
|
||||||
MOZ_ASSERT(!loadInfo.mScriptTextBuf);
|
MOZ_ASSERT(!loadInfo.mScriptTextBuf);
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen,
|
ScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen,
|
||||||
NS_LITERAL_STRING("UTF-8"), parentDoc,
|
NS_LITERAL_STRING("UTF-8"), parentDoc,
|
||||||
loadInfo.mScriptTextBuf,
|
loadInfo.mScriptTextBuf,
|
||||||
loadInfo.mScriptTextLength);
|
loadInfo.mScriptTextLength);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "nsIUploadChannel2.h"
|
#include "nsIUploadChannel2.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
|
|
@ -44,6 +43,7 @@
|
||||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||||
#include "mozilla/dom/Request.h"
|
#include "mozilla/dom/Request.h"
|
||||||
#include "mozilla/dom/RootedDictionary.h"
|
#include "mozilla/dom/RootedDictionary.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/TypedArray.h"
|
#include "mozilla/dom/TypedArray.h"
|
||||||
#include "mozilla/ipc/BackgroundChild.h"
|
#include "mozilla/ipc/BackgroundChild.h"
|
||||||
#include "mozilla/ipc/PBackgroundChild.h"
|
#include "mozilla/ipc/PBackgroundChild.h"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "mozilla/dom/cache/Cache.h"
|
#include "mozilla/dom/cache/Cache.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/ipc/BackgroundUtils.h"
|
#include "mozilla/ipc/BackgroundUtils.h"
|
||||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||||
#include "nsICacheInfoChannel.h"
|
#include "nsICacheInfoChannel.h"
|
||||||
|
|
@ -23,7 +24,6 @@
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "ServiceWorkerManager.h"
|
#include "ServiceWorkerManager.h"
|
||||||
#include "Workers.h"
|
#include "Workers.h"
|
||||||
#include "nsStringStream.h"
|
#include "nsStringStream.h"
|
||||||
|
|
@ -801,7 +801,7 @@ CompareNetwork::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext
|
||||||
char16_t* buffer = nullptr;
|
char16_t* buffer = nullptr;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
rv = nsScriptLoader::ConvertToUTF16(httpChannel, aString, aLen,
|
rv = ScriptLoader::ConvertToUTF16(httpChannel, aString, aLen,
|
||||||
NS_LITERAL_STRING("UTF-8"), nullptr,
|
NS_LITERAL_STRING("UTF-8"), nullptr,
|
||||||
buffer, len);
|
buffer, len);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
@ -855,7 +855,7 @@ CompareCache::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext,
|
||||||
char16_t* buffer = nullptr;
|
char16_t* buffer = nullptr;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
nsresult rv = nsScriptLoader::ConvertToUTF16(nullptr, aString, aLen,
|
nsresult rv = ScriptLoader::ConvertToUTF16(nullptr, aString, aLen,
|
||||||
NS_LITERAL_STRING("UTF-8"),
|
NS_LITERAL_STRING("UTF-8"),
|
||||||
nullptr, buffer, len);
|
nullptr, buffer, len);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@
|
||||||
#include "mozilla/dom/PromiseNativeHandler.h"
|
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||||
#include "mozilla/dom/RegisterWorkletBindings.h"
|
#include "mozilla/dom/RegisterWorkletBindings.h"
|
||||||
#include "mozilla/dom/Response.h"
|
#include "mozilla/dom/Response.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "nsIInputStreamPump.h"
|
#include "nsIInputStreamPump.h"
|
||||||
#include "nsIThreadRetargetableRequest.h"
|
#include "nsIThreadRetargetableRequest.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
@ -171,7 +171,7 @@ public:
|
||||||
char16_t* scriptTextBuf;
|
char16_t* scriptTextBuf;
|
||||||
size_t scriptTextLength;
|
size_t scriptTextLength;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen,
|
ScriptLoader::ConvertToUTF16(nullptr, aString, aStringLen,
|
||||||
NS_LITERAL_STRING("UTF-8"), nullptr,
|
NS_LITERAL_STRING("UTF-8"), nullptr,
|
||||||
scriptTextBuf, scriptTextLength);
|
scriptTextBuf, scriptTextLength);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@
|
||||||
#include "nsRect.h"
|
#include "nsRect.h"
|
||||||
#include "nsIWebNavigation.h"
|
#include "nsIWebNavigation.h"
|
||||||
#include "nsIScriptElement.h"
|
#include "nsIScriptElement.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsStyleLinkElement.h"
|
#include "nsStyleLinkElement.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
|
|
@ -62,6 +61,7 @@
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||||
#include "mozilla/dom/ProcessingInstruction.h"
|
#include "mozilla/dom/ProcessingInstruction.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "mozilla/css/Loader.h"
|
#include "mozilla/css/Loader.h"
|
||||||
#include "mozilla/dom/DocumentFragment.h"
|
#include "mozilla/dom/DocumentFragment.h"
|
||||||
#include "mozilla/dom/ProcessingInstruction.h"
|
#include "mozilla/dom/ProcessingInstruction.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMDocumentType.h"
|
#include "nsIDOMDocumentType.h"
|
||||||
#include "nsIScriptElement.h"
|
#include "nsIScriptElement.h"
|
||||||
|
|
@ -31,6 +30,7 @@
|
||||||
#include "mozilla/css/Loader.h"
|
#include "mozilla/css/Loader.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/EncodingUtils.h"
|
#include "mozilla/dom/EncodingUtils.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "txXMLUtils.h"
|
#include "txXMLUtils.h"
|
||||||
#include "nsContentSink.h"
|
#include "nsContentSink.h"
|
||||||
|
|
@ -230,7 +230,7 @@ txMozillaXMLOutput::endDocument(nsresult aResult)
|
||||||
MOZ_ASSERT(mDocument->GetReadyStateEnum() ==
|
MOZ_ASSERT(mDocument->GetReadyStateEnum() ==
|
||||||
nsIDocument::READYSTATE_LOADING, "Bad readyState");
|
nsIDocument::READYSTATE_LOADING, "Bad readyState");
|
||||||
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_INTERACTIVE);
|
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_INTERACTIVE);
|
||||||
nsScriptLoader* loader = mDocument->ScriptLoader();
|
ScriptLoader* loader = mDocument->ScriptLoader();
|
||||||
if (loader) {
|
if (loader) {
|
||||||
loader->ParsingComplete(false);
|
loader->ParsingComplete(false);
|
||||||
}
|
}
|
||||||
|
|
@ -416,7 +416,7 @@ txMozillaXMLOutput::startDocument()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCreatingNewDocument) {
|
if (mCreatingNewDocument) {
|
||||||
nsScriptLoader* loader = mDocument->ScriptLoader();
|
ScriptLoader* loader = mDocument->ScriptLoader();
|
||||||
if (loader) {
|
if (loader) {
|
||||||
loader->BeginDeferringScripts();
|
loader->BeginDeferringScripts();
|
||||||
}
|
}
|
||||||
|
|
@ -857,7 +857,7 @@ txMozillaXMLOutput::createResultDocument(const nsSubstring& aName, int32_t aNsID
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up script loader of the result document.
|
// Set up script loader of the result document.
|
||||||
nsScriptLoader *loader = mDocument->ScriptLoader();
|
ScriptLoader *loader = mDocument->ScriptLoader();
|
||||||
if (mNotifier) {
|
if (mNotifier) {
|
||||||
loader->AddObserver(mNotifier);
|
loader->AddObserver(mNotifier);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3325,7 +3325,7 @@ XULDocument::OnStreamComplete(nsIStreamLoader* aLoader,
|
||||||
!mOffThreadCompileStringBuf),
|
!mOffThreadCompileStringBuf),
|
||||||
"XULDocument can't load multiple scripts at once");
|
"XULDocument can't load multiple scripts at once");
|
||||||
|
|
||||||
rv = nsScriptLoader::ConvertToUTF16(channel, string, stringLen,
|
rv = ScriptLoader::ConvertToUTF16(channel, string, stringLen,
|
||||||
EmptyString(), this,
|
EmptyString(), this,
|
||||||
mOffThreadCompileStringBuf,
|
mOffThreadCompileStringBuf,
|
||||||
mOffThreadCompileStringLength);
|
mOffThreadCompileStringLength);
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsIXULDocument.h"
|
#include "nsIXULDocument.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIStreamListener.h"
|
#include "nsIStreamListener.h"
|
||||||
#include "nsIStreamLoader.h"
|
#include "nsIStreamLoader.h"
|
||||||
#include "nsICSSLoaderObserver.h"
|
#include "nsICSSLoaderObserver.h"
|
||||||
#include "nsIXULStore.h"
|
#include "nsIXULStore.h"
|
||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
#include "js/TracingAPI.h"
|
#include "js/TracingAPI.h"
|
||||||
#include "js/TypeDecls.h"
|
#include "js/TypeDecls.h"
|
||||||
|
|
|
||||||
|
|
@ -881,7 +881,7 @@ XULContentSinkImpl::OpenScript(const char16_t** aAttributes,
|
||||||
isJavaScript = false;
|
isJavaScript = false;
|
||||||
}
|
}
|
||||||
} else if (key.EqualsLiteral("language")) {
|
} else if (key.EqualsLiteral("language")) {
|
||||||
// Language is deprecated, and the impl in nsScriptLoader ignores the
|
// Language is deprecated, and the impl in ScriptLoader ignores the
|
||||||
// various version strings anyway. So we make no attempt to support
|
// various version strings anyway. So we make no attempt to support
|
||||||
// languages other than JS for language=
|
// languages other than JS for language=
|
||||||
nsAutoString lang(aAttributes[1]);
|
nsAutoString lang(aAttributes[1]);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include "nsNetCID.h"
|
#include "nsNetCID.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsIFileURL.h"
|
#include "nsIFileURL.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
|
|
||||||
|
|
@ -26,6 +25,7 @@
|
||||||
#include "jswrapper.h"
|
#include "jswrapper.h"
|
||||||
|
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/ToJSValue.h"
|
#include "mozilla/dom/ToJSValue.h"
|
||||||
#include "mozilla/HoldDropJSObjects.h"
|
#include "mozilla/HoldDropJSObjects.h"
|
||||||
#include "mozilla/scache/StartupCache.h"
|
#include "mozilla/scache/StartupCache.h"
|
||||||
|
|
@ -139,7 +139,7 @@ PrepareScript(nsIURI* uri,
|
||||||
size_t scriptLength = 0;
|
size_t scriptLength = 0;
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsScriptLoader::ConvertToUTF16(nullptr, reinterpret_cast<const uint8_t*>(buf), len,
|
ScriptLoader::ConvertToUTF16(nullptr, reinterpret_cast<const uint8_t*>(buf), len,
|
||||||
charset, nullptr, scriptBuf, scriptLength);
|
charset, nullptr, scriptBuf, scriptLength);
|
||||||
|
|
||||||
JS::SourceBufferHolder srcBuf(scriptBuf, scriptLength,
|
JS::SourceBufferHolder srcBuf(scriptBuf, scriptLength,
|
||||||
|
|
@ -826,7 +826,7 @@ ScriptPrecompiler::OnStreamComplete(nsIIncrementalStreamLoader* aLoader,
|
||||||
// Convert data to char16_t* and prepare to call CompileOffThread.
|
// Convert data to char16_t* and prepare to call CompileOffThread.
|
||||||
nsAutoString hintCharset;
|
nsAutoString hintCharset;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsScriptLoader::ConvertToUTF16(mChannel, aString, aLength,
|
ScriptLoader::ConvertToUTF16(mChannel, aString, aLength,
|
||||||
hintCharset, nullptr,
|
hintCharset, nullptr,
|
||||||
mScriptBuf, mScriptLength);
|
mScriptBuf, mScriptLength);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,13 @@
|
||||||
#include "nsCCUncollectableMarker.h"
|
#include "nsCCUncollectableMarker.h"
|
||||||
#include "nsCycleCollectionNoteRootCallback.h"
|
#include "nsCycleCollectionNoteRootCallback.h"
|
||||||
#include "nsCycleCollector.h"
|
#include "nsCycleCollector.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jsprf.h"
|
#include "jsprf.h"
|
||||||
#include "js/MemoryMetrics.h"
|
#include "js/MemoryMetrics.h"
|
||||||
#include "mozilla/dom/GeneratedAtomList.h"
|
#include "mozilla/dom/GeneratedAtomList.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/dom/WindowBinding.h"
|
#include "mozilla/dom/WindowBinding.h"
|
||||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||||
#include "mozilla/Atomics.h"
|
#include "mozilla/Atomics.h"
|
||||||
|
|
@ -3035,7 +3035,7 @@ ReadSourceFromFilename(JSContext* cx, const char* filename, char16_t** src, size
|
||||||
ptr += bytesRead;
|
ptr += bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = nsScriptLoader::ConvertToUTF16(scriptChannel, buf.get(), rawLen, EmptyString(),
|
rv = ScriptLoader::ConvertToUTF16(scriptChannel, buf.get(), rawLen, EmptyString(),
|
||||||
nullptr, *src, *len);
|
nullptr, *src, *len);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
#include "nsIStyleSheetLinkingElement.h"
|
#include "nsIStyleSheetLinkingElement.h"
|
||||||
#include "nsStyleLinkElement.h"
|
#include "nsStyleLinkElement.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIHTMLDocument.h"
|
#include "nsIHTMLDocument.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsHtml5DocumentBuilder, nsContentSink,
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsHtml5DocumentBuilder, nsContentSink,
|
||||||
mOwnedElements)
|
mOwnedElements)
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#include "nsHtml5OplessBuilder.h"
|
#include "nsHtml5OplessBuilder.h"
|
||||||
|
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "mozilla/css/Loader.h"
|
#include "mozilla/css/Loader.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsIHTMLDocument.h"
|
#include "nsIHTMLDocument.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "mozilla/dom/nsCSPService.h"
|
#include "mozilla/dom/nsCSPService.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
|
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "nsHtml5TreeOpExecutor.h"
|
#include "nsHtml5TreeOpExecutor.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "nsIContentSecurityPolicy.h"
|
#include "nsIContentSecurityPolicy.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include "nsXPCOM.h"
|
#include "nsXPCOM.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "nsIDTD.h"
|
#include "nsIDTD.h"
|
||||||
|
|
@ -36,6 +35,7 @@
|
||||||
#include "nsTreeSanitizer.h"
|
#include "nsTreeSanitizer.h"
|
||||||
#include "nsHtml5Module.h"
|
#include "nsHtml5Module.h"
|
||||||
#include "mozilla/dom/DocumentFragment.h"
|
#include "mozilla/dom/DocumentFragment.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "nsNullPrincipal.h"
|
#include "nsNullPrincipal.h"
|
||||||
|
|
||||||
#define XHTML_DIV_TAG "div xmlns=\"http://www.w3.org/1999/xhtml\""
|
#define XHTML_DIV_TAG "div xmlns=\"http://www.w3.org/1999/xhtml\""
|
||||||
|
|
@ -148,7 +148,7 @@ nsParserUtils::ParseFragment(const nsAString& aFragment,
|
||||||
nsAutoScriptBlockerSuppressNodeRemoved autoBlocker;
|
nsAutoScriptBlockerSuppressNodeRemoved autoBlocker;
|
||||||
|
|
||||||
// stop scripts
|
// stop scripts
|
||||||
RefPtr<nsScriptLoader> loader;
|
RefPtr<ScriptLoader> loader;
|
||||||
bool scripts_enabled = false;
|
bool scripts_enabled = false;
|
||||||
if (document) {
|
if (document) {
|
||||||
loader = document->ScriptLoader();
|
loader = document->ScriptLoader();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
#include "nsIFragmentContentSink.h"
|
#include "nsIFragmentContentSink.h"
|
||||||
#include "nsStreamUtils.h"
|
#include "nsStreamUtils.h"
|
||||||
#include "nsHTMLTokenizer.h"
|
#include "nsHTMLTokenizer.h"
|
||||||
#include "nsScriptLoader.h"
|
|
||||||
#include "nsDataHashtable.h"
|
#include "nsDataHashtable.h"
|
||||||
#include "nsXPCOMCIDInternal.h"
|
#include "nsXPCOMCIDInternal.h"
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
|
|
@ -41,6 +40,7 @@
|
||||||
#include "nsIHTMLContentSink.h"
|
#include "nsIHTMLContentSink.h"
|
||||||
|
|
||||||
#include "mozilla/dom/EncodingUtils.h"
|
#include "mozilla/dom/EncodingUtils.h"
|
||||||
|
#include "mozilla/dom/ScriptLoader.h"
|
||||||
#include "mozilla/BinarySearch.h"
|
#include "mozilla/BinarySearch.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue