diff options
author | Grant Gayed <ggayed> | 2005-06-06 18:11:04 +0000 |
---|---|---|
committer | Grant Gayed <ggayed> | 2005-06-06 18:11:04 +0000 |
commit | ecb897396412f10f4d71a3c40a56bec4b1e117be (patch) | |
tree | 147080df73139051d15a35f8cd032da9e545466f | |
parent | e93f2486223e63a821959269ba87104931e85961 (diff) | |
download | eclipse.platform.swt-ecb897396412f10f4d71a3c40a56bec4b1e117be.tar.gz eclipse.platform.swt-ecb897396412f10f4d71a3c40a56bec4b1e117be.tar.xz eclipse.platform.swt-ecb897396412f10f4d71a3c40a56bec4b1e117be.zip |
90856
3 files changed, 128 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java index b93a2224e4..610eb68293 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/XPCOM.java @@ -56,6 +56,7 @@ public class XPCOM extends Platform { /* XPCOM constants */ public static final int NS_OK = 0; public static final int NS_COMFALSE = 1; + public static final int NS_BINDING_ABORTED = 2; public static final int NS_ERROR_BASE = 0xc1f30000; public static final int NS_ERROR_NOT_INITIALIZED = NS_ERROR_BASE + 1; public static final int NS_ERROR_ALREADY_INITIALIZED = NS_ERROR_BASE + 2; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIRequest.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIRequest.java new file mode 100644 index 0000000000..19a4ffdf6c --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/internal/mozilla/nsIRequest.java @@ -0,0 +1,101 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by Netscape are Copyright (C) 1998-1999 + * Netscape Communications Corporation. All Rights Reserved. + * + * Contributor(s): + * + * IBM + * - Binding to permit interfacing between Mozilla and SWT + * - Copyright (C) 2003 IBM Corp. All Rights Reserved. + * + * ***** END LICENSE BLOCK ***** */ +package org.eclipse.swt.internal.mozilla; + +public class nsIRequest extends nsISupports { + + static final int LAST_METHOD_ID = nsISupports.LAST_METHOD_ID + 10; + + public static final String NS_IREQUEST_IID_STR = + "ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe"; + + public static final nsID NS_IREQUEST_IID = + new nsID(NS_IREQUEST_IID_STR); + + public nsIRequest(int /*long*/ address) { + super(address); + } + + public int GetName(int /*long*/ aName) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 1, getAddress(), aName); + } + + public int IsPending(boolean[] _retval) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 2, getAddress(), _retval); + } + + public int GetStatus(int /*long*/ aStatus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 3, getAddress(), aStatus); + } + + public int Cancel(int aStatus) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 4, getAddress(), aStatus); + } + + public int Suspend() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 5, getAddress()); + } + + public int Resume() { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 6, getAddress()); + } + + public int GetLoadGroup(int /*long*/ aLoadGroup) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 7, getAddress(), aLoadGroup); + } + + public int SetLoadGroup(int /*long*/ aLoadGroup) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 8, getAddress(), aLoadGroup); + } + + public int GetLoadFlags(int /*long*/ aLoadFlags) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 9, getAddress(), aLoadFlags); + } + + public int SetLoadFlags(int aLoadFlags) { + return XPCOM.VtblCall(nsISupports.LAST_METHOD_ID + 10, getAddress(), aLoadFlags); + } + + public static final int LOAD_NORMAL = 0; + + public static final int LOAD_BACKGROUND = 1; + + public static final int INHIBIT_CACHING = 128; + + public static final int INHIBIT_PERSISTENT_CACHING = 256; + + public static final int LOAD_BYPASS_CACHE = 512; + + public static final int LOAD_FROM_CACHE = 1024; + + public static final int VALIDATE_ALWAYS = 2048; + + public static final int VALIDATE_NEVER = 4096; + + public static final int VALIDATE_ONCE_PER_SESSION = 8192; +} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java index e996a4d722..e9bdde3d46 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/gtk/org/eclipse/swt/browser/Browser.java @@ -1764,12 +1764,36 @@ int /*long*/ OnLocationChange(int /*long*/ aWebProgress, int /*long*/ aRequest, } int /*long*/ OnStatusChange(int /*long*/ aWebProgress, int /*long*/ aRequest, int /*long*/ aStatus, int /*long*/ aMessage) { + /* + * Feature in Mozilla. In Mozilla 1.7.5, navigating to an + * HTTPS link without a user profile set causes a crash. + * Most requests for HTTPS pages are aborted in OnStartURIOpen. + * However, https page requests that do not initially specify + * https as their protocol will get past this check since they + * are resolved afterwards. The workaround is to check the url + * whenever there is a status change, and to abort any https + * requests that are detected. + */ + nsIRequest request = new nsIRequest(aRequest); + int /*long*/ aName = XPCOM.nsEmbedCString_new(); + request.GetName(aName); + int length = XPCOM.nsEmbedCString_Length(aName); + int buffer = XPCOM.nsEmbedCString_get(aName); + byte[] bytes = new byte[length]; + XPCOM.memmove(bytes, buffer, length); + XPCOM.nsEmbedCString_delete(aName); + String value = new String(bytes); + if (value.startsWith(XPCOM.HTTPS_PROTOCOL)) { + request.Cancel(XPCOM.NS_BINDING_ABORTED); + return XPCOM.NS_OK; + } + if (statusTextListeners.length == 0) return XPCOM.NS_OK; - + StatusTextEvent event = new StatusTextEvent(this); event.display = getDisplay(); event.widget = this; - int length = XPCOM.strlen_PRUnichar(aMessage); + length = XPCOM.strlen_PRUnichar(aMessage); char[] dest = new char[length]; XPCOM.memmove(dest, aMessage, length * 2); event.text = new String(dest); |