summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 22:14:01 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 22:14:01 +0000
commitb6ce15971b4139103635132bb9c9d3cd2224973e (patch)
tree07ac0724aed49c2adb8d8c47aadeb23a34d3e324 /webkit/glue
parent95c3c59d275042225cda4589525cb279f66f1f2c (diff)
downloadchromium_src-b6ce15971b4139103635132bb9c9d3cd2224973e.zip
chromium_src-b6ce15971b4139103635132bb9c9d3cd2224973e.tar.gz
chromium_src-b6ce15971b4139103635132bb9c9d3cd2224973e.tar.bz2
Chrome-side of fixes for content-script messaging.
This change adds registration of content scripts, parented to a frame's context. When a frame's context goes away, we unregister it and any content script contexts for it. There's a corresponding webkit change that lets us know when a content script context is created. Filed upstream as https://bugs.webkit.org/show_bug.cgi?id=27104. BUG=16228 TEST=install an extension with a content script that communicates with a parent process. Messages should be sendable both ways. Review URL: http://codereview.chromium.org/155309 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc15
-rw-r--r--webkit/glue/webframeloaderclient_impl.h14
-rw-r--r--webkit/glue/webview_delegate.h8
3 files changed, 29 insertions, 8 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index c5d4901..19f1096 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -130,18 +130,25 @@ void WebFrameLoaderClient::documentElementAvailable() {
d->DocumentElementAvailable(webframe_);
}
-void WebFrameLoaderClient::didCreateScriptContext() {
+void WebFrameLoaderClient::didCreateScriptContextForFrame() {
WebViewImpl* webview = webframe_->GetWebViewImpl();
WebViewDelegate* d = webview->delegate();
if (d)
- d->DidCreateScriptContext(webframe_);
+ d->DidCreateScriptContextForFrame(webframe_);
}
-void WebFrameLoaderClient::didDestroyScriptContext() {
+void WebFrameLoaderClient::didDestroyScriptContextForFrame() {
WebViewImpl* webview = webframe_->GetWebViewImpl();
WebViewDelegate* d = webview->delegate();
if (d)
- d->DidDestroyScriptContext(webframe_);
+ d->DidDestroyScriptContextForFrame(webframe_);
+}
+
+void WebFrameLoaderClient::didCreateIsolatedScriptContext() {
+ WebViewImpl* webview = webframe_->GetWebViewImpl();
+ WebViewDelegate* d = webview->delegate();
+ if (d)
+ d->DidCreateIsolatedScriptContext(webframe_);
}
void WebFrameLoaderClient::didPerformFirstNavigation() const {
diff --git a/webkit/glue/webframeloaderclient_impl.h b/webkit/glue/webframeloaderclient_impl.h
index 98118dd..8532f55 100644
--- a/webkit/glue/webframeloaderclient_impl.h
+++ b/webkit/glue/webframeloaderclient_impl.h
@@ -49,8 +49,18 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
virtual void windowObjectCleared();
virtual void documentElementAvailable();
- virtual void didCreateScriptContext();
- virtual void didDestroyScriptContext();
+ // TODO(mpcomplete): remove these when we pick up webkit r45871
+ virtual void didCreateScriptContext() { didCreateScriptContextForFrame(); }
+ virtual void didDestroyScriptContext() { didDestroyScriptContextForFrame(); }
+
+ // A frame's V8 context was created or destroyed.
+ virtual void didCreateScriptContextForFrame();
+ virtual void didDestroyScriptContextForFrame();
+
+ // A context untied to a frame was created (through evaluateInNewContext).
+ // This context is not tied to the lifetime of its frame, and is destroyed
+ // in garbage collection.
+ virtual void didCreateIsolatedScriptContext();
virtual bool hasWebView() const; // mainly for assertions
virtual bool hasFrameView() const; // ditto
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index eafd383..1ccc761 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -231,11 +231,15 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
// Notifies that a new script context has been created for this frame.
// This is similar to WindowObjectCleared but only called once per frame
// context.
- virtual void DidCreateScriptContext(WebFrame* webframe) {
+ virtual void DidCreateScriptContextForFrame(WebFrame* webframe) {
}
// Notifies that this frame's script context has been destroyed.
- virtual void DidDestroyScriptContext(WebFrame* webframe) {
+ virtual void DidDestroyScriptContextForFrame(WebFrame* webframe) {
+ }
+
+ // Notifies that a garbage-collected context was created - content scripts.
+ virtual void DidCreateIsolatedScriptContext(WebFrame* webframe) {
}
// PolicyDelegate ----------------------------------------------------------