Web Inspector: disambiguate inspected/frontend controllers and pages in backend code
https://bugs.webkit.org/show_bug.cgi?id=149071
Reviewed by Joseph Pecoraro.
Source/WebCore:
Be consistent about prefixing pages, inspector controllers, and window controllers
with either "frontend" or "inspected", as appropriate. This change makes obvious some bugs
in the frontend connection code, which are tracked by https://webkit.org/b/149006.
No new tests, no behavior change.
* WebCore.order:
* inspector/InspectorClient.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::inspectedPageDestroyed):
(WebCore::InspectorController::show):
(WebCore::InspectorController::close):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
(WebCore::InspectorFrontendClientLocal::~InspectorFrontendClientLocal):
(WebCore::InspectorFrontendClientLocal::canAttachWindow):
(WebCore::InspectorFrontendClientLocal::changeAttachedWindowHeight):
(WebCore::InspectorFrontendClientLocal::changeAttachedWindowWidth):
(WebCore::InspectorFrontendClientLocal::openInNewTab):
(WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
(WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
(WebCore::InspectorFrontendClientLocal::isUnderTest):
* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::freePage):
* loader/EmptyClients.h:
Source/WebKit/ios:
* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::inspectedPageDestroyed): Renamed.
(WebInspectorClient::openLocalFrontend): Renamed.
(WebInspectorClient::closeLocalFrontend): Renamed.
(WebInspectorClient::inspectorDestroyed): Deleted.
(WebInspectorClient::openInspectorFrontend): Deleted.
(WebInspectorClient::closeInspectorFrontend): Deleted.
(WebInspectorClient::showInspectorIndication):
(WebInspectorClient::hideInspectorIndication):
(WebInspectorClient::didSetSearchingForNode):
(WebInspectorFrontendClient::WebInspectorFrontendClient):
Source/WebKit/mac:
Be consistent about prefixing pages, inspector controllers, and window controllers
with either "frontend" or "inspected", as appropriate. This change makes obvious some bugs
in the frontend connection code, which are tracked by https://webkit.org/b/149006.
* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::WebInspectorClient): Renamed.
(WebInspectorClient::inspectedPageDestroyed): Renamed.
(WebInspectorClient::openLocalFrontend): Renamed.
(WebInspectorClient::closeLocalFrontend): Renamed.
(WebInspectorClient::didSetSearchingForNode):
(WebInspectorFrontendClient::WebInspectorFrontendClient):
(WebInspectorFrontendClient::attachAvailabilityChanged):
(WebInspectorFrontendClient::canAttach):
(WebInspectorFrontendClient::frontendLoaded):
(WebInspectorFrontendClient::startWindowDrag):
(WebInspectorFrontendClient::bringToFront):
(WebInspectorFrontendClient::closeWindow):
(WebInspectorFrontendClient::disconnectFromBackend):
(WebInspectorFrontendClient::attachWindow):
(WebInspectorFrontendClient::detachWindow):
(WebInspectorFrontendClient::setAttachedWindowHeight):
(WebInspectorFrontendClient::setToolbarHeight):
(WebInspectorFrontendClient::updateWindowTitle):
(WebInspectorFrontendClient::save):
(WebInspectorFrontendClient::append):
(-[WebInspectorWindowController init]):
(-[WebInspectorWindowController initWithInspectedWebView:isUnderTest:]):
(-[WebInspectorWindowController dealloc]):
(-[WebInspectorWindowController frontendWebView]):
(-[WebInspectorWindowController close]):
(-[WebInspectorWindowController showWindow:]):
(-[WebInspectorWindowController setAttachedWindowHeight:]):
(-[WebInspectorWindowController destroyInspectorView]):
(-[WebInspectorWindowController webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles:]):
(WebInspectorClient::inspectorDestroyed): Deleted.
(WebInspectorClient::openInspectorFrontend): Deleted.
(WebInspectorClient::closeInspectorFrontend): Deleted.
(-[WebInspectorWindowController webView]): Deleted.
* WebInspector/WebInspector.h:
* WebInspector/WebInspector.mm:
(-[WebInspector initWithInspectedWebView:]): Renamed.
(-[WebInspector inspectedWebViewClosed]): Renamed.
(-[WebInspector showWindow]):
(-[WebInspector close:]):
(-[WebInspector evaluateInFrontend:script:]):
(-[WebInspector releaseFrontend]):
(-[WebInspector initWithWebView:]): Deleted.
(-[WebInspector webViewClosed]): Deleted.
* WebView/WebView.mm:
(-[WebView _close]):
(-[WebView inspector]):
Source/WebKit/win:
Be consistent about prefixing pages, inspector controllers, and window controllers
with either "frontend" or "inspected", as appropriate. This change makes obvious some bugs
in the frontend connection code, which are tracked by https://webkit.org/b/149006.
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorClient::inspectedPageDestroyed): Renamed.
(WebInspectorClient::openLocalFrontend): Renamed.
(WebInspectorClient::closeLocalFrontend): Renamed.
(WebInspectorClient::inspectorDestroyed): Deleted.
(WebInspectorClient::openInspectorFrontend): Deleted.
(WebInspectorClient::closeInspectorFrontend): Deleted.
* WebCoreSupport/WebInspectorClient.h:
* WebInspector.cpp:
(WebInspector::createInstance):
(WebInspector::WebInspector):
(WebInspector::inspectedWebViewClosed): Renamed.
(WebInspector::show):
(WebInspector::close):
(WebInspector::isJavaScriptProfilingEnabled):
(WebInspector::setJavaScriptProfilingEnabled):
(WebInspector::evaluateInFrontend):
(WebInspector::webViewClosed): Deleted.
* WebInspector.h:
* WebView.cpp:
(WebView::close):
Source/WebKit2:
* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::inspectedPageDestroyed): Renamed.
(WebKit::WebInspectorClient::openLocalFrontend): Renamed.
(WebKit::WebInspectorClient::closeLocalFrontend): Renamed.
(WebKit::WebInspectorClient::inspectorDestroyed): Deleted.
(WebKit::WebInspectorClient::openInspectorFrontend): Deleted.
(WebKit::WebInspectorClient::closeInspectorFrontend): Deleted.
* WebProcess/WebCoreSupport/WebInspectorClient.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@189654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 6dfcca5..b961d0d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2015-09-12 Brian Burg <bburg@apple.com>
+
+ Web Inspector: disambiguate inspected/frontend controllers and pages in backend code
+ https://bugs.webkit.org/show_bug.cgi?id=149071
+
+ Reviewed by Joseph Pecoraro.
+
+ Be consistent about prefixing pages, inspector controllers, and window controllers
+ with either "frontend" or "inspected", as appropriate. This change makes obvious some bugs
+ in the frontend connection code, which are tracked by https://webkit.org/b/149006.
+
+ No new tests, no behavior change.
+
+ * WebCore.order:
+ * inspector/InspectorClient.h:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::inspectedPageDestroyed):
+ (WebCore::InspectorController::show):
+ (WebCore::InspectorController::close):
+ * inspector/InspectorFrontendClientLocal.cpp:
+ (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
+ (WebCore::InspectorFrontendClientLocal::~InspectorFrontendClientLocal):
+ (WebCore::InspectorFrontendClientLocal::canAttachWindow):
+ (WebCore::InspectorFrontendClientLocal::changeAttachedWindowHeight):
+ (WebCore::InspectorFrontendClientLocal::changeAttachedWindowWidth):
+ (WebCore::InspectorFrontendClientLocal::openInNewTab):
+ (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
+ (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
+ (WebCore::InspectorFrontendClientLocal::isUnderTest):
+ * inspector/InspectorFrontendClientLocal.h:
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::InspectorOverlay::freePage):
+ * loader/EmptyClients.h:
+
2015-09-12 Chris Dumez <cdumez@apple.com>
ChildNode.replaceWith() without argument should replace the node with an empty DocumentFragment
diff --git a/Source/WebCore/inspector/InspectorClient.h b/Source/WebCore/inspector/InspectorClient.h
index 6d39a4c..0edcd08 100644
--- a/Source/WebCore/inspector/InspectorClient.h
+++ b/Source/WebCore/inspector/InspectorClient.h
@@ -46,10 +46,10 @@
public:
virtual ~InspectorClient() { }
- virtual void inspectorDestroyed() = 0;
+ virtual void inspectedPageDestroyed() = 0;
- virtual Inspector::FrontendChannel* openInspectorFrontend(InspectorController*) = 0;
- virtual void closeInspectorFrontend() = 0;
+ virtual Inspector::FrontendChannel* openLocalFrontend(InspectorController*) = 0;
+ virtual void closeLocalFrontend() = 0;
virtual void bringFrontendToFront() = 0;
virtual void didResizeMainFrame(Frame*) { }
diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp
index cf8cb02..99ffd8e 100644
--- a/Source/WebCore/inspector/InspectorController.cpp
+++ b/Source/WebCore/inspector/InspectorController.cpp
@@ -199,7 +199,7 @@
disconnectAllFrontends();
m_injectedScriptManager->disconnect();
- m_inspectorClient->inspectorDestroyed();
+ m_inspectorClient->inspectedPageDestroyed();
m_inspectorClient = nullptr;
}
@@ -319,14 +319,14 @@
if (m_frontendRouter->hasLocalFrontend())
m_inspectorClient->bringFrontendToFront();
- else if (Inspector::FrontendChannel* frontendChannel = m_inspectorClient->openInspectorFrontend(this))
+ else if (Inspector::FrontendChannel* frontendChannel = m_inspectorClient->openLocalFrontend(this))
connectFrontend(frontendChannel);
}
void InspectorController::close()
{
if (m_frontendRouter->hasLocalFrontend())
- m_inspectorClient->closeInspectorFrontend();
+ m_inspectorClient->closeLocalFrontend();
ASSERT(!m_frontendRouter->hasLocalFrontend());
}
diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp b/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
index b82977b..4f6b77d 100644
--- a/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
+++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
@@ -128,7 +128,7 @@
}
InspectorFrontendClientLocal::InspectorFrontendClientLocal(InspectorController* inspectedPageController, Page* frontendPage, std::unique_ptr<Settings> settings)
- : m_inspectorController(inspectedPageController)
+ : m_inspectedPageController(inspectedPageController)
, m_frontendPage(frontendPage)
, m_settings(WTF::move(settings))
, m_dockSide(DockSide::Undocked)
@@ -142,7 +142,7 @@
if (m_frontendHost)
m_frontendHost->disconnectClient();
m_frontendPage = nullptr;
- m_inspectorController = nullptr;
+ m_inspectedPageController = nullptr;
m_dispatchTask->reset();
}
@@ -184,7 +184,7 @@
bool InspectorFrontendClientLocal::canAttachWindow()
{
// Don't allow attaching to another inspector -- two inspectors in one window is too much!
- bool isInspectorPage = m_inspectorController->hasInspectorFrontendClient();
+ bool isInspectorPage = m_inspectedPageController->hasInspectorFrontendClient();
if (isInspectorPage)
return false;
@@ -193,8 +193,8 @@
return true;
// Don't allow the attach if the window would be too small to accommodate the minimum inspector size.
- unsigned inspectedPageHeight = m_inspectorController->inspectedPage().mainFrame().view()->visibleHeight();
- unsigned inspectedPageWidth = m_inspectorController->inspectedPage().mainFrame().view()->visibleWidth();
+ unsigned inspectedPageHeight = m_inspectedPageController->inspectedPage().mainFrame().view()->visibleHeight();
+ unsigned inspectedPageWidth = m_inspectedPageController->inspectedPage().mainFrame().view()->visibleWidth();
unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
return minimumAttachedHeight <= maximumAttachedHeight && minimumAttachedWidth <= inspectedPageWidth;
}
@@ -206,7 +206,7 @@
void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
{
- unsigned totalHeight = m_frontendPage->mainFrame().view()->visibleHeight() + m_inspectorController->inspectedPage().mainFrame().view()->visibleHeight();
+ unsigned totalHeight = m_frontendPage->mainFrame().view()->visibleHeight() + m_inspectedPageController->inspectedPage().mainFrame().view()->visibleHeight();
unsigned attachedHeight = constrainedAttachedWindowHeight(height, totalHeight);
m_settings->setProperty(inspectorAttachedHeightSetting, String::number(attachedHeight));
setAttachedWindowHeight(attachedHeight);
@@ -214,7 +214,7 @@
void InspectorFrontendClientLocal::changeAttachedWindowWidth(unsigned width)
{
- unsigned totalWidth = m_frontendPage->mainFrame().view()->visibleWidth() + m_inspectorController->inspectedPage().mainFrame().view()->visibleWidth();
+ unsigned totalWidth = m_frontendPage->mainFrame().view()->visibleWidth() + m_inspectedPageController->inspectedPage().mainFrame().view()->visibleWidth();
unsigned attachedWidth = constrainedAttachedWindowWidth(width, totalWidth);
setAttachedWindowWidth(attachedWidth);
}
@@ -222,7 +222,7 @@
void InspectorFrontendClientLocal::openInNewTab(const String& url)
{
UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
- Frame& mainFrame = m_inspectorController->inspectedPage().mainFrame();
+ Frame& mainFrame = m_inspectedPageController->inspectedPage().mainFrame();
FrameLoadRequest request(mainFrame.document()->securityOrigin(), ResourceRequest(), "_blank", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
bool created;
@@ -269,7 +269,7 @@
void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
{
- unsigned inspectedPageHeight = m_inspectorController->inspectedPage().mainFrame().view()->visibleHeight();
+ unsigned inspectedPageHeight = m_inspectedPageController->inspectedPage().mainFrame().view()->visibleHeight();
String value = m_settings->getProperty(inspectorAttachedHeightSetting);
unsigned preferredHeight = value.isEmpty() ? defaultAttachedHeight : value.toUInt();
@@ -332,7 +332,7 @@
void InspectorFrontendClientLocal::showMainResourceForFrame(Frame* frame)
{
- String frameId = m_inspectorController->pageAgent()->frameId(frame);
+ String frameId = m_inspectedPageController->pageAgent()->frameId(frame);
evaluateOnLoad(String::format("[\"showMainResourceForFrame\", \"%s\"]", frameId.ascii().data()));
}
@@ -353,7 +353,7 @@
bool InspectorFrontendClientLocal::isUnderTest()
{
- return m_inspectorController->isUnderTest();
+ return m_inspectedPageController->isUnderTest();
}
bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& expression)
diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.h b/Source/WebCore/inspector/InspectorFrontendClientLocal.h
index 1351e06..88b83b3 100644
--- a/Source/WebCore/inspector/InspectorFrontendClientLocal.h
+++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.h
@@ -55,7 +55,7 @@
virtual void setProperty(const String& name, const String& value);
};
- WEBCORE_EXPORT InspectorFrontendClientLocal(InspectorController*, Page*, std::unique_ptr<Settings>);
+ WEBCORE_EXPORT InspectorFrontendClientLocal(InspectorController* inspectedPageController, Page* frontendPage, std::unique_ptr<Settings>);
WEBCORE_EXPORT virtual ~InspectorFrontendClientLocal();
WEBCORE_EXPORT virtual void windowObjectCleared() override final;
@@ -114,7 +114,7 @@
void evaluateOnLoad(const String& expression);
friend class FrontendMenuProvider;
- InspectorController* m_inspectorController { nullptr };
+ InspectorController* m_inspectedPageController { nullptr };
Page* m_frontendPage { nullptr };
// TODO(yurys): this ref shouldn't be needed.
RefPtr<InspectorFrontendHost> m_frontendHost;
diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp
index ddb868f..a31da79 100644
--- a/Source/WebCore/inspector/InspectorOverlay.cpp
+++ b/Source/WebCore/inspector/InspectorOverlay.cpp
@@ -947,7 +947,7 @@
void InspectorOverlay::freePage()
{
- m_overlayPage.reset();
+ m_overlayPage = nullptr;
}
} // namespace WebCore
diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h
index 8c57d6e..0f00d7b 100644
--- a/Source/WebCore/loader/EmptyClients.h
+++ b/Source/WebCore/loader/EmptyClients.h
@@ -593,10 +593,10 @@
EmptyInspectorClient() { }
virtual ~EmptyInspectorClient() { }
- virtual void inspectorDestroyed() override { }
+ virtual void inspectedPageDestroyed() override { }
- virtual Inspector::FrontendChannel* openInspectorFrontend(InspectorController*) override { return 0; }
- virtual void closeInspectorFrontend() override { }
+ virtual Inspector::FrontendChannel* openLocalFrontend(InspectorController*) override { return 0; }
+ virtual void closeLocalFrontend() override { }
virtual void bringFrontendToFront() override { }
virtual void highlight() override { }
diff --git a/Source/WebKit/ios/ChangeLog b/Source/WebKit/ios/ChangeLog
index d4a4683..78f4e51 100644
--- a/Source/WebKit/ios/ChangeLog
+++ b/Source/WebKit/ios/ChangeLog
@@ -1,3 +1,23 @@
+2015-09-12 Brian Burg <bburg@apple.com>
+
+ Web Inspector: disambiguate inspected/frontend controllers and pages in backend code
+ https://bugs.webkit.org/show_bug.cgi?id=149071
+
+ Reviewed by Joseph Pecoraro.
+
+ * WebCoreSupport/WebInspectorClientIOS.mm:
+ (WebInspectorClient::WebInspectorClient):
+ (WebInspectorClient::inspectedPageDestroyed): Renamed.
+ (WebInspectorClient::openLocalFrontend): Renamed.
+ (WebInspectorClient::closeLocalFrontend): Renamed.
+ (WebInspectorClient::inspectorDestroyed): Deleted.
+ (WebInspectorClient::openInspectorFrontend): Deleted.
+ (WebInspectorClient::closeInspectorFrontend): Deleted.
+ (WebInspectorClient::showInspectorIndication):
+ (WebInspectorClient::hideInspectorIndication):
+ (WebInspectorClient::didSetSearchingForNode):
+ (WebInspectorFrontendClient::WebInspectorFrontendClient):
+
2015-08-17 Filip Pizlo <fpizlo@apple.com>
Replace all remaining uses of WTF::Mutex with WTF::Lock
diff --git a/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm b/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm
index 81b06ea..0d6dc71 100644
--- a/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm
+++ b/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm
@@ -42,19 +42,18 @@
using namespace WebCore;
-WebInspectorClient::WebInspectorClient(WebView *webView)
- : m_webView(webView)
- , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:webView]))
- , m_frontendPage(0)
+WebInspectorClient::WebInspectorClient(WebView* inpectedWebView)
+ : m_inspectedWebView(inpectedWebView)
+ , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:inpectedWebView]))
{
}
-void WebInspectorClient::inspectorDestroyed()
+void WebInspectorClient::inspectedPageDestroyed()
{
delete this;
}
-Inspector::FrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController*)
+Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController*)
{
// iOS does not have a local inspector, this should not be reached.
ASSERT_NOT_REACHED();
@@ -66,7 +65,7 @@
// iOS does not have a local inspector, nothing to do here.
}
-void WebInspectorClient::closeInspectorFrontend()
+void WebInspectorClient::closeLocalFrontend()
{
// iOS does not have a local inspector, nothing to do here.
}
@@ -88,12 +87,12 @@
void WebInspectorClient::showInspectorIndication()
{
- [m_webView setShowingInspectorIndication:YES];
+ [m_inspectedWebView setShowingInspectorIndication:YES];
}
void WebInspectorClient::hideInspectorIndication()
{
- [m_webView setShowingInspectorIndication:NO];
+ [m_inspectedWebView setShowingInspectorIndication:NO];
}
void WebInspectorClient::setShowPaintRects(bool)
@@ -108,7 +107,7 @@
void WebInspectorClient::didSetSearchingForNode(bool enabled)
{
- WebInspector *inspector = [m_webView inspector];
+ WebInspector *inspector = [m_inspectedWebView inspector];
NSString *notificationName = enabled ? WebInspectorDidStartSearchingForNode : WebInspectorDidStopSearchingForNode;
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:inspector];
@@ -118,8 +117,8 @@
#pragma mark -
#pragma mark WebInspectorFrontendClient Implementation
-WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* windowController, InspectorController* inspectorController, Page* frontendPage, std::unique_ptr<Settings> settings)
- : InspectorFrontendClientLocal(inspectorController, frontendPage, WTF::move(settings))
+WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* frontendWindowController, InspectorController* inspectedPageController, Page* frontendPage, std::unique_ptr<Settings> settings)
+ : InspectorFrontendClientLocal(inspectedPageController, frontendPage, WTF::move(settings))
{
// iOS does not have a local inspector, this should not be reached.
notImplemented();
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 03a93da..bf23736 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,63 @@
+2015-09-12 Brian Burg <bburg@apple.com>
+
+ Web Inspector: disambiguate inspected/frontend controllers and pages in backend code
+ https://bugs.webkit.org/show_bug.cgi?id=149071
+
+ Reviewed by Joseph Pecoraro.
+
+ Be consistent about prefixing pages, inspector controllers, and window controllers
+ with either "frontend" or "inspected", as appropriate. This change makes obvious some bugs
+ in the frontend connection code, which are tracked by https://webkit.org/b/149006.
+
+ * WebCoreSupport/WebInspectorClient.h:
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::WebInspectorClient): Renamed.
+ (WebInspectorClient::inspectedPageDestroyed): Renamed.
+ (WebInspectorClient::openLocalFrontend): Renamed.
+ (WebInspectorClient::closeLocalFrontend): Renamed.
+ (WebInspectorClient::didSetSearchingForNode):
+ (WebInspectorFrontendClient::WebInspectorFrontendClient):
+ (WebInspectorFrontendClient::attachAvailabilityChanged):
+ (WebInspectorFrontendClient::canAttach):
+ (WebInspectorFrontendClient::frontendLoaded):
+ (WebInspectorFrontendClient::startWindowDrag):
+ (WebInspectorFrontendClient::bringToFront):
+ (WebInspectorFrontendClient::closeWindow):
+ (WebInspectorFrontendClient::disconnectFromBackend):
+ (WebInspectorFrontendClient::attachWindow):
+ (WebInspectorFrontendClient::detachWindow):
+ (WebInspectorFrontendClient::setAttachedWindowHeight):
+ (WebInspectorFrontendClient::setToolbarHeight):
+ (WebInspectorFrontendClient::updateWindowTitle):
+ (WebInspectorFrontendClient::save):
+ (WebInspectorFrontendClient::append):
+ (-[WebInspectorWindowController init]):
+ (-[WebInspectorWindowController initWithInspectedWebView:isUnderTest:]):
+ (-[WebInspectorWindowController dealloc]):
+ (-[WebInspectorWindowController frontendWebView]):
+ (-[WebInspectorWindowController close]):
+ (-[WebInspectorWindowController showWindow:]):
+ (-[WebInspectorWindowController setAttachedWindowHeight:]):
+ (-[WebInspectorWindowController destroyInspectorView]):
+ (-[WebInspectorWindowController webView:runOpenPanelForFileButtonWithResultListener:allowMultipleFiles:]):
+ (WebInspectorClient::inspectorDestroyed): Deleted.
+ (WebInspectorClient::openInspectorFrontend): Deleted.
+ (WebInspectorClient::closeInspectorFrontend): Deleted.
+ (-[WebInspectorWindowController webView]): Deleted.
+ * WebInspector/WebInspector.h:
+ * WebInspector/WebInspector.mm:
+ (-[WebInspector initWithInspectedWebView:]): Renamed.
+ (-[WebInspector inspectedWebViewClosed]): Renamed.
+ (-[WebInspector showWindow]):
+ (-[WebInspector close:]):
+ (-[WebInspector evaluateInFrontend:script:]):
+ (-[WebInspector releaseFrontend]):
+ (-[WebInspector initWithWebView:]): Deleted.
+ (-[WebInspector webViewClosed]): Deleted.
+ * WebView/WebView.mm:
+ (-[WebView _close]):
+ (-[WebView inspector]):
+
2015-09-10 Chris Dumez <cdumez@apple.com>
Node.appendChild(null) / replaceChild(null, null) / removeChild(null) / insertBefore(null, ref) should throw a TypeError
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
index d0d44a6..7337024 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
@@ -51,12 +51,12 @@
class WebInspectorClient : public WebCore::InspectorClient, public Inspector::FrontendChannel {
public:
- explicit WebInspectorClient(WebView *);
+ explicit WebInspectorClient(WebView* inspectedWebView);
- virtual void inspectorDestroyed() override;
+ virtual void inspectedPageDestroyed() override;
- virtual Inspector::FrontendChannel* openInspectorFrontend(WebCore::InspectorController*) override;
- virtual void closeInspectorFrontend() override;
+ virtual Inspector::FrontendChannel* openLocalFrontend(WebCore::InspectorController*) override;
+ virtual void closeLocalFrontend() override;
virtual void bringFrontendToFront() override;
virtual void didResizeMainFrame(WebCore::Frame*) override;
@@ -92,9 +92,9 @@
private:
std::unique_ptr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings();
- WebView *m_webView;
+ WebView *m_inspectedWebView { nullptr };
RetainPtr<WebNodeHighlighter> m_highlighter;
- WebCore::Page* m_frontendPage;
+ WebCore::Page* m_frontendPage { nullptr };
std::unique_ptr<WebInspectorFrontendClient> m_frontendClient;
};
@@ -134,7 +134,7 @@
#if !PLATFORM(IOS)
WebView* m_inspectedWebView;
- RetainPtr<WebInspectorWindowController> m_windowController;
+ RetainPtr<WebInspectorWindowController> m_frontendWindowController;
String m_inspectedURL;
HashMap<String, RetainPtr<NSURL>> m_suggestedToActualURLMap;
#endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
index 4de8c40..9fb7662 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
@@ -68,7 +68,7 @@
@interface WebInspectorWindowController : NSWindowController <NSWindowDelegate, WebPolicyDelegate, WebUIDelegate> {
@private
RetainPtr<WebView> _inspectedWebView;
- WebView *_webView;
+ WebView* _frontendWebView;
WebInspectorFrontendClient* _frontendClient;
WebInspectorClient* _inspectorClient;
BOOL _attachedToInspectedWebView;
@@ -76,10 +76,10 @@
BOOL _visible;
BOOL _destroyingInspectorView;
}
-- (id)initWithInspectedWebView:(WebView *)webView isUnderTest:(BOOL)isUnderTest;
+- (id)initWithInspectedWebView:(WebView *)inspectedWebView isUnderTest:(BOOL)isUnderTest;
- (NSString *)inspectorPagePath;
- (NSString *)inspectorTestPagePath;
-- (WebView *)webView;
+- (WebView *)frontendWebView;
- (void)attach;
- (void)detach;
- (BOOL)attached;
@@ -94,36 +94,35 @@
// MARK: -
-WebInspectorClient::WebInspectorClient(WebView *webView)
- : m_webView(webView)
- , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:webView]))
- , m_frontendPage(nullptr)
+WebInspectorClient::WebInspectorClient(WebView* inspectedWebView)
+ : m_inspectedWebView(inspectedWebView)
+ , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:inspectedWebView]))
{
}
-void WebInspectorClient::inspectorDestroyed()
+void WebInspectorClient::inspectedPageDestroyed()
{
- closeInspectorFrontend();
+ closeLocalFrontend();
delete this;
}
-FrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* inspectorController)
+FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* inspectedPageController)
{
- RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView isUnderTest:inspectorController->isUnderTest()]);
+ RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_inspectedWebView isUnderTest:inspectedPageController->isUnderTest()]);
[windowController.get() setInspectorClient:this];
- m_frontendPage = core([windowController.get() webView]);
- m_frontendClient = std::make_unique<WebInspectorFrontendClient>(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings());
+ m_frontendPage = core([windowController.get() frontendWebView]);
+ m_frontendClient = std::make_unique<WebInspectorFrontendClient>(m_inspectedWebView, windowController.get(), inspectedPageController, m_frontendPage, createFrontendSettings());
RetainPtr<WebInspectorFrontend> webInspectorFrontend = adoptNS([[WebInspectorFrontend alloc] initWithFrontendClient:m_frontendClient.get()]);
- [[m_webView inspector] setFrontend:webInspectorFrontend.get()];
+ [[m_inspectedWebView inspector] setFrontend:webInspectorFrontend.get()];
m_frontendPage->inspectorController().setInspectorFrontendClient(m_frontendClient.get());
return this;
}
-void WebInspectorClient::closeInspectorFrontend()
+void WebInspectorClient::closeLocalFrontend()
{
if (m_frontendClient)
m_frontendClient->disconnectFromBackend();
@@ -164,7 +163,7 @@
void WebInspectorClient::didSetSearchingForNode(bool enabled)
{
- WebInspector *inspector = [m_webView inspector];
+ WebInspector *inspector = [m_inspectedWebView inspector];
ASSERT(isMainThread());
@@ -181,23 +180,23 @@
}
-WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* windowController, InspectorController* inspectorController, Page* frontendPage, std::unique_ptr<Settings> settings)
- : InspectorFrontendClientLocal(inspectorController, frontendPage, WTF::move(settings))
+WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* frontendWindowController, InspectorController* inspectedPageController, Page* frontendPage, std::unique_ptr<Settings> settings)
+ : InspectorFrontendClientLocal(inspectedPageController, frontendPage, WTF::move(settings))
, m_inspectedWebView(inspectedWebView)
- , m_windowController(windowController)
+ , m_frontendWindowController(frontendWindowController)
{
- [windowController setFrontendClient:this];
+ [frontendWindowController setFrontendClient:this];
}
void WebInspectorFrontendClient::attachAvailabilityChanged(bool available)
{
setDockingUnavailable(!available);
- [m_windowController.get() setDockingUnavailable:!available];
+ [m_frontendWindowController.get() setDockingUnavailable:!available];
}
bool WebInspectorFrontendClient::canAttach()
{
- if ([[m_windowController window] styleMask] & NSFullScreenWindowMask)
+ if ([[m_frontendWindowController window] styleMask] & NSFullScreenWindowMask)
return false;
return canAttachWindow();
@@ -205,8 +204,8 @@
void WebInspectorFrontendClient::frontendLoaded()
{
- [m_windowController.get() showWindow:nil];
- if ([m_windowController.get() attached])
+ [m_frontendWindowController.get() showWindow:nil];
+ if ([m_frontendWindowController.get() attached])
restoreAttachedWindowHeight();
InspectorFrontendClientLocal::frontendLoaded();
@@ -218,14 +217,14 @@
CallFrameLoadDelegate(implementations->didClearInspectorWindowObjectForFrameFunc, m_inspectedWebView,
@selector(webView:didClearInspectorWindowObject:forFrame:), [frame windowObject], frame);
- bool attached = [m_windowController.get() attached];
+ bool attached = [m_frontendWindowController.get() attached];
setAttachedWindow(attached ? DockSide::Bottom : DockSide::Undocked);
}
void WebInspectorFrontendClient::startWindowDrag()
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
- [[m_windowController window] performWindowDragWithEvent:[NSApp currentEvent]];
+ [[m_frontendWindowController window] performWindowDragWithEvent:[NSApp currentEvent]];
#endif
}
@@ -244,40 +243,40 @@
{
updateWindowTitle();
- [m_windowController.get() showWindow:nil];
+ [m_frontendWindowController.get() showWindow:nil];
- // Use the window from the WebView since m_windowController's window
+ // Use the window from the WebView since m_frontendWindowController's window
// is not the same when the Inspector is docked.
- WebView *webView = [m_windowController.get() webView];
- [[webView window] makeFirstResponder:webView];
+ WebView *frontendWebView = [m_frontendWindowController.get() frontendWebView];
+ [[frontendWebView window] makeFirstResponder:frontendWebView];
}
void WebInspectorFrontendClient::closeWindow()
{
- [m_windowController.get() destroyInspectorView];
+ [m_frontendWindowController.get() destroyInspectorView];
}
void WebInspectorFrontendClient::disconnectFromBackend()
{
- [m_windowController.get() destroyInspectorView];
+ [m_frontendWindowController.get() destroyInspectorView];
}
void WebInspectorFrontendClient::attachWindow(DockSide)
{
- if ([m_windowController.get() attached])
+ if ([m_frontendWindowController.get() attached])
return;
- [m_windowController.get() attach];
+ [m_frontendWindowController.get() attach];
restoreAttachedWindowHeight();
}
void WebInspectorFrontendClient::detachWindow()
{
- [m_windowController.get() detach];
+ [m_frontendWindowController.get() detach];
}
void WebInspectorFrontendClient::setAttachedWindowHeight(unsigned height)
{
- [m_windowController.get() setAttachedWindowHeight:height];
+ [m_frontendWindowController.get() setAttachedWindowHeight:height];
}
void WebInspectorFrontendClient::setAttachedWindowWidth(unsigned)
@@ -288,7 +287,7 @@
void WebInspectorFrontendClient::setToolbarHeight(unsigned height)
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
- [[m_windowController window] setContentBorderThickness:height forEdge:NSMaxYEdge];
+ [[m_frontendWindowController window] setContentBorderThickness:height forEdge:NSMaxYEdge];
#endif
}
@@ -301,7 +300,7 @@
void WebInspectorFrontendClient::updateWindowTitle() const
{
NSString *title = [NSString stringWithFormat:UI_STRING_INTERNAL("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_inspectedURL];
- [[m_windowController.get() window] setTitle:title];
+ [[m_frontendWindowController.get() window] setTitle:title];
}
void WebInspectorFrontendClient::save(const String& suggestedURL, const String& content, bool base64Encoded, bool forceSaveDialog)
@@ -337,7 +336,7 @@
} else
[contentCopy writeToURL:actualURL atomically:YES encoding:NSUTF8StringEncoding error:NULL];
- core([m_windowController webView])->mainFrame().script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.savedURL(\"%@\")", actualURL.absoluteString]);
+ core([m_frontendWindowController frontendWebView])->mainFrame().script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.savedURL(\"%@\")", actualURL.absoluteString]);
};
if (!forceSaveDialog) {
@@ -356,9 +355,9 @@
saveToURL(panel.URL);
};
- NSWindow *window = [[m_windowController webView] window];
- if (window)
- [panel beginSheetModalForWindow:window completionHandler:completionHandler];
+ NSWindow *frontendWindow = [[m_frontendWindowController frontendWebView] window];
+ if (frontendWindow)
+ [panel beginSheetModalForWindow:frontendWindow completionHandler:completionHandler];
else
completionHandler([panel runModal]);
}
@@ -377,7 +376,7 @@
[handle writeData:[content dataUsingEncoding:NSUTF8StringEncoding]];
[handle closeFile];
- core([m_windowController webView])->mainFrame().script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.appendedToURL(\"%@\")", [actualURL absoluteString]]);
+ core([m_frontendWindowController frontendWebView])->mainFrame().script().executeScript([NSString stringWithFormat:@"InspectorFrontendAPI.appendedToURL(\"%@\")", [actualURL absoluteString]]);
}
// MARK: -
@@ -405,14 +404,14 @@
[preferences setTabsToLinks:NO];
[preferences setUserStyleSheetEnabled:NO];
- _webView = [[WebView alloc] init];
- [_webView setPreferences:preferences];
- [_webView setProhibitsMainFrameScrolling:YES];
- [_webView setUIDelegate:self];
- [_webView setPolicyDelegate:self];
+ _frontendWebView = [[WebView alloc] init];
+ [_frontendWebView setPreferences:preferences];
+ [_frontendWebView setProhibitsMainFrameScrolling:YES];
+ [_frontendWebView setUIDelegate:self];
+ [_frontendWebView setPolicyDelegate:self];
#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1090
- [_webView setDrawsBackground:NO];
+ [_frontendWebView setDrawsBackground:NO];
#endif
[preferences release];
@@ -430,7 +429,7 @@
NSString *pagePath = isUnderTest ? [self inspectorTestPagePath] : [self inspectorPagePath];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath: pagePath]];
- [[_webView mainFrame] loadRequest:request];
+ [[_frontendWebView mainFrame] loadRequest:request];
[request release];
return self;
@@ -438,7 +437,7 @@
- (void)dealloc
{
- [_webView release];
+ [_frontendWebView release];
[super dealloc];
}
@@ -470,9 +469,9 @@
// MARK: -
-- (WebView *)webView
+- (WebView *)frontendWebView
{
- return _webView;
+ return _frontendWebView;
}
- (NSWindow *)window
@@ -550,7 +549,7 @@
if ([_inspectedWebView.get() _isClosed])
return;
- [_webView removeFromSuperview];
+ [_frontendWebView removeFromSuperview];
WebFrameView *frameView = [[_inspectedWebView.get() mainFrame] frameView];
NSRect frameViewRect = [frameView frame];
@@ -588,11 +587,11 @@
if (_shouldAttach) {
WebFrameView *frameView = [[_inspectedWebView.get() mainFrame] frameView];
- [_webView removeFromSuperview];
- [_inspectedWebView.get() addSubview:_webView positioned:NSWindowBelow relativeTo:(NSView *)frameView];
- [[_inspectedWebView.get() window] makeFirstResponder:_webView];
+ [_frontendWebView removeFromSuperview];
+ [_inspectedWebView.get() addSubview:_frontendWebView positioned:NSWindowBelow relativeTo:(NSView *)frameView];
+ [[_inspectedWebView.get() window] makeFirstResponder:_frontendWebView];
- [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable | NSViewMaxYMargin)];
+ [_frontendWebView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable | NSViewMaxYMargin)];
[frameView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable | NSViewMinYMargin)];
_attachedToInspectedWebView = YES;
@@ -600,10 +599,10 @@
_attachedToInspectedWebView = NO;
NSView *contentView = [[self window] contentView];
- [_webView setFrame:[contentView frame]];
- [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
- [_webView removeFromSuperview];
- [contentView addSubview:_webView];
+ [_frontendWebView setFrame:[contentView frame]];
+ [_frontendWebView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+ [_frontendWebView removeFromSuperview];
+ [contentView addSubview:_frontendWebView];
[super showWindow:nil];
}
@@ -669,7 +668,7 @@
frameViewRect.size.height += heightDifference;
frameViewRect.origin.y = height;
- [_webView setFrame:NSMakeRect(0.0, 0.0, NSWidth(frameViewRect), height)];
+ [_frontendWebView setFrame:NSMakeRect(0.0, 0.0, NSWidth(frameViewRect), height)];
[frameView setFrame:frameViewRect];
}
@@ -699,7 +698,7 @@
inspectedPage->inspectorController().disconnectFrontend(_inspectorClient);
}
- [_webView close];
+ [_frontendWebView close];
}
// MARK: -
@@ -727,8 +726,8 @@
[resultListener chooseFilenames:filenames];
};
- if (_webView.window)
- [panel beginSheetModalForWindow:_webView.window completionHandler:completionHandler];
+ if (_frontendWebView.window)
+ [panel beginSheetModalForWindow:_frontendWebView.window completionHandler:completionHandler];
else
completionHandler([panel runModal]);
}
diff --git a/Source/WebKit/mac/WebInspector/WebInspector.h b/Source/WebKit/mac/WebInspector/WebInspector.h
index b6186a1..e1b24a9 100644
--- a/Source/WebKit/mac/WebInspector/WebInspector.h
+++ b/Source/WebKit/mac/WebInspector/WebInspector.h
@@ -36,11 +36,11 @@
@interface WebInspector : NSObject
{
- WebView *_webView;
+ WebView *_inspectedWebView;
WebInspectorFrontend *_frontend;
}
-- (id)initWithWebView:(WebView *)webView;
-- (void)webViewClosed;
+- (id)initWithInspectedWebView:(WebView *)inspectedWebView;
+- (void)inspectedWebViewClosed;
- (void)show:(id)sender;
- (void)showConsole:(id)sender;
- (void)close:(id)sender;
diff --git a/Source/WebKit/mac/WebInspector/WebInspector.mm b/Source/WebKit/mac/WebInspector/WebInspector.mm
index 26daefd..9d47d25 100644
--- a/Source/WebKit/mac/WebInspector/WebInspector.mm
+++ b/Source/WebKit/mac/WebInspector/WebInspector.mm
@@ -43,11 +43,11 @@
NSString *WebInspectorDidStopSearchingForNode = @"WebInspectorDidStopSearchingForNode";
@implementation WebInspector
-- (id)initWithWebView:(WebView *)webView
+- (id)initWithInspectedWebView:(WebView *)inspectedWebView
{
if (!(self = [super init]))
return nil;
- _webView = webView; // not retained to prevent a cycle
+ _inspectedWebView = inspectedWebView; // not retained to prevent a cycle
return self;
}
@@ -58,15 +58,15 @@
[super dealloc];
}
-- (void)webViewClosed
+- (void)inspectedWebViewClosed
{
- _webView = nil;
+ _inspectedWebView = nil;
}
- (void)showWindow
{
- if (Page* page = core(_webView))
- page->inspectorController().show();
+ if (Page* inspectedPage = core(_inspectedWebView))
+ inspectedPage->inspectorController().show();
}
- (void)show:(id)sender
@@ -157,8 +157,8 @@
- (void)close:(id)sender
{
- if (Page* page = core(_webView))
- page->inspectorController().close();
+ if (Page* inspectedPage = core(_inspectedWebView))
+ inspectedPage->inspectorController().close();
}
- (void)attach:(id)sender
@@ -173,8 +173,8 @@
- (void)evaluateInFrontend:(id)sender script:(NSString *)script
{
- if (Page* page = core(_webView))
- page->inspectorController().evaluateForTestInFrontend(script);
+ if (Page* inspectedPage = core(_inspectedWebView))
+ inspectedPage->inspectorController().evaluateForTestInFrontend(script);
}
- (void)setFrontend:(WebInspectorFrontend *)frontend
@@ -185,6 +185,6 @@
- (void)releaseFrontend
{
[_frontend release];
- _frontend = 0;
+ _frontend = nil;
}
@end
diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm
index 0a982d6..8f79e26 100644
--- a/Source/WebKit/mac/WebView/WebView.mm
+++ b/Source/WebKit/mac/WebView/WebView.mm
@@ -1756,7 +1756,7 @@
[self setScriptDebugDelegate:nil];
[self setUIDelegate:nil];
- [_private->inspector webViewClosed];
+ [_private->inspector inspectedWebViewClosed];
#endif
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
[_private->immediateActionController webViewClosed];
@@ -1890,7 +1890,7 @@
- (WebInspector *)inspector
{
if (!_private->inspector)
- _private->inspector = [[WebInspector alloc] initWithWebView:self];
+ _private->inspector = [[WebInspector alloc] initWithInspectedWebView:self];
return _private->inspector;
}
diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog
index 225dfee..d7bcf38 100644
--- a/Source/WebKit/win/ChangeLog
+++ b/Source/WebKit/win/ChangeLog
@@ -1,3 +1,36 @@
+2015-09-12 Brian Burg <bburg@apple.com>
+
+ Web Inspector: disambiguate inspected/frontend controllers and pages in backend code
+ https://bugs.webkit.org/show_bug.cgi?id=149071
+
+ Reviewed by Joseph Pecoraro.
+
+ Be consistent about prefixing pages, inspector controllers, and window controllers
+ with either "frontend" or "inspected", as appropriate. This change makes obvious some bugs
+ in the frontend connection code, which are tracked by https://webkit.org/b/149006.
+
+ * WebCoreSupport/WebInspectorClient.cpp:
+ (WebInspectorClient::inspectedPageDestroyed): Renamed.
+ (WebInspectorClient::openLocalFrontend): Renamed.
+ (WebInspectorClient::closeLocalFrontend): Renamed.
+ (WebInspectorClient::inspectorDestroyed): Deleted.
+ (WebInspectorClient::openInspectorFrontend): Deleted.
+ (WebInspectorClient::closeInspectorFrontend): Deleted.
+ * WebCoreSupport/WebInspectorClient.h:
+ * WebInspector.cpp:
+ (WebInspector::createInstance):
+ (WebInspector::WebInspector):
+ (WebInspector::inspectedWebViewClosed): Renamed.
+ (WebInspector::show):
+ (WebInspector::close):
+ (WebInspector::isJavaScriptProfilingEnabled):
+ (WebInspector::setJavaScriptProfilingEnabled):
+ (WebInspector::evaluateInFrontend):
+ (WebInspector::webViewClosed): Deleted.
+ * WebInspector.h:
+ * WebView.cpp:
+ (WebView::close):
+
2015-09-08 Per Arne Vollan <peavo@outlook.com>
[Win] Implement DOMNode::attributes.
diff --git a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
index 3717740..82305c8 100644
--- a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
@@ -72,13 +72,13 @@
{
}
-void WebInspectorClient::inspectorDestroyed()
+void WebInspectorClient::inspectedPageDestroyed()
{
- closeInspectorFrontend();
+ closeLocalFrontend();
delete this;
}
-Inspector::FrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* inspectorController)
+Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* inspectorController)
{
registerWindowClass();
@@ -171,7 +171,7 @@
return this;
}
-void WebInspectorClient::closeInspectorFrontend()
+void WebInspectorClient::closeLocalFrontend()
{
if (m_frontendClient)
m_frontendClient->destroyInspectorView();
diff --git a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
index 43515a0..24e8b7b 100644
--- a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
@@ -53,10 +53,10 @@
explicit WebInspectorClient(WebView*);
// InspectorClient
- virtual void inspectorDestroyed();
+ virtual void inspectedPageDestroyed();
- virtual Inspector::FrontendChannel* openInspectorFrontend(WebCore::InspectorController*);
- virtual void closeInspectorFrontend();
+ virtual Inspector::FrontendChannel* openLocalFrontend(WebCore::InspectorController*);
+ virtual void closeLocalFrontend();
virtual void bringFrontendToFront();
virtual void highlight();
diff --git a/Source/WebKit/win/WebInspector.cpp b/Source/WebKit/win/WebInspector.cpp
index 1aedb7a..c02850e 100644
--- a/Source/WebKit/win/WebInspector.cpp
+++ b/Source/WebKit/win/WebInspector.cpp
@@ -37,18 +37,18 @@
using namespace WebCore;
-WebInspector* WebInspector::createInstance(WebView* webView, WebInspectorClient* inspectorClient)
+WebInspector* WebInspector::createInstance(WebView* inspectedWebView, WebInspectorClient* inspectorClient)
{
- WebInspector* inspector = new WebInspector(webView, inspectorClient);
+ WebInspector* inspector = new WebInspector(inspectedWebView, inspectorClient);
inspector->AddRef();
return inspector;
}
-WebInspector::WebInspector(WebView* webView, WebInspectorClient* inspectorClient)
- : m_webView(webView)
+WebInspector::WebInspector(WebView* inspectedWebView, WebInspectorClient* inspectorClient)
+ : m_inspectedWebView(inspectedWebView)
, m_inspectorClient(inspectorClient)
{
- ASSERT_ARG(webView, webView);
+ ASSERT_ARG(inspectedWebView, inspectedWebView);
gClassCount++;
gClassNameCount().add("WebInspector");
@@ -65,9 +65,9 @@
return m_inspectorClient ? m_inspectorClient->frontendClient() : nullptr;
}
-void WebInspector::webViewClosed()
+void WebInspector::inspectedWebViewClosed()
{
- m_webView = nullptr;
+ m_inspectedWebView = nullptr;
m_inspectorClient = nullptr;
}
@@ -105,8 +105,8 @@
HRESULT WebInspector::show()
{
- if (m_webView)
- if (Page* page = m_webView->page())
+ if (m_inspectedWebView)
+ if (Page* page = m_inspectedWebView->page())
page->inspectorController().show();
return S_OK;
@@ -127,8 +127,8 @@
HRESULT WebInspector::close()
{
- if (m_webView)
- if (Page* page = m_webView->page())
+ if (m_inspectedWebView)
+ if (Page* page = m_inspectedWebView->page())
page->inspectorController().close();
return S_OK;
@@ -210,42 +210,42 @@
*isProfilingEnabled = FALSE;
- if (!m_webView)
+ if (!m_inspectedWebView)
return S_OK;
- Page* page = m_webView->page();
- if (!page)
+ Page* inspectedPage = m_inspectedWebView->page();
+ if (!inspectedPage)
return S_OK;
- *isProfilingEnabled = page->inspectorController().profilerEnabled();
+ *isProfilingEnabled = inspectedPage->inspectorController().profilerEnabled();
return S_OK;
}
HRESULT WebInspector::setJavaScriptProfilingEnabled(BOOL enabled)
{
- if (!m_webView)
+ if (!m_inspectedWebView)
return S_OK;
- Page* page = m_webView->page();
- if (!page)
+ Page* inspectedPage = m_inspectedWebView->page();
+ if (!inspectedPage)
return S_OK;
- page->inspectorController().setProfilerEnabled(enabled);
+ inspectedPage->inspectorController().setProfilerEnabled(enabled);
return S_OK;
}
HRESULT WebInspector::evaluateInFrontend(_In_ BSTR bScript)
{
- if (!m_webView)
+ if (!m_inspectedWebView)
return S_OK;
- Page* page = m_webView->page();
- if (!page)
+ Page* inspectedPage = m_inspectedWebView->page();
+ if (!inspectedPage)
return S_OK;
String script(bScript, SysStringLen(bScript));
- page->inspectorController().evaluateForTestInFrontend(script);
+ inspectedPage->inspectorController().evaluateForTestInFrontend(script);
return S_OK;
}
diff --git a/Source/WebKit/win/WebInspector.h b/Source/WebKit/win/WebInspector.h
index 94a9558..df707cf 100644
--- a/Source/WebKit/win/WebInspector.h
+++ b/Source/WebKit/win/WebInspector.h
@@ -39,9 +39,9 @@
class WebInspector : public IWebInspector, public IWebInspectorPrivate {
WTF_MAKE_NONCOPYABLE(WebInspector);
public:
- static WebInspector* createInstance(WebView*, WebInspectorClient*);
+ static WebInspector* createInstance(WebView* inspectedWebView, WebInspectorClient*);
- void webViewClosed();
+ void inspectedWebViewClosed();
virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID, _COM_Outptr_ void** ppvObject);
virtual ULONG STDMETHODCALLTYPE AddRef();
@@ -69,14 +69,14 @@
virtual HRESULT STDMETHODCALLTYPE setTimelineProfilingEnabled(BOOL);
private:
- WebInspector(WebView*, WebInspectorClient*);
+ WebInspector(WebView* inspectedWebView, WebInspectorClient*);
~WebInspector();
WebInspectorFrontendClient* frontendClient();
ULONG m_refCount { 0 };
- WebView* m_webView;
- WebInspectorClient* m_inspectorClient;
+ WebView* m_inspectedWebView { nullptr };
+ WebInspectorClient* m_inspectorClient { nullptr };
};
#endif // !defined(WebInspector_h)
diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp
index b7af2cb..2212441 100644
--- a/Source/WebKit/win/WebView.cpp
+++ b/Source/WebKit/win/WebView.cpp
@@ -762,9 +762,9 @@
setUIDelegate(0);
setFormDelegate(0);
- m_inspectorClient = 0;
+ m_inspectorClient = nullptr;
if (m_webInspector)
- m_webInspector->webViewClosed();
+ m_webInspector->inspectedWebViewClosed();
delete m_page;
m_page = 0;
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 143d7f2..83f2603 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,19 @@
+2015-09-12 Brian Burg <bburg@apple.com>
+
+ Web Inspector: disambiguate inspected/frontend controllers and pages in backend code
+ https://bugs.webkit.org/show_bug.cgi?id=149071
+
+ Reviewed by Joseph Pecoraro.
+
+ * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+ (WebKit::WebInspectorClient::inspectedPageDestroyed): Renamed.
+ (WebKit::WebInspectorClient::openLocalFrontend): Renamed.
+ (WebKit::WebInspectorClient::closeLocalFrontend): Renamed.
+ (WebKit::WebInspectorClient::inspectorDestroyed): Deleted.
+ (WebKit::WebInspectorClient::openInspectorFrontend): Deleted.
+ (WebKit::WebInspectorClient::closeInspectorFrontend): Deleted.
+ * WebProcess/WebCoreSupport/WebInspectorClient.h:
+
2015-09-11 Beth Dakin <bdakin@apple.com>
Another build fix.
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
index 66e9bc7..5880ce0 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
@@ -76,20 +76,20 @@
m_page->mainFrame()->pageOverlayController().uninstallPageOverlay(m_paintRectOverlay.get(), PageOverlay::FadeMode::Fade);
}
-void WebInspectorClient::inspectorDestroyed()
+void WebInspectorClient::inspectedPageDestroyed()
{
- closeInspectorFrontend();
+ closeLocalFrontend();
delete this;
}
-Inspector::FrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* controller)
+Inspector::FrontendChannel* WebInspectorClient::openLocalFrontend(InspectorController* controller)
{
m_page->inspector()->openFrontendConnection(controller->isUnderTest());
return m_page->inspector();
}
-void WebInspectorClient::closeInspectorFrontend()
+void WebInspectorClient::closeLocalFrontend()
{
if (m_page->inspector()) {
m_page->corePage()->inspectorController().disconnectFrontend(m_page->inspector());
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
index b8380b1..b10f440 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
@@ -50,10 +50,10 @@
private:
// WebCore::InspectorClient
- void inspectorDestroyed() override;
+ void inspectedPageDestroyed() override;
- Inspector::FrontendChannel* openInspectorFrontend(WebCore::InspectorController*) override;
- void closeInspectorFrontend() override;
+ Inspector::FrontendChannel* openLocalFrontend(WebCore::InspectorController*) override;
+ void closeLocalFrontend() override;
void bringFrontendToFront() override;
void didResizeMainFrame(WebCore::Frame*) override;