Closed Bug 666254 Opened 13 years ago Closed 2 years ago

nsIClipboard.emptyClipboard doesn't work

Categories

(Core :: Widget: Cocoa, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
101 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox99 --- wontfix
firefox100 --- wontfix
firefox101 --- fixed

People

(Reporter: vb4guy, Assigned: m_kato)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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 https://developer.mozilla.org/en/nsIClipboard#emptyClipboard() 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:
Code: 
        this.ClearData = function()
        {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            
            var nsIClipboard = Components.classes["@mozilla.org/widget/clipboard;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.
Marco,

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?

-Mike
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.
Status: UNCONFIRMED → NEW
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 https://bugzilla.mozilla.org/show_bug.cgi?id=416459#c15 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

Should this work nowadays? In bug 1261299 EmptyClipboard for Mac OS was implemented.

@spohl: any idea? If it actually works, it could allow enabling existing tests, see https://searchfox.org/mozilla-central/search?q=%28666254%29&path=&case=true&regexp=true.spohl

Flags: needinfo?(spohl.mozilla.bugs)

Actually, nsIClipboard.emptyClipboard on macOS doesn't clear system
clipboard. Since other platforms clear it, so I would like to change to same
behaviour.

Also, since we have base class of nsIClipboard, we should Inherit it to share
code.

Assignee: nobody → m_kato
Status: NEW → ASSIGNED
Flags: needinfo?(spohl.mozilla.bugs)
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/c40c000f87d7
nsIClipboard.emptyClipboard should clear system clipboard. r=mac-reviewers,spohl
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch

Setting status-firefox100=wontfix. I don't think we need to uplift this fix to Beta 100 because this is a very old bug.

Regressions: 1771823
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: