diff options
| author | Leo Ufimtsev | 2017-12-07 19:29:23 +0000 |
|---|---|---|
| committer | Leo Ufimtsev | 2017-12-07 19:29:23 +0000 |
| commit | 87ad67c89aea7399b495bc6b63cebc72115bed9c (patch) | |
| tree | 92b9d75c44b79b8e7d77b6fded2182ae9b2e0486 | |
| parent | ccddf4d86de9b18c70f5ee874a6495a2eaeeed6d (diff) | |
| download | eclipse.platform.swt-87ad67c89aea7399b495bc6b63cebc72115bed9c.tar.gz eclipse.platform.swt-87ad67c89aea7399b495bc6b63cebc72115bed9c.tar.xz eclipse.platform.swt-87ad67c89aea7399b495bc6b63cebc72115bed9c.zip | |
Revert "Bug 510905 (Webkit2FuncRetVal)[GTK3][Webkit2] OSGI support."
This reverts commit c0925b528e5ba379d83868fd67f1aff0e88be8de.
3 files changed, 10 insertions, 41 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java index 23e771bc8d..e7303b0b1c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java @@ -11,7 +11,6 @@ package org.eclipse.swt.internal; import java.io.*; -import java.lang.reflect.*; import java.net.*; import java.util.function.*; import java.util.jar.*; @@ -367,16 +366,12 @@ private static boolean SWT_WEBKIT_DEBUG_MSGS = System.getenv("SWT_WEBKIT_DEBUG_M * Locates a resource located either in java library path, swt library path, or attempts to extract it from inside swt.jar file. * This function supports a single level subfolder, e.g SubFolder/resource. * - * Dev note: (17·12·07) This has been developed and throughly tested on GTK. Designed to work on Cocoa/Win as well, but not tested. - * * @param subDir 'null' or a folder name without slashes. E.g Correct: 'mysubdir', incorrect: '/subdir/'. * Platform specific Slashes will be added automatically. * @param resourceName e.g swt-webkitgtk * @param mapResourceName true if you like platform specific mapping applied to resource name. e.g MyLib -> libMyLib-gtk-4826.so */ public static File findResource(String subDir, String resourceName, boolean mapResourceName){ - - //We construct a 'maybe' subdirectory path. Maybe because if no subDir given, then we give 0. // subdir e.g: subdir String maybeSubDirPath = subDir != null ? subDir + SEPARATOR : ""; // e.g: subdir/ or "" String maybeSubDirPathWithPrefix = subDir != null ? SEPARATOR + maybeSubDirPath : ""; // e.g: /subdir/ or "" @@ -388,6 +383,7 @@ public static File findResource(String subDir, String resourceName, boolean mapR // This code commonly finds the resource if the swt project is a required project and the swt binary (for your platform) // project is open in your workplace (found in the JAVA_LIBRARY_PATH) or if you're explicitly specified SWT_LIBRARY_PATH. { + Function<String, File> lookForFileInPath = searchPath -> { String classpath = System.getProperty(searchPath); if (classpath != null){ @@ -410,32 +406,9 @@ public static File findResource(String subDir, String resourceName, boolean mapR } } - // 2) If SWT is ran as OSGI bundle (e.g inside Eclipse), then local resources are extracted to - // eclipse/configuration/org.eclipse.osgi/NN/N/.cp/<resource> and we're given a pointer to the file. - { - if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: findResource is attempting to find resource from OSGI Bundle."); // Temp, will be removed. Bug 510905 - - // If this is an OSGI bundle look for the resource using getResource - URL url = Library.class.getClassLoader().getResource(maybeSubDirPathWithPrefix + finalResourceName); - URLConnection connection; - try { - connection = url.openConnection(); - Method getFileURLMethod = connection.getClass().getMethod("getFileURL"); - if (getFileURLMethod != null){ - // This method does the actual extraction of file to: ../eclipse/configuration/org.eclipse.osgi/NN/N/.cp/<SubDir>/resource.ext - URL result = (URL) getFileURLMethod.invoke(connection); - File returnedFile = new File(result.toURI()); - if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: OSGI found resource in: " + returnedFile.getAbsolutePath()); - return returnedFile; - } - } catch (Exception e) { - // If any exceptions are thrown the resource cannot be located this way. - } - } - if (SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: findResource didn't find file in paths. Will attempt to extract."); // Temp, will be removed. Bug 510905 - // 3) Need to try to pull the resource out of the swt.jar. + // 2) Need to try to pull the resource out of the swt.jar. // Look for the resource in the user's home directory, (if already extracted in the temp swt folder. (~/.swt/lib...) // Extract from the swt.jar if not there already. { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index 11a3a1d326..755c797d71 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -62,7 +62,7 @@ class WebKit extends WebBrowser { + "&data=&defined_groups=1&dependson=&description=&flag_type-1=X&flag_type-11=X&flag_type-12=X&flag_type-13=X&flag_type-14=X" + "&flag_type-15=X&flag_type-16=X&flag_type-2=X&flag_type-4=X&flag_type-6=X&flag_type-7=X&flag_type-8=X&form_name=enter_bug" + "&keywords=&maketemplate=Remember%20values%20as%20bookmarkable%20template&op_sys=Linux&product=Platform&qa_contact=" - + "&rep_platform=PC&requestee_type-1=&requestee_type-2=&short_desc=webkit2_BrowserProblem"; + + "&rep_platform=PC&requestee_type-1=&requestee_type-2=&short_desc=[webkit2]BrowserProblem"; static boolean bug522733FirstInstanceCreated = false; //Webkit2 workaround for Bug 522733 @@ -397,24 +397,19 @@ class WebKit extends WebBrowser { // Webkit extensions should be in their own directory. String swtVersion = Library.getVersionString(); if (WebKitGTK.SWT_WEBKIT_DEBUG_MSGS) System.out.println("SWT_WEBKIT: Webkit dir is:" + "webkitextensions" + swtVersion); - File extension; - try { - extension = Library.findResource("webkitextensions" + swtVersion ,"swt-webkit2extension", true); - if (extension == null){ - throw new UnsatisfiedLinkError("SWT Webkit could not find it's webextension"); - } - } catch (UnsatisfiedLinkError e) { + File extension = Library.findResource("webkitextensions" + swtVersion ,"swt-webkit2extension", true); + if (extension == null){ System.err.println("SWT Webkit.java Error: Could not find webkit extension. BrowserFunction functionality will not be available. \n" - + "(swt version: " + swtVersion + ")" + WebKitGTK.swtWebkitGlueCodeVersion + WebKitGTK.swtWebkitGlueCodeVersionInfo); + + "(swt version: " + swtVersion + ")"); int [] vers = internalGetWebkitVersion(); System.err.println(String.format("WebKit2Gtk version %s.%s.%s", vers[0], vers[1], vers[2])); System.err.println(reportErrMsg); loadFailed = true; return; } - if (WebKitGTK.SWT_WEBKIT_DEBUG_MSGS && extension != null) System.out.println(" SWT_WEBKIT: Found extension in: " + extension.getAbsolutePath()); String extensionsFolder = extension.getParent(); + /* Dev note: * As per * - WebkitSrc: WebKitExtensionManager.cpp, @@ -426,6 +421,7 @@ class WebKit extends WebBrowser { WebKitGTK.webkit_web_context_set_web_extensions_directory(WebKitGTK.webkit_web_context_get_default(), Converter.wcsToMbcs (extensionsFolder, true)); long /*int*/ gvariantUserData = WebKitGTK.g_variant_new_int32(uniqueID); WebKitGTK.webkit_web_context_set_web_extensions_initialization_user_data(WebKitGTK.webkit_web_context_get_default(), gvariantUserData); + } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java index f297f68d52..a7bb1ad384 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/internal/webkit/WebKitGTK.java @@ -29,8 +29,8 @@ public class WebKitGTK extends C { * Internal version of "Webkit glue code", used mainly during webkit2 port. * Used to make it easier to support users on bugzilla. Updated by hand. */ - public static final String swtWebkitGlueCodeVersion = " SWT Glue code version: 51.0"; - public static final String swtWebkitGlueCodeVersionInfo = " info: +BrowserFunction/GDBus, +WebkitExtension Folder versioning, +WebKitExtension OSGI support, -setUrl(..postData..), -setCookie(), -getCookie"; + private static final String swtWebkitGlueCodeVersion = " SWT Glue code version: 50.0"; + private static final String swtWebkitGlueCodeVersionInfo = " info: +BrowserFunction/GDBus, +WebkitExtension Folder versioning, -setUrl(..postData..), -setCookie(), -getCookie"; /** |
