Closed Bug 647666 Opened 13 years ago Closed 8 years ago

Copy to clipboard doesn't work on MAC OS for some flavors

Categories

(Core :: Widget: Cocoa, defect)

1.9.2 Branch
x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 860857

People

(Reporter: dukedoc, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-EN; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12

When copying data to the clipboard using the following code the clipboard is empty.
function copyData(thumID) {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    var clip = nsCC["@mozilla.org/widget/clipboard;1"].getService(nsCI.nsIClipboard);
    if (!clip) return false;
    var trans = nsCC["@mozilla.org/widget/transferable;1"].createInstance(nsCI.nsITransferable);
    if (!trans) return false;
    var transferString = createTransferableGraphic(thumID);
    var strGraph = nsCC["@mozilla.org/supports-string;1"].createInstance(nsCI.nsISupportsString);
    if (!strGraph) return false;
    strGraph.data=transferString;
    trans.addDataFlavor("text/x-my-specific-xmldata");
    trans.setTransferData("text/x-my-specific-xmldata", strGraph, transferString.length*2);
    clip.setData(trans,null,clip.kGlobalClipboard);
}

After invoking the method on Windows OS the clipboard is not empty, but it is empty on MAC OS.

Reproducible: Always

Steps to Reproduce:
1. Create clipboard instance:  var clip = nsCC["@mozilla.org/widget/clipboard;1"].getService(nsCI.nsIClipboard);
2. Create transferable object: var trans = nsCC["@mozilla.org/widget/transferable;1"].createInstance(nsCI.nsITransferable);
3. Create data to transfer: var transferString = createTransferableGraphic(thumID);
4. Create transferable data object: var strGraph = nsCC["@mozilla.org/supports-string;1"].createInstance(nsCI.nsISupportsString);
5. Add your specific data flavor to transferable object and fill it: trans.addDataFlavor("text/x-my-specific-xmldata");
    trans.setTransferData("text/x-my-specific-xmldata", strGraph, transferString.length*2);
6. Put the data to the clipboard: clip.setData(trans,null,clip.kGlobalClipboard);

Actual Results:  
The clipboard is empty on MAC OS.

Expected Results:  
The clipboard should contain data to transfer.
Version: unspecified → 3.6 Branch
Component: Developer Tools → General
QA Contact: developer.tools → general
Component: General → Widget: Cocoa
Product: Firefox → Core
QA Contact: general → cocoa
Version: 3.6 Branch → Trunk
Version: Trunk → 1.9.2 Branch
This is now supported for DataTransfer via bug 860857.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.