mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 739033 - Allow external View Source editor code live dangerously. r=smaug.
This commit is contained in:
parent
10f76a2526
commit
943497857a
@ -74,6 +74,7 @@ nsHtml5Module::InitializeStatics()
|
||||
nsHtml5TreeBuilder::initializeStatics();
|
||||
nsHtml5UTF16Buffer::initializeStatics();
|
||||
nsHtml5StreamParser::InitializeStatics();
|
||||
nsHtml5TreeOpExecutor::InitializeStatics();
|
||||
#ifdef DEBUG
|
||||
sNsHtml5ModuleInitialized = true;
|
||||
#endif
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "mozilla/Util.h" // DebugOnly
|
||||
#include "sampler.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -121,7 +122,8 @@ nsHtml5TreeOpExecutor::WillParse()
|
||||
NS_IMETHODIMP
|
||||
nsHtml5TreeOpExecutor::WillBuildModel(nsDTDMode aDTDMode)
|
||||
{
|
||||
if (mDocShell && !GetDocument()->GetScriptGlobalObject()) {
|
||||
if (mDocShell && !GetDocument()->GetScriptGlobalObject() &&
|
||||
!IsExternalViewSource()) {
|
||||
// Not loading as data but script global object not ready
|
||||
return MarkAsBroken(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
}
|
||||
@ -969,6 +971,27 @@ nsHtml5TreeOpExecutor::GetViewSourceBaseURI()
|
||||
return mViewSourceBaseURI;
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
nsHtml5TreeOpExecutor::InitializeStatics()
|
||||
{
|
||||
mozilla::Preferences::AddBoolVarCache(&sExternalViewSource,
|
||||
"view_source.editor.external");
|
||||
}
|
||||
|
||||
bool
|
||||
nsHtml5TreeOpExecutor::IsExternalViewSource()
|
||||
{
|
||||
if (!sExternalViewSource) {
|
||||
return false;
|
||||
}
|
||||
bool isViewSource = false;
|
||||
if (mDocumentURI) {
|
||||
mDocumentURI->SchemeIs("view-source", &isViewSource);
|
||||
}
|
||||
return isViewSource;
|
||||
}
|
||||
|
||||
// Speculative loading
|
||||
|
||||
already_AddRefed<nsIURI>
|
||||
@ -1060,3 +1083,4 @@ PRUint32 nsHtml5TreeOpExecutor::sAppendBatchExaminations = 0;
|
||||
PRUint32 nsHtml5TreeOpExecutor::sLongestTimeOffTheEventLoop = 0;
|
||||
PRUint32 nsHtml5TreeOpExecutor::sTimesFlushLoopInterrupted = 0;
|
||||
#endif
|
||||
bool nsHtml5TreeOpExecutor::sExternalViewSource = false;
|
||||
|
@ -85,6 +85,7 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHtml5TreeOpExecutor, nsContentSink)
|
||||
|
||||
private:
|
||||
static bool sExternalViewSource;
|
||||
#ifdef DEBUG_NS_HTML5_TREE_OP_EXECUTOR_FLUSH
|
||||
static PRUint32 sAppendBatchMaxSize;
|
||||
static PRUint32 sAppendBatchSlotsExamined;
|
||||
@ -446,9 +447,13 @@ class nsHtml5TreeOpExecutor : public nsContentSink,
|
||||
|
||||
void SetSpeculationBase(const nsAString& aURL);
|
||||
|
||||
static void InitializeStatics();
|
||||
|
||||
private:
|
||||
nsHtml5Parser* GetParser();
|
||||
|
||||
bool IsExternalViewSource();
|
||||
|
||||
/**
|
||||
* Get a nsIURI for an nsString if the URL hasn't been preloaded yet.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user