[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:34:39 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f3258b859ce88601c6a81c80798bd3089bea34ac
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Apr 16 21:09:51 2004 +0000

    WebKit:
    	Added an SPI to allow ObjC instances to be easily bound to
    	JS.  This is needed by the dashboard guys for their prototyping.
    	Eventually they will use new API.
    
            Reviewed by Chris.
    
            * WebView.subproj/WebView.m:
            (-[WebView _bindObject:withName:toFrame:]):
            * WebView.subproj/WebViewPrivate.h:
    
    WebCore:
    	Added an SPI to allow ObjC instances to be easily bound to
    	JS.  This is needed by the dashboard guys for their prototyping.
    	Eventually they will use new API.
    
            Reviewed by Chris.
    
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::bindObject):
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge bindObject:withName:]):
    
    JavaScriptCore:
    	Added interpreter lock protection around object creation.
    
            Reviewed by Chris.
    
            * bindings/runtime.cpp:
            (Instance::createRuntimeObject):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6402 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 75c84ac..c9c16c4 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,12 @@
+2004-04-16  Richard Williamson   <rjw at apple.com>
+
+	Added interpreter lock protection around object creation.
+
+        Reviewed by Chris.
+
+        * bindings/runtime.cpp:
+        (Instance::createRuntimeObject):
+
 2004-04-16  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Ken.
diff --git a/JavaScriptCore/bindings/runtime.cpp b/JavaScriptCore/bindings/runtime.cpp
index 961418e..936d84e 100644
--- a/JavaScriptCore/bindings/runtime.cpp
+++ b/JavaScriptCore/bindings/runtime.cpp
@@ -23,6 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 #include <value.h>
+#include <interpreter.h>
 
 #include <runtime_object.h>
 #include <jni_instance.h>
@@ -107,5 +108,10 @@ Instance *Instance::createBindingForLanguageInstance (BindingLanguage language,
 Object Instance::createRuntimeObject (BindingLanguage language, void *myInterface)
 {
     Instance *interfaceObject = Instance::createBindingForLanguageInstance (language, (void *)myInterface);
-    return Object(new RuntimeObjectImp(interfaceObject,true));
+    
+    Interpreter::lock();
+    Object theObject(new RuntimeObjectImp(interfaceObject,true));
+    Interpreter::unlock();
+    
+    return theObject;
 }
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 35fff6d..0dce54d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2004-04-16  Richard Williamson   <rjw at apple.com>
+
+	Added an SPI to allow ObjC instances to be easily bound to 
+	JS.  This is needed by the dashboard guys for their prototyping.
+	Eventually they will use new API.
+
+        Reviewed by Chris.
+
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::bindObject):
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge bindObject:withName:]):
+
 2004-04-16  Chris Blumenberg  <cblu at apple.com>
 
 	Added DOMHTMLEmbedElement as a DOM extension since EMBED is represented in our DOM even though its not part of the spec.
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 79ad35d..99ede75 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -277,6 +277,8 @@ public:
     void issueCutCommand();
     void issueCopyCommand();
     void issuePasteCommand();
+
+    void bindObject(void *object, QString name);
     
 private:
     virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 9020d69..41cc5f7 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -57,7 +57,9 @@
 #import "render_text.h"
 #import "xml/dom2_eventsimpl.h"
 #import "xml/dom2_rangeimpl.h"
+#import <JavaScriptCore/identifier.h>
 #import <JavaScriptCore/property_map.h>
+#import <JavaScriptCore/runtime.h>
 #import <JavaScriptCore/runtime_root.h>
 
 #undef _KWQ_TIMING
@@ -108,6 +110,8 @@ using KJS::SavedProperties;
 using KJS::ScheduledAction;
 using KJS::Window;
 
+using KJS::Bindings::Instance;
+
 using KParts::ReadOnlyPart;
 using KParts::URLArgs;
 
@@ -1121,6 +1125,15 @@ bool KWQKHTMLPart::tabsToAllControls() const
         return KWQKHTMLPart::currentEventIsKeyboardOptionTab();
 }
 
+void KWQKHTMLPart::bindObject(void *object, QString name)
+{
+    if (d->m_doc && jScript()) {
+        Window *w = Window::retrieveWindow(this);
+        w->put(jScript()->interpreter()->globalExec(), KJS::Identifier(name), Instance::createRuntimeObject(Instance::ObjectiveCLanguage, (void *)object));
+    }
+}
+
+
 QMap<int, ScheduledAction*> *KWQKHTMLPart::pauseActions(const void *key)
 {
     if (d->m_doc && d->m_jscript) {
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 058a56f..970cc66 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -289,6 +289,8 @@ typedef enum {
 - (void)deleteKeyPressed;
 - (void)applyStyle:(DOMCSSStyleDeclaration *)style toElementsInDOMRange:(DOMRange *)range;
 
+- (void)bindObject:(id)object withName:(NSString *)name;
+
 @end
 
 // The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 6a5bd5f..e3bbaa2 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -1063,6 +1063,14 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     return _part->executeScript(QString::fromNSString(string), true).asString().getNSString();
 }
 
+- (void)bindObject:(id)object withName:(NSString *)name
+{
+    // Create an empty document, if necessary.  
+    _part->createEmptyDocument();
+    
+    _part->bindObject((void *)object, QString::fromNSString(name));
+}
+
 - (DOMDocument *)DOMDocument
 {
     return [DOMDocument _documentWithImpl:_part->xmlDocImpl()];
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index d98c83d..276fa2a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,15 @@
+2004-04-16  Richard Williamson   <rjw at apple.com>
+
+	Added an SPI to allow ObjC instances to be easily bound to 
+	JS.  This is needed by the dashboard guys for their prototyping.
+	Eventually they will use new API.
+
+        Reviewed by Chris.
+
+        * WebView.subproj/WebView.m:
+        (-[WebView _bindObject:withName:toFrame:]):
+        * WebView.subproj/WebViewPrivate.h:
+
 2004-04-16  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: <rdar://problem/3587599>: Mail Page, Web Archives don't preserve subframes
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 6e17835..d5f1b81 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -2985,3 +2985,13 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 @end
 
+ at implementation WebView (JavaScriptBinding)
+- (void)_bindObject:(id)object withName:(NSString *)name toFrame:(WebFrame *)frame
+{
+    if (!frame)
+        [[[self mainFrame] _bridge] bindObject:object withName:name];
+    else {
+        [[frame _bridge] bindObject:object withName:name];
+    }
+}
+ at end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 2e66618..397939d 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -497,4 +497,16 @@ extern NSString * const WebViewDidChangeSelectionNotification;
 - (void)_editingKeyDown:(NSEvent *)event;
 @end
 
+ at interface WebView (JavaScriptBinding)
+/*!
+    @method _bindObject:withName:toDocumentInFrame:
+    @discussion Expose the methods and instance variables of object to JavaScript.
+    @param object The object to be bound to JavaScript.
+    @param name The name of the property in JavaScript that is used to access the bound object.
+    @param frame If the frame is nil the object is bound to the main frame of the WebView.  The object
+    is added as a property of the window (which is the global object).
+*/
+- (void)_bindObject:(id)object withName:(NSString *)name toFrame:(WebFrame *)frame;
+ at end
+
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list