| Summary: | Set XULRunner security policies to allow pasting | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Robert Munteanu <robert.munteanu> |
| Component: | Mylyn | Assignee: | Project Inbox <mylyn-triaged> |
| Status: | RESOLVED WONTFIX | QA Contact: | Tom Seidel <tom.seidel> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | steffen.pingel |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Robert Munteanu
Sounds like a good enhancement. I've tried to reproduce this behavior on Windows (Win7-IE8) and Linux (Ubuntu 10.04 - FF3.6.16), but was not able to. When I use Ctrl+V a paste is executed directly without any limitations. Can you give me please a detailed configuration of your target system so that I can reproduce this error? I have had this problem on OpenSUSE 11.4 with FF 4.0 installed. I'll try and reproduce it again today. It definitely does happen for me. I can verify the following: * Eclipse is running against xulrunner 1.9.2 - AFAIK that means Firefox 3.6 * Copy/paste is working in other fields in the task editor * If I open e.g. the task url and try to paste data into a text field, that also works * Focusing the editor and using the Edit menu to paste does not work either. Is there any way I can debug this issue? Ok, I'll take a look a that issue. Debugging can be done if you install the Firebug-Plugin and just open the base.html in your system-browser. I think this is a good starting point. I was able to test my particular combination on a Windows 7 machine, and it works. Therefore it seems to be a system-specific issue. About the firebug integration, how should I do that? I guess Eclipse uses a private profile and I'm not sure how to install Firebug into it. Or do you mean opening base.html in Firefox like I would open any other page? I'm not sure what do afterwards. One more note - I am able to paste directly using the sample RCP app, but not in my implementation of a rich text task editor. Any idea what could be interfering? I guess you're extending EditorParts from Mylyn.. - Probably they're hooking something like a handler that prevents pasting directly into the widget. Steffen, do you know of anything that the Mylyn tasks framework does that might prevent copy/paste from being handled properly by a custom task editor part? The task editor registers action handlers for cut/copy/paste to support these operations for different widget types. Take a look at CommonTextSupport.canPerformAction() (and AbstractTaskEditorPage.canPerformAction()). We may need to add support for browsers there. Thanks for the pointer Steffen, I managed to find the root cause - @CommonTextSupport.doAction@ only supports instances of Text and StyledText . By overriding the @AbstractTaskEditorPage.doAction@ method I can access the Browser control, but not the wrapping HtmlComposer, which I would need to properly execute the commands. Tom, do you have any ideas of how I can access the HtmlComposer associated with a Browser, or execute commands on the browser control in any other manner? I could maintain my own mapping of Brower to HtmlComposer references, but things can get messy quickly with that approach. To maintain mappings from StyledText to SourceViewer controls we use setData(). That way you can easily get the viewer reference if you have access to the control. Thanks, somehow I missed that. Now I seem to be making progress. To handle a 'copy' command I use the following code:
bc.
if (actionId.equals(ActionFactory.COPY.getId())) {
composer.execute(new Command() {
@Override
public String getCommandIdentifier() {
return "copy";
}
});
return;
}
But when I press Control-C I get a Javascript popup which informs me that 'Your browser security settings don't permit the editor to automatically execute copying operations. Please use the keyboard for that (Ctrl/Cmd+C).' . I understand what it says, but I have no idea how to work around it in Eclipse.
This is definitely the security policy of XULRunner which prevents direct pasting. I must admit that my knowledge about XULRunner is already some years old, but I remember that some of the configuration can be set directly via JavaScript via something like netscape.security.PrivilegeManager.enablePrivilege. I'll take a look how this can be set, Robert probably you could do also some research :) Thanks, I'll have a look at the way the XULRunner security policy is configured. Copy/paste support is problematic for XULRunner. I have found that I need to set the user preference @signed.applets.codebase_principal_support@ to true. Obviously this does not work with a fresh SWT Browser instance, as it would be a security risk. Instead, according to http://www-archive.mozilla.org/unix/customizing.html#prefs I need to fiddle with user.js and prefs.js . This seems quite unlikely to be possible to me, unless there is support from platform which I'm missing. If that is the case, I'm inclined to leave this as it is, as Eclipse 3.7 will try to use a WebKit-based browser widget on GTK by default ( http://www.eclipse.org/swt/faq.php#browserwebkitgtk ). Ok, this is not really a solution :). Another possibility I've already tried to enable Flash-content in a XULRunner was shipping my own XULRunner. Mozilla provides AFAIK osgi-bundles with an integrated XULRunner. You could specifiy the global settings directly within that bundle and point eclipse to your own XULRunner. Regarding Webkit: Have you already tried Webkit with Eclipse 3.7? - Is this also an issue with Webkit? With Eclipse 3.7 on Linux I am able to use all keyboard actions without even overriding doAction: copy, paste, select all, redo, undo. If I instantiate the composer with the SWT.MOZILLA flag then the actions stop working. I am not sure why this happens only with Mozilla, but I can tell that it works on WebKit/GTK and IE. I can test on Mac OSX also, but since it also uses WebKit it should work. As for shipping a custom/private XulRunner bundle, this would be too heavyweight for me. I would be content with the composer working properly on Windows, MacOS and Linux+WebKit and warning the users of limitations on Linux + Mozilla. Perhaps there is value in opening a bug against platform, but given that the trend is towards using the web kit browser I don't think that the situation will be improved. To try and sum up: if I can identify the problem with the Mozilla-backed browser I will report this to Platform/SWT . I just need to isolate the problem from the Mylyn framework. I've also looked for an existing bug report but was unable to find one. Ok, marking this as WONTFIX, since there is no easy way to fix that. In addition ther is this workaround with the popup and the fact of the replacement of XULRunner with Webkit. Thanks for your investigations Robert. |