Open Bug 666254 Opened 8 years ago Updated 6 years ago

nsIClipboard.emptyClipboard doesn't work


(Core :: Widget: Cocoa, defect)

Not set




(Reporter: vb4guy, Unassigned)


User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB7.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322; MS-RTC LM 8)
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0

According to calling the emptyClipboard method from nsIClipboard should clear the clipboard but it doesn't do so.  This is happening in Windows XP Pro.

Reproducible: Always

Steps to Reproduce:
        this.ClearData = function()
            var nsIClipboard = Components.classes[";1"].getService(Components.interfaces.nsIClipboard); 
            nsIClipboard.emptyClipboard(nsIClipboard.kGlobalClipboard); // This doesn't appear to do anything

Actual Results:  
The clipboard remains unmodified.

Expected Results:  
The clipboard should be empty.
it clears the logic clipboard, releasing the owner, but as specified in the idl it doesn't clear the native clipboard.

Thanks for the quick response!

Looking at the documentation again I see the paragraph that states that, but is there some other way to clear the native clipboard?

setData with a transferable that contains an unknown flavor should work, I don't know of other ways
I will try that but I think that this is a bug because the method takes the argument aWhichClipboard which can indicate the global/native clipboard.
Ever confirmed: true
Component: XPCOM → Widget: Cocoa
Hmm, the nsClipboard implementation in widget/cocoa doesn't even override EmptyClipboard(), so no wonder that function does not work on OSX (since we're using the nsBaseClipboard implementation which does not talk to the OS.)
According to this is a feature, not a bug...
Flags: needinfo?(ehsan)
That's not true.  The Windows implementation does indeed clear the clipboard contents.

(Note that it's possible that there is no platform API on mac to do the same, I'm not very familiar with these APIs on mac.)
Flags: needinfo?(ehsan)
OS: Windows XP → Mac OS X
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.