Make HTML5 parser enablement use AddBoolPrefVarCache

This commit is contained in:
Henri Sivonen 2009-06-21 16:14:38 +03:00
parent fe65dfaaf9
commit bbf153f97c
4 changed files with 8 additions and 3 deletions

View File

@ -3591,7 +3591,7 @@ nsContentUtils::CreateContextualFragment(nsIDOMNode* aContextNode,
nsCOMPtr<nsIHTMLDocument> htmlDoc(do_QueryInterface(document));
PRBool bHTML = htmlDoc && !bCaseSensitive;
if (bHTML && nsContentUtils::GetBoolPref("html5.enable", PR_FALSE)) {
if (bHTML && nsHtml5Module::Enabled) {
// See if the document has a cached fragment parser. nsHTMLDocument is the
// only one that should really have one at the moment.
nsCOMPtr<nsIParser> parser = document->GetFragmentParser();

View File

@ -655,7 +655,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
PRBool aReset,
nsIContentSink* aSink)
{
PRBool loadAsHtml5 = nsContentUtils::GetBoolPref("html5.enable", PR_FALSE);
PRBool loadAsHtml5 = nsHtml5Module::Enabled;
if (aSink) {
loadAsHtml5 = PR_FALSE;
}
@ -1805,7 +1805,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
PRBool loadAsHtml5 = nsContentUtils::GetBoolPref("html5.enable", PR_FALSE);
PRBool loadAsHtml5 = nsHtml5Module::Enabled;
nsresult rv = NS_OK;

View File

@ -47,6 +47,7 @@ class nsHtml5Module
static void ReleaseStatics();
static already_AddRefed<nsIParser> NewHtml5Parser();
static nsresult Initialize(nsIParser* aParser, nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel);
static PRBool Enabled;
#ifdef DEBUG
private:
static PRBool sNsHtml5ModuleInitialized;

View File

@ -35,6 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsContentUtils.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
#include "nsHtml5HtmlAttributes.h"
@ -47,10 +48,13 @@
#include "nsHtml5Module.h"
PRBool nsHtml5Module::Enabled = PR_FALSE;
// static
void
nsHtml5Module::InitializeStatics()
{
nsContentUtils::AddBoolPrefVarCache("html5.enable", &Enabled);
nsHtml5Atoms::AddRefAtoms();
nsHtml5AttributeName::initializeStatics();
nsHtml5ElementName::initializeStatics();