diff --git a/dom/html/nsGenericHTMLFrameElement.cpp b/dom/html/nsGenericHTMLFrameElement.cpp index 76056536af4d..4b5b71a5965f 100644 --- a/dom/html/nsGenericHTMLFrameElement.cpp +++ b/dom/html/nsGenericHTMLFrameElement.cpp @@ -453,18 +453,28 @@ nsGenericHTMLFrameElement::IsHTMLFocusable(bool aWithMouse, return false; } +static bool sMozBrowserFramesEnabled = false; +#ifdef DEBUG +static bool sBoolVarCacheInitialized = false; +#endif + +void +nsGenericHTMLFrameElement::InitStatics() +{ + MOZ_ASSERT(!sBoolVarCacheInitialized); + MOZ_ASSERT(NS_IsMainThread()); + Preferences::AddBoolVarCache(&sMozBrowserFramesEnabled, + "dom.mozBrowserFramesEnabled"); +#ifdef DEBUG + sBoolVarCacheInitialized = true; +#endif +} + + bool nsGenericHTMLFrameElement::BrowserFramesEnabled() { - static bool sMozBrowserFramesEnabled = false; - static bool sBoolVarCacheInitialized = false; - - if (!sBoolVarCacheInitialized) { - sBoolVarCacheInitialized = true; - Preferences::AddBoolVarCache(&sMozBrowserFramesEnabled, - "dom.mozBrowserFramesEnabled"); - } - + MOZ_ASSERT(sBoolVarCacheInitialized); return sMozBrowserFramesEnabled; } diff --git a/dom/html/nsGenericHTMLFrameElement.h b/dom/html/nsGenericHTMLFrameElement.h index 4ab64956228e..fd565e8bb5e8 100644 --- a/dom/html/nsGenericHTMLFrameElement.h +++ b/dom/html/nsGenericHTMLFrameElement.h @@ -88,6 +88,7 @@ public: void PresetOpenerWindow(mozIDOMWindowProxy* aOpenerWindow, mozilla::ErrorResult& aRv); + static void InitStatics(); static bool BrowserFramesEnabled(); /** diff --git a/dom/ipc/ContentPrefs.cpp b/dom/ipc/ContentPrefs.cpp index 714c18f76202..6d65b4914cfc 100644 --- a/dom/ipc/ContentPrefs.cpp +++ b/dom/ipc/ContentPrefs.cpp @@ -42,6 +42,7 @@ const char* mozilla::dom::ContentPrefs::gInitPrefs[] = { "dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS", "dom.max_chrome_script_run_time", "dom.max_script_run_time", + "dom.mozBrowserFramesEnabled", "dom.performance.enable_notify_performance_timing", "dom.performance.enable_user_timing_logging", "dom.storage.testing", diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index fe8bdc0bd4e2..157a0dc5ae3c 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -22,6 +22,7 @@ #include "nsCSSPseudoClasses.h" #include "nsCSSPseudoElements.h" #include "nsCSSRendering.h" +#include "nsGenericHTMLFrameElement.h" #include "mozilla/dom/Attr.h" #include "nsDOMClassInfo.h" #include "mozilla/EventListenerManager.h" @@ -286,6 +287,7 @@ nsLayoutStatics::Initialize() nsApplicationCacheService::AppClearDataObserverInit(); HTMLVideoElement::Init(); + nsGenericHTMLFrameElement::InitStatics(); #ifdef MOZ_XUL nsMenuBarListener::InitializeStatics();