View | Details | Raw Unified | Return to bug 161864 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java (+11 lines)
Lines 77-82 Link Here
77
	static final String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$
77
	static final String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$
78
	static final String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$
78
	static final String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$
79
	static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$
79
	static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$
80
	static final String PREFERENCE_JAVASCRIPTENABLED = "javascript.enabled"; //$NON-NLS-1$
80
	static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
81
	static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$
81
	static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
82
	static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$
82
	static final String PROFILE_DIR = SEPARATOR_OS + "eclipse" + SEPARATOR_OS; //$NON-NLS-1$
83
	static final String PROFILE_DIR = SEPARATOR_OS + "eclipse" + SEPARATOR_OS; //$NON-NLS-1$
Lines 821-826 Link Here
821
			browser.dispose ();
822
			browser.dispose ();
822
			error (rc);
823
			error (rc);
823
		}
824
		}
825
		
826
		/* Disable Javascript */
827
		if ((style & SWT.DISABLE_JAVASCRIPT) == 0) {
828
			buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_JAVASCRIPTENABLED, true);
829
			rc = prefBranch.SetBoolPref (buffer, 0);
830
			if (rc != XPCOM.NS_OK) {
831
				browser.dispose ();
832
				error (rc);
833
			}
834
		}
824
835
825
		prefBranch.Release ();
836
		prefBranch.Release ();
826
837
(-)Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java (-1 / +1 lines)
Lines 203-209 Link Here
203
	frame = new OleFrame(browser, SWT.NONE);
203
	frame = new OleFrame(browser, SWT.NONE);
204
204
205
	try {
205
	try {
206
		site = new WebSite(frame, SWT.NONE, ProgId); //$NON-NLS-1$
206
		site = new WebSite(frame, style & SWT.DISABLE_JAVASCRIPT, ProgId); //$NON-NLS-1$
207
	} catch (SWTException e) {
207
	} catch (SWTException e) {
208
		browser.dispose();
208
		browser.dispose();
209
		SWT.error(SWT.ERROR_NO_HANDLES);
209
		SWT.error(SWT.ERROR_NO_HANDLES);
(-)Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java (+9 lines)
Lines 24-29 Link Here
24
	COMObject iInternetSecurityManager;
24
	COMObject iInternetSecurityManager;
25
	COMObject iOleCommandTarget;
25
	COMObject iOleCommandTarget;
26
	boolean ignoreNextMessage;
26
	boolean ignoreNextMessage;
27
	boolean javascriptDisabled;
27
28
28
	static final int OLECMDID_SHOWSCRIPTERROR = 40;
29
	static final int OLECMDID_SHOWSCRIPTERROR = 40;
29
	static final short [] ACCENTS = new short [] {'~', '`', '\'', '^', '"'};
30
	static final short [] ACCENTS = new short [] {'~', '`', '\'', '^', '"'};
Lines 31-36 Link Here
31
32
32
public WebSite(Composite parent, int style, String progId) {
33
public WebSite(Composite parent, int style, String progId) {
33
	super(parent, style, progId);		
34
	super(parent, style, progId);		
35
	
36
	javascriptDisabled = (style & SWT.DISABLE_JAVASCRIPT) != 0;
34
}
37
}
35
38
36
protected void createCOMInterfaces () {
39
protected void createCOMInterfaces () {
Lines 456-461 Link Here
456
	*/
459
	*/
457
	int policy = IE.URLPOLICY_ALLOW;
460
	int policy = IE.URLPOLICY_ALLOW;
458
	/*
461
	/*
462
	 * Don't allow Javascript if it's disabled.
463
	 */
464
	if (dwAction == 5120 /*0x1400 - URLACTION_SCRIPT_RUN*/ && javascriptDisabled) {
465
	    policy = IE.URLPOLICY_DISALLOW;
466
	}
467
	/*
459
	* The URLACTION_JAVA flags refer to the <applet> tag, which resolves to
468
	* The URLACTION_JAVA flags refer to the <applet> tag, which resolves to
460
	* the Microsoft VM if the applet is java 1.1.x compliant, or to the OS's
469
	* the Microsoft VM if the applet is java 1.1.x compliant, or to the OS's
461
	* java plug-in VM otherwise.  Applets launched with the MS VM work in the
470
	* java plug-in VM otherwise.  Applets launched with the MS VM work in the
(-)Eclipse SWT/common/org/eclipse/swt/SWT.java (+12 lines)
Lines 1780-1785 Link Here
1780
	 * @since 3.3
1780
	 * @since 3.3
1781
	 */
1781
	 */
1782
	public static final int MOZILLA = 1 << 15;
1782
	public static final int MOZILLA = 1 << 15;
1783
	
1784
	/**
1785
	 * Style constant specifying that a Browser should not run any javascript
1786
	 * when rendering its content (value is 1&lt;&lt;16).
1787
	 * <p>
1788
	 * <p><b>Used By:</b><ul>
1789
	 * <li><code>Browser</code></li>
1790
	 * </ul></p>
1791
     * 
1792
	 * @since 3.4
1793
	 */
1794
	public static final int DISABLE_JAVASCRIPT = 1 << 16;
1783
1795
1784
	/**
1796
	/**
1785
	 * Style constant for balloon behavior (value is 1&lt;&lt;12).
1797
	 * Style constant for balloon behavior (value is 1&lt;&lt;12).

Return to bug 161864