Ticket #5951: 5951.patch

File 5951.patch, 1.2 KB (added by Alfonso Martínez de Lizarrondo, 14 years ago)

Proposed patch

  • _source/plugins/pastetext/plugin.js

     
    2121                                        if ( !clipboardText )
    2222                                                throw 0;
    2323                                        return clipboardText;
    24                                 },
    25                                 function()
    26                                 {
    27                                         window.netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect" );
    28 
    29                                         var clip = window.Components.classes[ "@mozilla.org/widget/clipboard;1" ]
    30                                                         .getService( window.Components.interfaces.nsIClipboard );
    31                                         var trans = window.Components.classes[ "@mozilla.org/widget/transferable;1" ]
    32                                                         .createInstance( window.Components.interfaces.nsITransferable );
    33                                         trans.addDataFlavor( "text/unicode" );
    34                                         clip.getData( trans, clip.kGlobalClipboard );
    35 
    36                                         var str = {}, strLength = {}, clipboardText;
    37                                         trans.getTransferData( "text/unicode", str, strLength );
    38                                         str = str.value.QueryInterface( window.Components.interfaces.nsISupportsString );
    39                                         clipboardText = str.data.substring( 0, strLength.value / 2 );
    40                                         return clipboardText;
    4124                                }
    4225                                // Any other approach that's working...
    4326                                );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy