Commit e21e3899 authored by psolanki@apple.com's avatar psolanki@apple.com
Browse files

Page::console() should return a reference

https://bugs.webkit.org/show_bug.cgi?id=120320

Reviewed by Darin Adler.

Page::m_console is never NULL so console() can just return a reference.

* css/CSSParser.cpp:
(WebCore::CSSParser::logError):
* dom/Document.cpp:
(WebCore::Document::addConsoleMessage):
(WebCore::Document::addMessage):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::pageConsole):
* page/Page.h:
(WebCore::Page::console):
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::parseString):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a945c700
2013-08-26 Pratik Solanki <psolanki@apple.com>
Page::console() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=120320
Reviewed by Darin Adler.
Page::m_console is never NULL so console() can just return a reference.
* css/CSSParser.cpp:
(WebCore::CSSParser::logError):
* dom/Document.cpp:
(WebCore::Document::addConsoleMessage):
(WebCore::Document::addMessage):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::pageConsole):
* page/Page.h:
(WebCore::Page::console):
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::parseString):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::docLoaderFunc):
2013-08-26 Rob Buis <rwlbuis@webkit.org>
 
Lonely stop crashes
......@@ -11717,8 +11717,8 @@ bool CSSParser::isLoggingErrors()
void CSSParser::logError(const String& message, int lineNumber)
{
// FIXME: <http://webkit.org/b/114313> CSS Parser ConsoleMessage errors should include column numbers
PageConsole* console = m_styleSheet->singleOwnerDocument()->page()->console();
console->addMessage(CSSMessageSource, WarningMessageLevel, message, m_styleSheet->baseURL().string(), lineNumber + 1, 0);
PageConsole& console = m_styleSheet->singleOwnerDocument()->page()->console();
console.addMessage(CSSMessageSource, WarningMessageLevel, message, m_styleSheet->baseURL().string(), lineNumber + 1, 0);
}
StyleRuleKeyframes* CSSParser::createKeyframesRule(const String& name, PassOwnPtr<Vector<RefPtr<StyleKeyframe> > > popKeyframes)
......
......@@ -4749,7 +4749,7 @@ void Document::addConsoleMessage(MessageSource source, MessageLevel level, const
}
if (Page* page = this->page())
page->console()->addMessage(source, level, message, requestIdentifier, this);
page->console().addMessage(source, level, message, requestIdentifier, this);
}
void Document::addMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, unsigned columnNumber, PassRefPtr<ScriptCallStack> callStack, ScriptState* state, unsigned long requestIdentifier)
......@@ -4760,7 +4760,7 @@ void Document::addMessage(MessageSource source, MessageLevel level, const String
}
if (Page* page = this->page())
page->console()->addMessage(source, level, message, sourceURL, lineNumber, columnNumber, callStack, state, requestIdentifier);
page->console().addMessage(source, level, message, sourceURL, lineNumber, columnNumber, callStack, state, requestIdentifier);
}
SecurityOrigin* Document::topOrigin() const
......
......@@ -691,7 +691,7 @@ PageConsole* DOMWindow::pageConsole() const
{
if (!isCurrentlyDisplayedInFrame())
return 0;
return m_frame->page() ? m_frame->page()->console() : 0;
return m_frame->page() ? &m_frame->page()->console() : 0;
}
DOMApplicationCache* DOMWindow::applicationCache() const
......
......@@ -394,7 +394,7 @@ public:
PageThrottler* pageThrottler() { return m_pageThrottler.get(); }
PassOwnPtr<PageActivityAssertionToken> createActivityToken();
PageConsole* console() { return m_console.get(); }
PageConsole& console() { return *m_console; }
#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
void hiddenPageDOMTimerThrottlingStateChanged();
......@@ -545,7 +545,7 @@ private:
bool m_scriptedAnimationsSuspended;
OwnPtr<PageThrottler> m_pageThrottler;
OwnPtr<PageConsole> m_console;
const OwnPtr<PageConsole> m_console;
HashSet<String> m_seenPlugins;
HashSet<String> m_seenMediaEngines;
......
......@@ -147,7 +147,7 @@ bool XSLStyleSheet::parseString(const String& string)
PageConsole* console = 0;
Frame* frame = ownerDocument()->frame();
if (frame && frame->page())
console = frame->page()->console();
console = &frame->page()->console();
XMLDocumentParserScope scope(cachedResourceLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console);
......
......@@ -140,7 +140,7 @@ static xmlDocPtr docLoaderFunc(const xmlChar* uri,
PageConsole* console = 0;
Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame();
if (frame && frame->page())
console = frame->page()->console();
console = &frame->page()->console();
xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc);
xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment