| Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| index 370c44a30bad8879fa0612e3b9ae7985b640753b..d7c1ff6cae32495ba08f62378e1fd64a76cfd300 100644
|
| --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| @@ -286,7 +286,7 @@ public:
|
|
|
| virtual void begin(float width, float height)
|
| {
|
| - ASSERT(!m_printedPageWidth);
|
| + DCHECK(!m_printedPageWidth);
|
| m_printedPageWidth = width;
|
| PrintContext::begin(m_printedPageWidth, height);
|
| }
|
| @@ -713,7 +713,7 @@ void WebLocalFrameImpl::dispatchUnloadEvent()
|
|
|
| void WebLocalFrameImpl::executeScript(const WebScriptSource& source)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), OrdinalNumber::first());
|
| v8::HandleScope handleScope(toIsolate(frame()));
|
| frame()->script().executeScriptInMainWorld(ScriptSourceCode(source.code, source.url, position));
|
| @@ -721,9 +721,9 @@ void WebLocalFrameImpl::executeScript(const WebScriptSource& source)
|
|
|
| void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup)
|
| {
|
| - ASSERT(frame());
|
| - RELEASE_ASSERT(worldID > 0);
|
| - RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
|
| + DCHECK(frame());
|
| + CHECK_GT(worldID, 0);
|
| + CHECK_LT(worldID, EmbedderWorldIdLimit);
|
|
|
| HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
|
| v8::HandleScope handleScope(toIsolate(frame()));
|
| @@ -732,25 +732,25 @@ void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip
|
|
|
| void WebLocalFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOrigin& securityOrigin)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| DOMWrapperWorld::setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get());
|
| }
|
|
|
| void WebLocalFrameImpl::setIsolatedWorldContentSecurityPolicy(int worldID, const WebString& policy)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(worldID, policy);
|
| }
|
|
|
| void WebLocalFrameImpl::setIsolatedWorldHumanReadableName(int worldID, const WebString& humanReadableName)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| DOMWrapperWorld::setIsolatedWorldHumanReadableName(worldID, humanReadableName);
|
| }
|
|
|
| void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
|
|
| MessageLevel webCoreMessageLevel;
|
| switch (message.level) {
|
| @@ -785,7 +785,7 @@ void WebLocalFrameImpl::collectGarbage()
|
|
|
| v8::Local<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebScriptSource& source)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
|
|
| TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), OrdinalNumber::first());
|
| return frame()->script().executeScriptInMainWorldAndReturnValue(ScriptSourceCode(source.code, source.url, position));
|
| @@ -793,16 +793,16 @@ v8::Local<v8::Value> WebLocalFrameImpl::executeScriptAndReturnValue(const WebScr
|
|
|
| void WebLocalFrameImpl::requestExecuteScriptAndReturnValue(const WebScriptSource& source, bool userGesture, WebScriptExecutionCallback* callback)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
|
|
| SuspendableScriptExecutor::createAndRun(frame(), 0, createSourcesVector(&source, 1), 0, userGesture, callback);
|
| }
|
|
|
| void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local<v8::Value>>* results)
|
| {
|
| - ASSERT(frame());
|
| - RELEASE_ASSERT(worldID > 0);
|
| - RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
|
| + DCHECK(frame());
|
| + CHECK_GT(worldID, 0);
|
| + CHECK_LT(worldID, EmbedderWorldIdLimit);
|
|
|
| HeapVector<ScriptSourceCode> sources = createSourcesVector(sourcesIn, numSources);
|
|
|
| @@ -821,9 +821,9 @@ void WebLocalFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScrip
|
|
|
| void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, bool userGesture, WebScriptExecutionCallback* callback)
|
| {
|
| - ASSERT(frame());
|
| - RELEASE_ASSERT(worldID > 0);
|
| - RELEASE_ASSERT(worldID < EmbedderWorldIdLimit);
|
| + DCHECK(frame());
|
| + CHECK_GT(worldID, 0);
|
| + CHECK_LT(worldID, EmbedderWorldIdLimit);
|
|
|
| SuspendableScriptExecutor::createAndRun(frame(), worldID, createSourcesVector(sourcesIn, numSources), extensionGroup, userGesture, callback);
|
| }
|
| @@ -831,7 +831,7 @@ void WebLocalFrameImpl::requestExecuteScriptInIsolatedWorld(int worldID, const W
|
| // TODO(bashi): Consider returning MaybeLocal.
|
| v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(v8::Local<v8::Function> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> argv[])
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| v8::Local<v8::Value> result;
|
| if (!frame()->script().callFunction(function, receiver, argc, static_cast<v8::Local<v8::Value>*>(argv)).ToLocal(&result))
|
| return v8::Local<v8::Value>();
|
| @@ -841,7 +841,7 @@ v8::Local<v8::Value> WebLocalFrameImpl::callFunctionEvenIfScriptDisabled(v8::Loc
|
| v8::Local<v8::Context> WebLocalFrameImpl::mainWorldScriptContext() const
|
| {
|
| ScriptState* scriptState = ScriptState::forMainWorld(frame());
|
| - ASSERT(scriptState);
|
| + DCHECK(scriptState);
|
| return scriptState->context();
|
| }
|
|
|
| @@ -861,7 +861,7 @@ void WebLocalFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ig
|
| {
|
| // TODO(clamy): Remove this function once RenderFrame calls load for all
|
| // requests.
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| WebFrameLoadType loadType = ignoreCache ?
|
| WebFrameLoadType::ReloadBypassingCache : WebFrameLoadType::Reload;
|
| WebURLRequest request = requestForReload(loadType, overrideUrl);
|
| @@ -902,7 +902,7 @@ void WebLocalFrameImpl::loadHistoryItem(const WebHistoryItem& item, WebHistoryLo
|
|
|
| void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseURL, const WebURL& unreachableURL, bool replace)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8"), baseURL, unreachableURL, replace,
|
| WebFrameLoadType::Standard, WebHistoryItem(), WebHistoryDifferentDocumentLoad, false);
|
| }
|
| @@ -918,13 +918,13 @@ void WebLocalFrameImpl::stopLoading()
|
|
|
| WebDataSource* WebLocalFrameImpl::provisionalDataSource() const
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| return DataSourceForDocLoader(frame()->loader().provisionalDocumentLoader());
|
| }
|
|
|
| WebDataSource* WebLocalFrameImpl::dataSource() const
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| return DataSourceForDocLoader(frame()->loader().documentLoader());
|
| }
|
|
|
| @@ -1027,13 +1027,13 @@ size_t WebLocalFrameImpl::characterIndexForPoint(const WebPoint& pointInViewport
|
| if (range.isNull())
|
| return kNotFound;
|
| Element* editable = frame()->selection().rootEditableElementOrDocumentElement();
|
| - ASSERT(editable);
|
| + DCHECK(editable);
|
| return PlainTextRange::create(*editable, range).start();
|
| }
|
|
|
| bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebNode& node)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
|
|
| if (name.length() <= 2)
|
| return false;
|
| @@ -1058,7 +1058,7 @@ bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebNode& nod
|
|
|
| bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebString& value, const WebNode& node)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
|
|
| WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), node);
|
| if (pluginContainer && pluginContainer->executeEditCommand(name, value))
|
| @@ -1069,7 +1069,7 @@ bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebString& v
|
|
|
| bool WebLocalFrameImpl::isCommandEnabled(const WebString& name) const
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| return frame()->editor().createCommand(name).isEnabled();
|
| }
|
|
|
| @@ -1252,7 +1252,7 @@ WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported()
|
|
|
| int WebLocalFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& constrainToNode)
|
| {
|
| - ASSERT(!frame()->document()->isFrameSet());
|
| + DCHECK(!frame()->document()->isFrameSet());
|
| WebPluginContainerImpl* pluginContainer = nullptr;
|
| if (constrainToNode.isNull()) {
|
| // If this is a plugin document, check if the plugin supports its own
|
| @@ -1280,15 +1280,18 @@ int WebLocalFrameImpl::printBegin(const WebPrintParams& printParams, const WebNo
|
|
|
| float WebLocalFrameImpl::getPrintPageShrink(int page)
|
| {
|
| - ASSERT(m_printContext && page >= 0);
|
| + DCHECK(m_printContext);
|
| + DCHECK_GE(page, 0);
|
| return m_printContext->getPageShrink(page);
|
| }
|
|
|
| float WebLocalFrameImpl::printPage(int page, WebCanvas* canvas)
|
| {
|
| #if ENABLE(PRINTING)
|
| -
|
| - ASSERT(m_printContext && page >= 0 && frame() && frame()->document());
|
| + DCHECK(m_printContext);
|
| + DCHECK_GE(page, 0);
|
| + DCHECK(frame());
|
| + DCHECK(frame()->document());
|
|
|
| return m_printContext->spoolSinglePage(canvas, page);
|
| #else
|
| @@ -1298,7 +1301,7 @@ float WebLocalFrameImpl::printPage(int page, WebCanvas* canvas)
|
|
|
| void WebLocalFrameImpl::printEnd()
|
| {
|
| - ASSERT(m_printContext);
|
| + DCHECK(m_printContext);
|
| m_printContext->end();
|
| m_printContext.clear();
|
| }
|
| @@ -1342,7 +1345,7 @@ void WebLocalFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, WebSize& pageS
|
|
|
| WebString WebLocalFrameImpl::pageProperty(const WebString& propertyName, int pageIndex)
|
| {
|
| - ASSERT(m_printContext);
|
| + DCHECK(m_printContext);
|
| return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pageIndex);
|
| }
|
|
|
| @@ -1355,7 +1358,7 @@ v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString&
|
| {
|
| if (WebTestInterfaceFactory* factory = m_testInterfaces.get(name)) {
|
| ScriptState* scriptState = ScriptState::forMainWorld(frame());
|
| - ASSERT(scriptState->contextIsValid());
|
| + DCHECK(scriptState->contextIsValid());
|
| v8::EscapableHandleScope handleScope(scriptState->isolate());
|
| ScriptState::Scope scope(scriptState);
|
| return handleScope.Escape(factory->createInstance(scriptState->context()));
|
| @@ -1365,7 +1368,7 @@ v8::Local<v8::Value> WebLocalFrameImpl::createTestInterface(const AtomicString&
|
|
|
| void WebLocalFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSize& pageSizeInPixels)
|
| {
|
| - ASSERT(m_printContext);
|
| + DCHECK(m_printContext);
|
|
|
| m_printContext->spoolAllPagesWithBoundaries(canvas, FloatSize(pageSizeInPixels.width, pageSizeInPixels.height));
|
| }
|
| @@ -1479,7 +1482,7 @@ WebLocalFrameImpl::WebLocalFrameImpl(WebRemoteFrame* oldWebFrame, WebFrameClient
|
| WebLocalFrameImpl::~WebLocalFrameImpl()
|
| {
|
| // The widget for the frame, if any, must have already been closed.
|
| - ASSERT(!m_frameWidget);
|
| + DCHECK(!m_frameWidget);
|
| frameCount--;
|
|
|
| #if !ENABLE(OILPAN)
|
| @@ -1561,7 +1564,7 @@ void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner,
|
| RawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request,
|
| const AtomicString& name, HTMLFrameOwnerElement* ownerElement)
|
| {
|
| - ASSERT(m_client);
|
| + DCHECK(m_client);
|
| TRACE_EVENT0("blink", "WebLocalFrameImpl::createChildframe");
|
| WebTreeScopeType scope = frame()->document() == ownerElement->treeScope()
|
| ? WebTreeScopeType::Document
|
| @@ -1610,7 +1613,7 @@ void WebLocalFrameImpl::didChangeContentsSize(const IntSize& size)
|
| {
|
| // This is only possible on the main frame.
|
| if (m_textFinder && m_textFinder->totalMatchCount() > 0) {
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
| m_textFinder->increaseMarkerVersion();
|
| }
|
| }
|
| @@ -1619,7 +1622,7 @@ void WebLocalFrameImpl::createFrameView()
|
| {
|
| TRACE_EVENT0("blink", "WebLocalFrameImpl::createFrameView");
|
|
|
| - ASSERT(frame()); // If frame() doesn't exist, we probably didn't init properly.
|
| + DCHECK(frame()); // If frame() doesn't exist, we probably didn't init properly.
|
|
|
| WebViewImpl* webView = viewImpl();
|
|
|
| @@ -1837,7 +1840,7 @@ WebAutofillClient* WebLocalFrameImpl::autofillClient()
|
|
|
| void WebLocalFrameImpl::setDevToolsAgentClient(WebDevToolsAgentClient* devToolsClient)
|
| {
|
| - ASSERT(devToolsClient);
|
| + DCHECK(devToolsClient);
|
| m_devToolsAgent = WebDevToolsAgentImpl::create(this, devToolsClient);
|
| }
|
|
|
| @@ -1851,7 +1854,7 @@ void WebLocalFrameImpl::setFrameOwnerProperties(const WebFrameOwnerProperties& f
|
| // At the moment, this is only used to replicate frame owner properties
|
| // for frames with a remote owner.
|
| FrameOwner* owner = frame()->owner();
|
| - ASSERT(owner);
|
| + DCHECK(owner);
|
| toRemoteFrameOwner(owner)->setScrollingMode(frameOwnerProperties.scrollingMode);
|
| toRemoteFrameOwner(owner)->setMarginWidth(frameOwnerProperties.marginWidth);
|
| toRemoteFrameOwner(owner)->setMarginHeight(frameOwnerProperties.marginHeight);
|
| @@ -1886,7 +1889,7 @@ WebLocalFrame* WebLocalFrameImpl::traverseNextLocal(bool wrap) const
|
|
|
| void WebLocalFrameImpl::sendPings(const WebNode& contextNode, const WebURL& destinationURL)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| Element* anchor = contextNode.constUnwrap<Node>()->enclosingLinkEventParentOrSelf();
|
| if (isHTMLAnchorElement(anchor))
|
| toHTMLAnchorElement(anchor)->sendPings(destinationURL);
|
| @@ -1904,7 +1907,7 @@ WebURLRequest WebLocalFrameImpl::requestFromHistoryItem(const WebHistoryItem& it
|
| WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
|
| const WebURL& overrideUrl) const
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| ResourceRequest request = frame()->loader().resourceRequestForReload(
|
| static_cast<FrameLoadType>(loadType), overrideUrl);
|
| return WrappedResourceRequest(request);
|
| @@ -1913,8 +1916,8 @@ WebURLRequest WebLocalFrameImpl::requestForReload(WebFrameLoadType loadType,
|
| void WebLocalFrameImpl::load(const WebURLRequest& request, WebFrameLoadType webFrameLoadType,
|
| const WebHistoryItem& item, WebHistoryLoadType webHistoryLoadType, bool isClientRedirect)
|
| {
|
| - ASSERT(frame());
|
| - ASSERT(!request.isNull());
|
| + DCHECK(frame());
|
| + DCHECK(!request.isNull());
|
| const ResourceRequest& resourceRequest = request.toResourceRequest();
|
|
|
| if (resourceRequest.url().protocolIs("javascript")
|
| @@ -1937,7 +1940,7 @@ void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType,
|
| WebFrameLoadType webFrameLoadType, const WebHistoryItem& item,
|
| WebHistoryLoadType webHistoryLoadType, bool isClientRedirect)
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
|
|
| // If we are loading substitute data to replace an existing load, then
|
| // inherit all of the properties of that original request. This way,
|
| @@ -1952,7 +1955,7 @@ void WebLocalFrameImpl::loadData(const WebData& data, const WebString& mimeType,
|
| request.setCheckForBrowserSideNavigation(false);
|
|
|
| FrameLoadRequest frameRequest(0, request, SubstituteData(data, mimeType, textEncoding, unreachableURL));
|
| - ASSERT(frameRequest.substituteData().isValid());
|
| + DCHECK(frameRequest.substituteData().isValid());
|
| frameRequest.setReplacesCurrentItem(replace);
|
| if (isClientRedirect)
|
| frameRequest.setClientRedirect(ClientRedirect);
|
| @@ -1984,7 +1987,7 @@ bool WebLocalFrameImpl::isNavigationScheduledWithin(double intervalInSeconds) co
|
|
|
| void WebLocalFrameImpl::setCommittedFirstRealLoad()
|
| {
|
| - ASSERT(frame());
|
| + DCHECK(frame());
|
| ensureFrameLoaderHasCommitted(frame()->loader());
|
| }
|
|
|
| @@ -2012,8 +2015,8 @@ void WebLocalFrameImpl::willShowInstallBannerPrompt(int requestId, const WebVect
|
|
|
| void WebLocalFrameImpl::requestRunTask(WebSuspendableTask* task) const
|
| {
|
| - ASSERT(frame());
|
| - ASSERT(frame()->document());
|
| + DCHECK(frame());
|
| + DCHECK(frame()->document());
|
| frame()->document()->postSuspendableTask(WebSuspendableTaskWrapper::create(adoptPtr(task)));
|
| }
|
|
|
| @@ -2055,7 +2058,7 @@ void WebLocalFrameImpl::cancelPendingScopingEffort()
|
| void WebLocalFrameImpl::increaseMatchCount(int count, int identifier)
|
| {
|
| // This function should only be called on the mainframe.
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
| ensureTextFinder().increaseMatchCount(identifier, count);
|
| }
|
|
|
| @@ -2066,13 +2069,13 @@ void WebLocalFrameImpl::resetMatchCount()
|
|
|
| void WebLocalFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent& event)
|
| {
|
| - ASSERT(!event.isNull());
|
| + DCHECK(!event.isNull());
|
| frame()->localDOMWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, nullptr);
|
| }
|
|
|
| int WebLocalFrameImpl::findMatchMarkersVersion() const
|
| {
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
|
|
| if (m_textFinder)
|
| return m_textFinder->findMatchMarkersVersion();
|
| @@ -2081,13 +2084,13 @@ int WebLocalFrameImpl::findMatchMarkersVersion() const
|
|
|
| int WebLocalFrameImpl::selectNearestFindMatch(const WebFloatPoint& point, WebRect* selectionRect)
|
| {
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
| return ensureTextFinder().selectNearestFindMatch(point, selectionRect);
|
| }
|
|
|
| WebFloatRect WebLocalFrameImpl::activeFindMatchRect()
|
| {
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
|
|
| if (m_textFinder)
|
| return m_textFinder->activeFindMatchRect();
|
| @@ -2096,7 +2099,7 @@ WebFloatRect WebLocalFrameImpl::activeFindMatchRect()
|
|
|
| void WebLocalFrameImpl::findMatchRects(WebVector<WebFloatRect>& outputRects)
|
| {
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
| ensureTextFinder().findMatchRects(outputRects);
|
| }
|
|
|
| @@ -2132,7 +2135,7 @@ void WebLocalFrameImpl::willDetachParent()
|
|
|
| WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const
|
| {
|
| - ASSERT(!parent());
|
| + DCHECK(!parent());
|
|
|
| if (m_textFinder)
|
| return m_textFinder->activeMatchFrame();
|
|
|