Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 99921 Details for
Bug 161864
Provide API to disable potentially dangerous content in Browser
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix
161864-HEAD-patch.txt (text/plain), 4.68 KB, created by
Jacek Pospychala
on 2008-05-13 07:05:19 EDT
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Jacek Pospychala
Created:
2008-05-13 07:05:19 EDT
Size:
4.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java,v >retrieving revision 1.101 >diff -u -r1.101 Mozilla.java >--- Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java 28 Apr 2008 15:05:15 -0000 1.101 >+++ Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java 13 May 2008 10:56:22 -0000 >@@ -77,6 +77,7 @@ > static final String PREFERENCE_PROXYHOST_SSL = "network.proxy.ssl"; //$NON-NLS-1$ > static final String PREFERENCE_PROXYPORT_SSL = "network.proxy.ssl_port"; //$NON-NLS-1$ > static final String PREFERENCE_PROXYTYPE = "network.proxy.type"; //$NON-NLS-1$ >+ static final String PREFERENCE_JAVASCRIPTENABLED = "javascript.enabled"; //$NON-NLS-1$ > static final String PROFILE_AFTER_CHANGE = "profile-after-change"; //$NON-NLS-1$ > static final String PROFILE_BEFORE_CHANGE = "profile-before-change"; //$NON-NLS-1$ > static final String PROFILE_DIR = SEPARATOR_OS + "eclipse" + SEPARATOR_OS; //$NON-NLS-1$ >@@ -821,6 +822,16 @@ > browser.dispose (); > error (rc); > } >+ >+ /* Disable Javascript */ >+ if ((style & SWT.DISABLE_JAVASCRIPT) == 0) { >+ buffer = MozillaDelegate.wcsToMbcs (null, PREFERENCE_JAVASCRIPTENABLED, true); >+ rc = prefBranch.SetBoolPref (buffer, 0); >+ if (rc != XPCOM.NS_OK) { >+ browser.dispose (); >+ error (rc); >+ } >+ } > > prefBranch.Release (); > >Index: Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java,v >retrieving revision 1.28 >diff -u -r1.28 IE.java >--- Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java 9 May 2008 21:26:14 -0000 1.28 >+++ Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java 13 May 2008 10:56:20 -0000 >@@ -203,7 +203,7 @@ > frame = new OleFrame(browser, SWT.NONE); > > try { >- site = new WebSite(frame, SWT.NONE, ProgId); //$NON-NLS-1$ >+ site = new WebSite(frame, style & SWT.DISABLE_JAVASCRIPT, ProgId); //$NON-NLS-1$ > } catch (SWTException e) { > browser.dispose(); > SWT.error(SWT.ERROR_NO_HANDLES); >Index: Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java,v >retrieving revision 1.41 >diff -u -r1.41 WebSite.java >--- Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java 6 May 2008 19:25:13 -0000 1.41 >+++ Eclipse SWT Browser/win32/org/eclipse/swt/browser/WebSite.java 13 May 2008 10:56:20 -0000 >@@ -24,6 +24,7 @@ > COMObject iInternetSecurityManager; > COMObject iOleCommandTarget; > boolean ignoreNextMessage; >+ boolean javascriptDisabled; > > static final int OLECMDID_SHOWSCRIPTERROR = 40; > static final short [] ACCENTS = new short [] {'~', '`', '\'', '^', '"'}; >@@ -31,6 +32,8 @@ > > public WebSite(Composite parent, int style, String progId) { > super(parent, style, progId); >+ >+ javascriptDisabled = (style & SWT.DISABLE_JAVASCRIPT) != 0; > } > > protected void createCOMInterfaces () { >@@ -456,6 +459,12 @@ > */ > int policy = IE.URLPOLICY_ALLOW; > /* >+ * Don't allow Javascript if it's disabled. >+ */ >+ if (dwAction == 5120 /*0x1400 - URLACTION_SCRIPT_RUN*/ && javascriptDisabled) { >+ policy = IE.URLPOLICY_DISALLOW; >+ } >+ /* > * The URLACTION_JAVA flags refer to the <applet> tag, which resolves to > * the Microsoft VM if the applet is java 1.1.x compliant, or to the OS's > * java plug-in VM otherwise. Applets launched with the MS VM work in the >Index: Eclipse SWT/common/org/eclipse/swt/SWT.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java,v >retrieving revision 1.155 >diff -u -r1.155 SWT.java >--- Eclipse SWT/common/org/eclipse/swt/SWT.java 8 May 2008 17:59:07 -0000 1.155 >+++ Eclipse SWT/common/org/eclipse/swt/SWT.java 13 May 2008 10:56:22 -0000 >@@ -1780,6 +1780,18 @@ > * @since 3.3 > */ > public static final int MOZILLA = 1 << 15; >+ >+ /** >+ * Style constant specifying that a Browser should not run any javascript >+ * when rendering its content (value is 1<<16). >+ * <p> >+ * <p><b>Used By:</b><ul> >+ * <li><code>Browser</code></li> >+ * </ul></p> >+ * >+ * @since 3.4 >+ */ >+ public static final int DISABLE_JAVASCRIPT = 1 << 16; > > /** > * Style constant for balloon behavior (value is 1<<12).
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 161864
:
99921
|
101244