Bug 888972 - part 1 - add nsIFrameScriptLoader.getDelayedFrameScripts(); r=smaug

This commit is contained in:
Tim Taubert 2013-08-09 04:36:37 +02:00
Родитель cf05e6d90d
Коммит 11522940ba
2 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -5,6 +5,7 @@
#include "nsISupports.idl"
interface nsIDOMDOMStringList;
interface nsIDOMWindow;
interface nsIDocShell;
interface nsIContent;
@ -320,7 +321,7 @@ interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
[notxpcom] nsIContent getOwnerContent();
};
[scriptable, builtinclass, uuid(a54acd34-4141-46f5-b71b-e2ca32879b08)]
[scriptable, builtinclass, uuid(ecebfb8c-ff51-11e2-9d65-7af553959281)]
interface nsIFrameScriptLoader : nsISupports
{
/**
@ -336,6 +337,12 @@ interface nsIFrameScriptLoader : nsISupports
* Removes aURL from the list of scripts which support delayed load.
*/
void removeDelayedFrameScript(in AString aURL);
/**
* Returns a list of all delayed scripts that will be loaded once
* a (remote) frame becomes available.
*/
nsIDOMDOMStringList getDelayedFrameScripts();
};
[scriptable, builtinclass, uuid(b37821ff-df79-44d4-821c-6d6ec4dfe1e9)]

Просмотреть файл

@ -33,6 +33,7 @@
#include "mozilla/dom/StructuredCloneUtils.h"
#include "JavaScriptChild.h"
#include "JavaScriptParent.h"
#include "nsDOMLists.h"
#include <algorithm>
#ifdef ANDROID
@ -316,6 +317,28 @@ nsFrameMessageManager::RemoveDelayedFrameScript(const nsAString& aURL)
return NS_OK;
}
NS_IMETHODIMP
nsFrameMessageManager::GetDelayedFrameScripts(nsIDOMDOMStringList** aList)
{
// Frame message managers may return an incomplete list because scripts
// that were loaded after it was connected are not added to the list.
if (!IsGlobal() && !IsWindowLevel()) {
NS_WARNING("Cannot retrieve list of pending frame scripts for frame"
"message managers as it may be incomplete");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsRefPtr<nsDOMStringList> scripts = new nsDOMStringList();
for (uint32_t i = 0; i < mPendingScripts.Length(); ++i) {
scripts->Add(mPendingScripts[i]);
}
scripts.forget(aList);
return NS_OK;
}
static JSBool
JSONCreator(const jschar* aBuf, uint32_t aLen, void* aData)
{