зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1036186 - Reset Migration wizard no longer skips the first step to choose a browser. r=smaug.
--HG-- extra : rebase_source : 599d78a04a085304154e8231d5bd2239d025ab22
This commit is contained in:
Родитель
aa69331685
Коммит
30803169a4
|
@ -429,7 +429,6 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
|
|||
#undef NS_DEFINE_CONSTRUCTOR_FUNC_DATA
|
||||
|
||||
nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr;
|
||||
nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nullptr;
|
||||
bool nsDOMClassInfo::sIsInitialized = false;
|
||||
|
||||
|
||||
|
@ -780,19 +779,11 @@ nsDOMClassInfo::Init()
|
|||
nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
|
||||
NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsresult rv = CallGetService(nsIXPConnect::GetCID(), &sXPConnect);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ADDREF(sXPConnect = nsContentUtils::XPConnect());
|
||||
|
||||
nsCOMPtr<nsIXPCFunctionThisTranslator> elt = new nsEventListenerThisTranslator();
|
||||
sXPConnect->SetFunctionThisTranslator(NS_GET_IID(nsIDOMEventListener), elt);
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> sm =
|
||||
do_GetService("@mozilla.org/scriptsecuritymanager;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
sSecMan = sm;
|
||||
NS_ADDREF(sSecMan);
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||
|
@ -1043,9 +1034,6 @@ nsDOMClassInfo::Init()
|
|||
|
||||
RegisterExternalClasses();
|
||||
|
||||
// Register new DOM bindings
|
||||
mozilla::dom::Register(nameSpaceManager);
|
||||
|
||||
sIsInitialized = true;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1524,11 +1512,8 @@ NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!nsDOMClassInfo::sIsInitialized) {
|
||||
nsresult rv = nsDOMClassInfo::Init();
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
}
|
||||
nsresult rv = RegisterDOMNames();
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
if (!sClassInfoData[aID].mCachedClassInfo) {
|
||||
nsDOMClassInfoData& data = sClassInfoData[aID];
|
||||
|
@ -1589,7 +1574,6 @@ nsDOMClassInfo::ShutDown()
|
|||
sWrappedJSObject_id = JSID_VOID;
|
||||
|
||||
NS_IF_RELEASE(sXPConnect);
|
||||
NS_IF_RELEASE(sSecMan);
|
||||
sIsInitialized = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
|
||||
static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);
|
||||
|
||||
static nsresult Init();
|
||||
static void ShutDown();
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
|
@ -127,10 +128,6 @@ public:
|
|||
{
|
||||
return sXPConnect;
|
||||
}
|
||||
static nsIScriptSecurityManager *ScriptSecurityManager()
|
||||
{
|
||||
return sSecMan;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend nsIClassInfo* NS_GetDOMClassInfoInstance(nsDOMClassInfoID aID);
|
||||
|
@ -146,14 +143,12 @@ protected:
|
|||
return mData->mInterfacesBitmap;
|
||||
}
|
||||
|
||||
static nsresult Init();
|
||||
static nsresult RegisterClassProtos(int32_t aDOMClassInfoID);
|
||||
static nsresult RegisterExternalClasses();
|
||||
nsresult ResolveConstructor(JSContext *cx, JSObject *obj,
|
||||
JSObject **objp);
|
||||
|
||||
static nsIXPConnect *sXPConnect;
|
||||
static nsIScriptSecurityManager *sSecMan;
|
||||
|
||||
// nsIXPCScriptable code
|
||||
static nsresult DefineStaticJSVals(JSContext *cx);
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "mozilla/dom/HTMLAppletElementBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -2561,6 +2562,34 @@ CreateGlobalOptions<nsGlobalWindow>::TraceGlobal(JSTracer* aTrc, JSObject* aObj)
|
|||
xpc::TraceXPCGlobal(aTrc, aObj);
|
||||
}
|
||||
|
||||
static bool sRegisteredDOMNames = false;
|
||||
|
||||
nsresult
|
||||
RegisterDOMNames()
|
||||
{
|
||||
if (sRegisteredDOMNames) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = nsDOMClassInfo::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not initialize nsDOMClassInfo");
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Register new DOM bindings
|
||||
nsScriptNameSpaceManager* nameSpaceManager = GetNameSpaceManager();
|
||||
if (!nameSpaceManager) {
|
||||
NS_ERROR("Could not initialize nsScriptNameSpaceManager");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mozilla::dom::Register(nameSpaceManager);
|
||||
|
||||
sRegisteredDOMNames = true;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
CreateGlobalOptions<nsGlobalWindow>::PostCreateGlobal(JSContext* aCx,
|
||||
|
|
|
@ -2808,6 +2808,9 @@ struct CreateGlobalOptions<nsGlobalWindow>
|
|||
static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
|
||||
};
|
||||
|
||||
nsresult
|
||||
RegisterDOMNames();
|
||||
|
||||
template <class T, ProtoGetter GetProto>
|
||||
bool
|
||||
CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,
|
||||
|
@ -2815,6 +2818,11 @@ CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,
|
|||
JSPrincipals* aPrincipal, bool aInitStandardClasses,
|
||||
JS::MutableHandle<JSObject*> aGlobal)
|
||||
{
|
||||
nsresult rv = RegisterDOMNames();
|
||||
if (NS_FAILED(rv)) {
|
||||
return Throw(aCx, rv);
|
||||
}
|
||||
|
||||
aOptions.setTrace(CreateGlobalOptions<T>::TraceGlobal);
|
||||
|
||||
aGlobal.set(JS_NewGlobalObject(aCx, aClass, aPrincipal,
|
||||
|
|
Загрузка…
Ссылка в новой задаче