Unify concept of enabling the Mac Java bridge.
Reviewed by Darin and Anders.
* wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
WebCore:
Unify concept of enabling the Mac Java bridge.
Reviewed by Darin and Anders.
No test cases added since there is no change in functionality.
* DerivedSources.make: Added check for ENABLE_MAC_JAVA_BRIDGE macro.
If defined as "1", add WebCore.JNI.exp to WEBCORE_EXPORT_DEPENDENCIES.
* WebCore.JNI.exp: Added.
* WebCore.base.exp: Moved exported JNI methods to WebCore.JNI.exp.
* bridge/jni/jni_class.cpp: Added #if ENABLE(MAC_JAVA_BRIDGE) guard.
* bridge/jni/jni_class.h: Ditto.
* bridge/jni/jni_instance.cpp: Ditto.
* bridge/jni/jni_instance.h: Ditto.
* bridge/jni/jni_jsobject.cpp: Ditto.
* bridge/jni/jni_jsobject.h: Ditto.
* bridge/jni/jni_objc.mm: Ditto.
* bridge/jni/jni_runtime.cpp: Ditto.
* bridge/jni/jni_runtime.h: Ditto.
* bridge/jni/jni_utility.cpp: Ditto.
* bridge/jni/jni_utility.h: Ditto.
* bridge/runtime.cpp: Removed unused #include statements.
* bridge/runtime.h:
(KJS::Bindings::Instance::BindingLanguage): Added #if ENABLE(MAC_JAVA_BRIDGE)
guard for JavaLanguage enum. Also added #if PLATFORM(MAC) guard for
ObjectiveCLanguage enum to match corresponding code in runtime.cpp.
* config.h: Removed definition of HAVE_JNI.
* loader/FrameLoaderClient.h:
(WebCore::FrameLoaderClient::javaApplet): Added #if ENABLE(MAC_JAVA_BRIDGE) guard.
* page/Frame.cpp:
(WebCore::Frame::Frame): Ditto.
* page/Frame.h:
(WebCore::Frame::initJavaJSBindings): Ditto.
* page/mac/FrameMac.mm:
(WebCore::Frame::createScriptInstanceForWidget): Ditto.
(WebCore::Frame::initJavaJSBindings): Ditto.
WebKit/mac:
Unify concept of enabling the Mac Java bridge.
Reviewed by Darin and Anders.
* Plugins/WebPluginJava.h: Removed unused file.
* WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient::javaApplet): Added #if ENABLE(MAC_JAVA_BRIDGE) guard.
* WebCoreSupport/WebFrameLoaderClient.mm: Ditto for #import and NSView SPI method.
(WebFrameLoaderClient::javaApplet): Ditto.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@31056
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-03-14 David D. Kilzer <ddkilzer@apple.com>
+
+ Unify concept of enabling the Mac Java bridge.
+
+ Reviewed by Darin and Anders.
+
+ * wtf/Platform.h: Define ENABLE_MAC_JAVA_BRIDGE here.
+
2008-03-13 Mark Mentovai <mark@moxienet.com>
Reviewed by eseidel. Landed by eseidel.
#if PLATFORM(MAC)
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 1
+#define ENABLE_MAC_JAVA_BRIDGE 1
#endif
#if PLATFORM(MAC) && defined(__LP64__)
#define ENABLE_FTPDIR 1
#endif
+#if !defined(ENABLE_MAC_JAVA_BRIDGE)
+#define ENABLE_MAC_JAVA_BRIDGE 0
+#endif
+
#if !defined(ENABLE_NETSCAPE_PLUGIN_API)
#define ENABLE_NETSCAPE_PLUGIN_API 0
#endif
+2008-03-14 David D. Kilzer <ddkilzer@apple.com>
+
+ Unify concept of enabling the Mac Java bridge.
+
+ Reviewed by Darin and Anders.
+
+ No test cases added since there is no change in functionality.
+
+ * DerivedSources.make: Added check for ENABLE_MAC_JAVA_BRIDGE macro.
+ If defined as "1", add WebCore.JNI.exp to WEBCORE_EXPORT_DEPENDENCIES.
+ * WebCore.JNI.exp: Added.
+ * WebCore.base.exp: Moved exported JNI methods to WebCore.JNI.exp.
+
+ * bridge/jni/jni_class.cpp: Added #if ENABLE(MAC_JAVA_BRIDGE) guard.
+ * bridge/jni/jni_class.h: Ditto.
+ * bridge/jni/jni_instance.cpp: Ditto.
+ * bridge/jni/jni_instance.h: Ditto.
+ * bridge/jni/jni_jsobject.cpp: Ditto.
+ * bridge/jni/jni_jsobject.h: Ditto.
+ * bridge/jni/jni_objc.mm: Ditto.
+ * bridge/jni/jni_runtime.cpp: Ditto.
+ * bridge/jni/jni_runtime.h: Ditto.
+ * bridge/jni/jni_utility.cpp: Ditto.
+ * bridge/jni/jni_utility.h: Ditto.
+
+ * bridge/runtime.cpp: Removed unused #include statements.
+ * bridge/runtime.h:
+ (KJS::Bindings::Instance::BindingLanguage): Added #if ENABLE(MAC_JAVA_BRIDGE)
+ guard for JavaLanguage enum. Also added #if PLATFORM(MAC) guard for
+ ObjectiveCLanguage enum to match corresponding code in runtime.cpp.
+
+ * config.h: Removed definition of HAVE_JNI.
+
+ * loader/FrameLoaderClient.h:
+ (WebCore::FrameLoaderClient::javaApplet): Added #if ENABLE(MAC_JAVA_BRIDGE) guard.
+ * page/Frame.cpp:
+ (WebCore::Frame::Frame): Ditto.
+ * page/Frame.h:
+ (WebCore::Frame::initJavaJSBindings): Ditto.
+ * page/mac/FrameMac.mm:
+ (WebCore::Frame::createScriptInstanceForWidget): Ditto.
+ (WebCore::Frame::initJavaJSBindings): Ditto.
+
2008-03-13 Darin Adler <darin@apple.com>
* html/PreloadScanner.h: Corrected license.
FRAMEWORK_FLAGS = $(shell echo $(FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
+ifeq ($(shell gcc -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_MAC_JAVA_BRIDGE | cut -d' ' -f3), 1)
+ WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.JNI.exp
+endif
+
+# See also "Generate 64-bit Export File" build phase script in WebCore.xcodeproj/project.pbxproj
ifeq ($(shell gcc -E -P -dM -F $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_FLAGS) WebCore/ForwardingHeaders/wtf/Platform.h | grep ENABLE_NETSCAPE_PLUGIN_API | cut -d' ' -f3), 1)
WEBCORE_EXPORT_DEPENDENCIES := $(WEBCORE_EXPORT_DEPENDENCIES) WebCore.NPAPI.exp
endif
--- /dev/null
+_KJS_JSCreateNativeJSObject
+_KJS_JSObject_JSFinalize
+_KJS_JSObject_JSObjectCall
+_KJS_JSObject_JSObjectEval
+_KJS_JSObject_JSObjectGetMember
+_KJS_JSObject_JSObjectGetSlot
+_KJS_JSObject_JSObjectRemoveMember
+_KJS_JSObject_JSObjectSetMember
+_KJS_JSObject_JSObjectSetSlot
+_KJS_JSObject_JSObjectToString
_DOMException
_DOMRangeException
_DOMXPathException
-_KJS_JSCreateNativeJSObject
-_KJS_JSObject_JSFinalize
-_KJS_JSObject_JSObjectCall
-_KJS_JSObject_JSObjectEval
-_KJS_JSObject_JSObjectGetMember
-_KJS_JSObject_JSObjectGetSlot
-_KJS_JSObject_JSObjectRemoveMember
-_KJS_JSObject_JSObjectSetMember
-_KJS_JSObject_JSObjectSetSlot
-_KJS_JSObject_JSObjectToString
_WebCoreDrawTextAtPoint
_WebCoreFindFont
_WebCoreObjCFinalizeOnMainThread
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "config.h"
#include "jni_class.h"
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include <kjs/identifier.h>
#include "jni_utility.h"
#include "jni_runtime.h"
{
return strcmp(_name, "java.lang.String") == 0;
}
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
#ifndef JNI_CLASS_H_
#define JNI_CLASS_H_
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include <jni_runtime.h>
#include <wtf/HashMap.h>
} // namespace KJS
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
#endif // JNI_CLASS_H_
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "config.h"
+#include "jni_instance.h"
+
+#if ENABLE(MAC_JAVA_BRIDGE)
#include "jni_class.h"
-#include "jni_instance.h"
#include "jni_runtime.h"
#include "jni_utility.h"
#include "runtime_object.h"
JS_LOG ("deleting global ref %p\n", _instance);
_env->DeleteGlobalRef (_instance);
}
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef _JNI_INSTANCE_H_
#define _JNI_INSTANCE_H_
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include "runtime.h"
#include "runtime_root.h"
} // namespace KJS
-#endif
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
+#endif // _JNI_INSTANCE_H_
#include "config.h"
#include "jni_jsobject.h"
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include "Frame.h"
#include "WebCoreFrameView.h"
#include "jni_runtime.h"
}
}
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
#ifndef JAVASCRIPTCORE_BINDINGS_JNI_JSOBJECT_H
#define JAVASCRIPTCORE_BINDINGS_JNI_JSOBJECT_H
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include <CoreFoundation/CoreFoundation.h>
#include <JavaVM/jni.h>
}
-#endif
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
+#endif // JAVASCRIPTCORE_BINDINGS_JNI_JSOBJECT_H
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "config.h"
+
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#import <Foundation/Foundation.h>
#import "jni_utility.h"
#import "objc_utility.h"
bzero (&result, sizeof(jvalue));
return false;
}
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "config.h"
+#include <jni_runtime.h>
+
+#if ENABLE(MAC_JAVA_BRIDGE)
#include <jni_utility.h>
-#include <jni_runtime.h>
#include "runtime_array.h"
#include "runtime_object.h"
return _length;
}
-
+#endif // ENABLE(MAC_JAVA_BRIDGE)
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef _JNI_RUNTIME_H_
#define _JNI_RUNTIME_H_
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include <jni_utility.h>
#include <jni_instance.h>
} // namespace KJS
-#endif
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
+#endif // _JNI_RUNTIME_H_
#include "config.h"
#include "jni_utility.h"
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include "jni_runtime.h"
#include "runtime_array.h"
#include "runtime_object.h"
} // end of namespace Bindings
} // end of namespace KJS
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef _JNI_UTILITY_H_
#define _JNI_UTILITY_H_
+#if ENABLE(MAC_JAVA_BRIDGE)
+
#include <JavaVM/jni.h>
// The order of these items can not be modified as they are tightly
} // namespace KJS
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
#endif // _JNI_UTILITY_H_
#include "config.h"
#include "runtime.h"
-#include "NP_jsobject.h"
-#include "c_instance.h"
#include "runtime_object.h"
#include "runtime_root.h"
-#if HAVE(JNI)
-#include "jni_instance.h"
-#endif
-#if PLATFORM(MAC)
-#include "objc_instance.h"
-#endif
#if PLATFORM(QT)
#include "qt_instance.h"
#endif
class Instance : public RefCounted<Instance> {
public:
typedef enum {
+#if ENABLE(MAC_JAVA_BRIDGE)
JavaLanguage,
+#endif
+#if PLATFORM(MAC)
ObjectiveCLanguage,
+#endif
CLanguage
#if PLATFORM(QT)
, QtLanguage
#if PLATFORM(MAC)
#define WTF_USE_JAVASCRIPTCORE_BINDINGS 1
-#define HAVE_JNI 1
#endif
#if PLATFORM(SYMBIAN)
virtual void registerForIconNotification(bool listen = true) = 0;
#if PLATFORM(MAC)
+#if ENABLE(MAC_JAVA_BRIDGE)
virtual jobject javaApplet(NSView*) { return 0; }
+#endif
virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const = 0;
#endif
};
XMLNames::init();
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && ENABLE(MAC_JAVA_BRIDGE)
static bool initializedJavaJSBindings;
if (!initializedJavaJSBindings) {
initializedJavaJSBindings = true;
PassRefPtr<KJS::Bindings::RootObject> createRootObject(void* nativeHandle, KJS::JSGlobalObject*);
#if PLATFORM(MAC)
+#if ENABLE(MAC_JAVA_BRIDGE)
static void initJavaJSBindings();
+#endif
WebScriptObject* windowScriptObject();
#endif
#import "objc_instance.h"
#import "runtime_root.h"
#import "runtime.h"
+#if ENABLE(MAC_JAVA_BRIDGE)
#import "jni_instance.h"
+#endif
@interface NSObject (WebPlugin)
- (id)objectForWebScript;
#endif
}
+#if ENABLE(MAC_JAVA_BRIDGE)
jobject applet = loader()->client()->javaApplet(widgetView);
if (!applet)
return 0;
return KJS::Bindings::JavaInstance::create(applet, rootObject.release());
+#else
+ return 0;
+#endif
}
WebScriptObject* Frame::windowScriptObject()
document->updateRendering();
}
+#if ENABLE(MAC_JAVA_BRIDGE)
void Frame::initJavaJSBindings()
{
mainThread = pthread_self();
KJS::Bindings::JavaJSObject::initializeJNIThreading();
KJS::Bindings::Instance::setDidExecuteFunction(updateRenderingForBindings);
}
+#endif
} // namespace WebCore
+2008-03-14 David D. Kilzer <ddkilzer@apple.com>
+
+ Unify concept of enabling the Mac Java bridge.
+
+ Reviewed by Darin and Anders.
+
+ * Plugins/WebPluginJava.h: Removed unused file.
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ (WebFrameLoaderClient::javaApplet): Added #if ENABLE(MAC_JAVA_BRIDGE) guard.
+ * WebCoreSupport/WebFrameLoaderClient.mm: Ditto for #import and NSView SPI method.
+ (WebFrameLoaderClient::javaApplet): Ditto.
+
2008-03-13 Antti Koivisto <antti@apple.com>
Reviewed by Darin.
+++ /dev/null
-/*
- * Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <JavaVM/JavaVM.h>
-
-// The WebPluginContainer will call these methods for LiveConnect support. The
-// WebPluginContainer should see if the WebPlugin supports these methods before
-// calling them.
-
-@protocol WebPluginJava <NSObject>
-
-// This returns the jobject representing the java applet to the WebPluginContainer.
-// It should always be called from the AppKit Main Thread.
-- (jobject) getApplet;
-
-// This will call the given method on the given jobject with the given arguments
-// from the proper thread for this WebPlugin. This way, no java applet code will
-// be run on the AppKit Main Thread, it will be called on a thread belonging to the
-// java applet.
-// It should always be called from the AppKit Main Thread.
-- (jvalue) callJavaOn:(jobject)object withMethod:(jmethodID) withArgs:(jvalue*)args;
-
-@end
virtual void registerForIconNotification(bool listen);
+#if ENABLE(MAC_JAVA_BRIDGE)
virtual jobject javaApplet(NSView*);
+#endif
void deliverArchivedResourcesAfterDelay() const;
void deliverArchivedResources(WebCore::Timer<WebFrameLoaderClient>*);
#import "WebHistoryItemInternal.h"
#import "WebHistoryInternal.h"
#import "WebIconDatabaseInternal.h"
+#if ENABLE(MAC_JAVA_BRIDGE)
#import "WebJavaPlugIn.h"
+#endif
#import "WebKitErrorsPrivate.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
using namespace WebCore;
+#if ENABLE(MAC_JAVA_BRIDGE)
@interface NSView (WebJavaPluginDetails)
- (jobject)pollForAppletInWindow:(NSWindow *)window;
@end
+#endif
// Needed for <rdar://problem/5121850>
@interface NSURLDownload (WebNSURLDownloadDetails)
[preferences setCacheModel:WebCacheModelDocumentBrowser];
}
+#if ENABLE(MAC_JAVA_BRIDGE)
jobject WebFrameLoaderClient::javaApplet(NSView* view)
{
if ([view respondsToSelector:@selector(webPlugInGetApplet)])
return 0;
}
+#endif
@implementation WebFramePolicyListener