| Index: Source/core/inspector/InspectorPageAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
|
| index b7d087e9524d7457da727c4addac7e1a3a296328..076da51099406fa7aa744e7abf7e9511ef5adc72 100644
|
| --- a/Source/core/inspector/InspectorPageAgent.cpp
|
| +++ b/Source/core/inspector/InspectorPageAgent.cpp
|
| @@ -502,7 +502,7 @@
|
| m_instrumentingAgents->setInspectorPageAgent(this);
|
| if (m_inspectorResourceContentLoader)
|
| m_inspectorResourceContentLoader->dispose();
|
| - m_inspectorResourceContentLoader = adoptPtrWillBeNoop(new InspectorResourceContentLoader(inspectedFrame()));
|
| + m_inspectorResourceContentLoader = adoptPtrWillBeNoop(new InspectorResourceContentLoader(m_page));
|
| }
|
|
|
| void InspectorPageAgent::discardAgent()
|
| @@ -588,12 +588,13 @@
|
| {
|
| m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *optionalScriptToEvaluateOnLoad : "";
|
| m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPreprocessor : "";
|
| - inspectedFrame()->reload(asBool(optionalIgnoreCache) ? EndToEndReload : NormalReload, NotClientRedirect);
|
| + m_page->mainFrame()->reload(asBool(optionalIgnoreCache) ? EndToEndReload : NormalReload, NotClientRedirect);
|
| }
|
|
|
| void InspectorPageAgent::navigate(ErrorString*, const String& url, String* outFrameId)
|
| {
|
| - *outFrameId = frameId(inspectedFrame());
|
| + LocalFrame* frame = m_page->deprecatedLocalMainFrame();
|
| + *outFrameId = frameId(frame);
|
| }
|
|
|
| static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
|
| @@ -699,7 +700,7 @@
|
| {
|
| ListHashSet<Cookie> rawCookiesList;
|
|
|
| - for (Frame* frame = inspectedFrame(); frame; frame = frame->tree().traverseNext(inspectedFrame())) {
|
| + for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext(mainFrame())) {
|
| if (!frame->isLocalFrame())
|
| continue;
|
| Document* document = toLocalFrame(frame)->document();
|
| @@ -721,7 +722,7 @@
|
| void InspectorPageAgent::deleteCookie(ErrorString*, const String& cookieName, const String& url)
|
| {
|
| KURL parsedURL(ParsedURLString, url);
|
| - for (Frame* frame = inspectedFrame(); frame; frame = frame->tree().traverseNext(inspectedFrame())) {
|
| + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext(m_page->mainFrame())) {
|
| if (frame->isLocalFrame())
|
| blink::deleteCookie(toLocalFrame(frame)->document(), parsedURL, cookieName);
|
| }
|
| @@ -729,7 +730,7 @@
|
|
|
| void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>& object)
|
| {
|
| - object = buildObjectForFrameTree(inspectedFrame());
|
| + object = buildObjectForFrameTree(m_page->deprecatedLocalMainFrame());
|
| }
|
|
|
| void InspectorPageAgent::getResourceContentAfterResourcesContentLoaded(const String& frameId, const String& url, PassRefPtrWillBeRawPtr<GetResourceContentCallback> callback)
|
| @@ -908,8 +909,8 @@
|
| m_state->setBoolean(PageAgentState::pageAgentShowPaintRects, show);
|
| m_client->setShowPaintRects(show);
|
|
|
| - if (!show && inspectedFrame() && inspectedFrame()->isMainFrame() && inspectedFrame()->view())
|
| - inspectedFrame()->view()->invalidate();
|
| + if (!show && mainFrame() && mainFrame()->view())
|
| + mainFrame()->view()->invalidate();
|
| }
|
|
|
| void InspectorPageAgent::setShowDebugBorders(ErrorString* errorString, bool show)
|
| @@ -949,7 +950,7 @@
|
| {
|
| bool disabledByScriptController = false;
|
| bool disabledInSettings = false;
|
| - LocalFrame* frame = inspectedFrame();
|
| + LocalFrame* frame = mainFrame();
|
| if (frame) {
|
| disabledByScriptController = !frame->script().canExecuteScripts(NotAboutToExecuteScript);
|
| if (frame->settings())
|
| @@ -968,10 +969,10 @@
|
| void InspectorPageAgent::setScriptExecutionDisabled(ErrorString*, bool value)
|
| {
|
| m_state->setBoolean(PageAgentState::pageAgentScriptExecutionDisabled, value);
|
| - if (!inspectedFrame())
|
| - return;
|
| -
|
| - Settings* settings = inspectedFrame()->settings();
|
| + if (!mainFrame())
|
| + return;
|
| +
|
| + Settings* settings = mainFrame()->settings();
|
| if (settings) {
|
| m_ignoreScriptsEnabledNotification = true;
|
| settings->setScriptEnabled(!value);
|
| @@ -998,21 +999,24 @@
|
|
|
| void InspectorPageAgent::domContentLoadedEventFired(LocalFrame* frame)
|
| {
|
| - if (frame != inspectedFrame())
|
| + if (!frame->isMainFrame())
|
| return;
|
| m_frontend->domContentEventFired(currentTime());
|
| }
|
|
|
| void InspectorPageAgent::loadEventFired(LocalFrame* frame)
|
| {
|
| - if (frame != inspectedFrame())
|
| + if (!frame->isMainFrame())
|
| return;
|
| m_frontend->loadEventFired(currentTime());
|
| }
|
|
|
| void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
|
| {
|
| - if (loader->frame() == inspectedFrame()) {
|
| + // FIXME: If "frame" is always guaranteed to be in the same Page as loader->frame()
|
| + // then all we need to check here is loader->frame()->isMainFrame()
|
| + // and we don't need "frame" at all.
|
| + if (loader->frame() == m_page->mainFrame()) {
|
| m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
|
| m_scriptPreprocessorSource = m_pendingScriptPreprocessor;
|
| m_pendingScriptToEvaluateOnLoadOnce = String();
|
| @@ -1042,12 +1046,7 @@
|
| }
|
| }
|
|
|
| -FrameHost* InspectorPageAgent::frameHost()
|
| -{
|
| - return &m_page->frameHost();
|
| -}
|
| -
|
| -LocalFrame* InspectorPageAgent::inspectedFrame()
|
| +LocalFrame* InspectorPageAgent::mainFrame()
|
| {
|
| return m_page->deprecatedLocalMainFrame();
|
| }
|
| @@ -1089,7 +1088,8 @@
|
|
|
| LocalFrame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
|
| {
|
| - for (Frame* frame = inspectedFrame(); frame; frame = frame->tree().traverseNext(inspectedFrame())) {
|
| + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
|
| + // FIXME: RemoteFrame security origins are not yet available.
|
| if (!frame->isLocalFrame())
|
| continue;
|
| RefPtr<SecurityOrigin> documentOrigin = toLocalFrame(frame)->document()->securityOrigin();
|
| @@ -1113,7 +1113,7 @@
|
| DEFINE_STATIC_LOCAL(const AtomicString, deprecatedSourceMapHttpHeader, ("X-SourceMap", AtomicString::ConstructFromLiteral));
|
| if (url.isEmpty())
|
| return nullAtom;
|
| - LocalFrame* frame = inspectedFrame();
|
| + LocalFrame* frame = mainFrame();
|
| if (!frame)
|
| return nullAtom;
|
| Resource* resource = cachedResource(frame, KURL(ParsedURLString, url));
|
| @@ -1217,10 +1217,10 @@
|
|
|
| void InspectorPageAgent::viewportChanged()
|
| {
|
| - if (!m_enabled || !m_deviceMetricsOverridden || !inspectedFrame()->isMainFrame())
|
| - return;
|
| - IntSize contentsSize = inspectedFrame()->view()->contentsSize();
|
| - IntRect viewRect = inspectedFrame()->view()->visibleContentRect();
|
| + if (!m_enabled || !m_deviceMetricsOverridden)
|
| + return;
|
| + IntSize contentsSize = m_page->deprecatedLocalMainFrame()->view()->contentsSize();
|
| + IntRect viewRect = m_page->deprecatedLocalMainFrame()->view()->visibleContentRect();
|
| RefPtr<TypeBuilder::Page::Viewport> viewport = TypeBuilder::Page::Viewport::create()
|
| .setScrollX(viewRect.x())
|
| .setScrollY(viewRect.y())
|
| @@ -1234,8 +1234,6 @@
|
|
|
| void InspectorPageAgent::didResizeMainFrame()
|
| {
|
| - if (!inspectedFrame()->isMainFrame())
|
| - return;
|
| #if !OS(ANDROID)
|
| if (m_enabled && m_state->getBoolean(PageAgentState::showSizeOnResize))
|
| m_overlay->showAndHideViewSize(m_state->getBoolean(PageAgentState::showGridOnResize));
|
| @@ -1348,8 +1346,6 @@
|
| {
|
| if (enabled && !m_page->settings().acceleratedCompositingEnabled())
|
| return;
|
| - if (!inspectedFrame()->isMainFrame())
|
| - return;
|
|
|
| m_deviceMetricsOverridden = enabled;
|
| m_emulateMobileEnabled = mobile;
|
| @@ -1358,7 +1354,7 @@
|
| else
|
| m_client->clearDeviceMetricsOverride();
|
|
|
| - Document* document = inspectedFrame()->document();
|
| + Document* document = mainFrame()->document();
|
| if (document) {
|
| document->styleResolverChanged();
|
| document->mediaQueryAffectingValueChanged();
|
| @@ -1381,8 +1377,6 @@
|
|
|
| void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
|
| {
|
| - if (!inspectedFrame()->isMainFrame())
|
| - return;
|
| if (!m_touchEmulationEnabled) {
|
| m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled();
|
| m_originalDeviceSupportsMouse = m_page->settings().deviceSupportsMouse();
|
| @@ -1398,7 +1392,7 @@
|
| }
|
| m_touchEmulationEnabled = enabled;
|
| m_client->setTouchEventEmulationEnabled(enabled);
|
| - inspectedFrame()->view()->layout();
|
| + m_page->deprecatedLocalMainFrame()->view()->layout();
|
| }
|
|
|
| void InspectorPageAgent::setTouchEmulationEnabled(ErrorString*, bool enabled, const String* configuration)
|
| @@ -1412,14 +1406,14 @@
|
|
|
| void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
|
| {
|
| - if (!inspectedFrame()->isMainFrame())
|
| - return;
|
| String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMedia);
|
| if (media == currentMedia)
|
| return;
|
|
|
| m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
|
| - Document* document = inspectedFrame()->document();
|
| + Document* document = 0;
|
| + if (m_page->mainFrame())
|
| + document = m_page->deprecatedLocalMainFrame()->document();
|
| if (document) {
|
| document->mediaQueryAffectingValueChanged();
|
| document->styleResolverChanged();
|
| @@ -1480,12 +1474,12 @@
|
|
|
| void InspectorPageAgent::animationsPlaybackRate(ErrorString*, double* playbackRate)
|
| {
|
| - *playbackRate = inspectedFrame()->document()->timeline().playbackRate();
|
| + *playbackRate = toLocalFrame(m_page->mainFrame())->document()->timeline().playbackRate();
|
| }
|
|
|
| void InspectorPageAgent::setAnimationsPlaybackRate(ErrorString*, double playbackRate)
|
| {
|
| - for (Frame* frame = inspectedFrame(); frame; frame = frame->tree().traverseNext(inspectedFrame())) {
|
| + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
|
| if (frame->isLocalFrame())
|
| toLocalFrame(frame)->document()->timeline().setPlaybackRate(playbackRate);
|
| }
|
|
|