mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Issue #1603 - Part 1: Reorganize ScriptLoader/ScriptElement
- Moves scripting parts of DOM into 'dom/script'
- Renames nsScript{Loader/Element} to Script{Loader/Element}
- Adjusts all callers
This commit is contained in:
parent
179fd7df8a
commit
f85b274e94
50 changed files with 554 additions and 514 deletions
|
|
@ -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,9 +1786,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::SourceBufferHolder srcBuf(dataStringBuf, dataStringLength,
|
JS::SourceBufferHolder srcBuf(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"
|
||||||
|
|
|
||||||
|
|
@ -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':
|
||||||
|
|
|
||||||
|
|
@ -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,11 +19,11 @@ 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,
|
||||||
int32_t aLineNo)
|
int32_t aLineNo)
|
||||||
{
|
{
|
||||||
if (!aIsInline && NS_FAILED(aResult)) {
|
if (!aIsInline && NS_FAILED(aResult)) {
|
||||||
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
|
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
|
||||||
|
|
@ -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,9 +53,9 @@ nsScriptElement::FireErrorEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsScriptElement::ScriptEvaluated(nsresult aResult,
|
ScriptElement::ScriptEvaluated(nsresult aResult,
|
||||||
nsIScriptElement *aElement,
|
nsIScriptElement *aElement,
|
||||||
bool aIsInline)
|
bool aIsInline)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
if (!aIsInline) {
|
if (!aIsInline) {
|
||||||
|
|
@ -78,44 +78,44 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::CharacterDataChanged(nsIDocument *aDocument,
|
ScriptElement::CharacterDataChanged(nsIDocument *aDocument,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
CharacterDataChangeInfo* aInfo)
|
CharacterDataChangeInfo* aInfo)
|
||||||
{
|
{
|
||||||
MaybeProcessScript();
|
MaybeProcessScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::AttributeChanged(nsIDocument* aDocument,
|
ScriptElement::AttributeChanged(nsIDocument* aDocument,
|
||||||
Element* aElement,
|
Element* aElement,
|
||||||
int32_t aNameSpaceID,
|
int32_t aNameSpaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
int32_t aModType,
|
int32_t aModType,
|
||||||
const nsAttrValue* aOldValue)
|
const nsAttrValue* aOldValue)
|
||||||
{
|
{
|
||||||
MaybeProcessScript();
|
MaybeProcessScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::ContentAppended(nsIDocument* aDocument,
|
ScriptElement::ContentAppended(nsIDocument* aDocument,
|
||||||
nsIContent* aContainer,
|
nsIContent* aContainer,
|
||||||
nsIContent* aFirstNewContent,
|
nsIContent* aFirstNewContent,
|
||||||
int32_t aNewIndexInContainer)
|
int32_t aNewIndexInContainer)
|
||||||
{
|
{
|
||||||
MaybeProcessScript();
|
MaybeProcessScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsScriptElement::ContentInserted(nsIDocument *aDocument,
|
ScriptElement::ContentInserted(nsIDocument *aDocument,
|
||||||
nsIContent* aContainer,
|
nsIContent* aContainer,
|
||||||
nsIContent* aChild,
|
nsIContent* aChild,
|
||||||
int32_t aIndexInContainer)
|
int32_t aIndexInContainer)
|
||||||
{
|
{
|
||||||
MaybeProcessScript();
|
MaybeProcessScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
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,22 +4,25 @@
|
||||||
* 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:
|
||||||
// nsIScriptLoaderObserver
|
// nsIScriptLoaderObserver
|
||||||
|
|
@ -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
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -8,8 +8,8 @@
|
||||||
* A class that handles loading and evaluation of <script> elements.
|
* A class that handles loading and evaluation of <script> elements.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __nsScriptLoader_h__
|
#ifndef mozilla_dom_ScriptLoader_h
|
||||||
#define __nsScriptLoader_h__
|
#define mozilla_dom_ScriptLoader_h
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
|
|
@ -30,9 +30,6 @@
|
||||||
#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,37 +38,39 @@ 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,
|
||||||
const mozilla::dom::SRIMetadata &aIntegrity)
|
const mozilla::dom::SRIMetadata &aIntegrity)
|
||||||
: mKind(aKind),
|
: mKind(aKind),
|
||||||
mElement(aElement),
|
mElement(aElement),
|
||||||
mProgress(Progress::Loading),
|
mProgress(Progress::Loading),
|
||||||
|
|
@ -95,14 +94,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 +153,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 +178,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,20 +202,20 @@ 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);
|
||||||
|
|
@ -227,12 +226,12 @@ public:
|
||||||
// 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 +244,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 +394,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 +462,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 +481,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 +501,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 +538,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 +627,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,23 +638,23 @@ 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
|
class ScriptLoadHandler final : public nsIIncrementalStreamLoaderObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit nsScriptLoadHandler(nsScriptLoader* aScriptLoader,
|
explicit ScriptLoadHandler(ScriptLoader* aScriptLoader,
|
||||||
nsScriptLoadRequest *aRequest,
|
ScriptLoadRequest *aRequest,
|
||||||
mozilla::dom::SRICheckDataVerifier *aSRIDataVerifier);
|
mozilla::dom::SRICheckDataVerifier *aSRIDataVerifier);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSIINCREMENTALSTREAMLOADEROBSERVER
|
NS_DECL_NSIINCREMENTALSTREAMLOADEROBSERVER
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~nsScriptLoadHandler();
|
virtual ~ScriptLoadHandler();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to decode some raw data.
|
* Try to decode some raw data.
|
||||||
|
|
@ -673,10 +672,10 @@ private:
|
||||||
bool aEndOfStream);
|
bool aEndOfStream);
|
||||||
|
|
||||||
// ScriptLoader which will handle the parsed script.
|
// ScriptLoader which will handle the parsed script.
|
||||||
RefPtr<nsScriptLoader> mScriptLoader;
|
RefPtr<ScriptLoader> mScriptLoader;
|
||||||
|
|
||||||
// The nsScriptLoadRequest for this load.
|
// The ScriptLoadRequest for this load.
|
||||||
RefPtr<nsScriptLoadRequest> mRequest;
|
RefPtr<ScriptLoadRequest> mRequest;
|
||||||
|
|
||||||
// SRI data verifier.
|
// SRI data verifier.
|
||||||
nsAutoPtr<mozilla::dom::SRICheckDataVerifier> mSRIDataVerifier;
|
nsAutoPtr<mozilla::dom::SRICheckDataVerifier> mSRIDataVerifier;
|
||||||
|
|
@ -711,7 +710,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mWasEnabled;
|
bool mWasEnabled;
|
||||||
RefPtr<nsScriptLoader> mLoader;
|
RefPtr<ScriptLoader> mLoader;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__nsScriptLoader_h__
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif //mozilla_dom_ScriptLoader_h
|
||||||
33
dom/script/moz.build
Normal file
33
dom/script/moz.build
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
# -*- 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 += [
|
||||||
|
'ScriptElement.cpp',
|
||||||
|
'ScriptLoader.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,14 +1075,14 @@ 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);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -1289,10 +1289,10 @@ 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);
|
||||||
if (NS_SUCCEEDED(rv) && IsMainWorkerScript()) {
|
if (NS_SUCCEEDED(rv) && IsMainWorkerScript()) {
|
||||||
nsCOMPtr<nsIURI> finalURI;
|
nsCOMPtr<nsIURI> finalURI;
|
||||||
rv = NS_NewURI(getter_AddRefs(finalURI), loadInfo.mFullURL, nullptr, nullptr);
|
rv = NS_NewURI(getter_AddRefs(finalURI), loadInfo.mFullURL, nullptr, nullptr);
|
||||||
|
|
|
||||||
|
|
@ -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,9 +801,9 @@ 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))) {
|
||||||
mManager->NetworkFinished(rv);
|
mManager->NetworkFinished(rv);
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -855,9 +855,9 @@ 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))) {
|
||||||
mManager->CacheFinished(rv, false);
|
mManager->CacheFinished(rv, false);
|
||||||
return rv;
|
return 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,9 +171,9 @@ 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))) {
|
||||||
RejectPromises(rv);
|
RejectPromises(rv);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
||||||
|
|
@ -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,10 +3325,10 @@ 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);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
// Attempt to give ownership of the buffer to the JS engine. If
|
// Attempt to give ownership of the buffer to the JS engine. If
|
||||||
// we hit offthread compilation, however, we will have to take it
|
// we hit offthread compilation, however, we will have to take it
|
||||||
|
|
|
||||||
|
|
@ -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,8 +139,8 @@ 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,
|
||||||
JS::SourceBufferHolder::GiveOwnership);
|
JS::SourceBufferHolder::GiveOwnership);
|
||||||
|
|
@ -826,9 +826,9 @@ 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);
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,8 +3035,8 @@ 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);
|
||||||
|
|
||||||
if (!*src)
|
if (!*src)
|
||||||
|
|
|
||||||
|
|
@ -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