Closed Bug 571074 Opened 14 years ago Closed 5 years ago

nsTransferable::GetTransferData callers depend on valid out params also when it returns an error

Categories

(Core :: DOM: Serializers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: evilpie)

References

Details

Attachments

(2 files)

(Follow-up from bug 565392 comment 10)

nsTransferable::GetTransferData callers depend on valid out params also when it returns an error.
Assignee: nobody → evilpies
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f9900ac6071c
Mark nsITransferable.getTransferData as [must_use]. r=mats
In HTMLEditor::PasteInternal, the kHTMLContext and/or kHTMLInfo MIME types on the clipboard should not be required to paste.
Flags: needinfo?(evilpies)
nsContentUtils::TransferableToIPCTransferable changed in behavior, because we don't add an empty item anymore, but instead skip it. I think for that we should first clean this up.
While trying to handle a failed GetTransferData call I made some mistake, mostly because this function has incredibily
confusing control flow. I would actually assume some of its current behavior is not intentional.

For this we assume that data == nullptr <-> NS_FAILED(rv), this is probably not 100% correct, but doesn't seem to
matter in practice. (This is a change in behavior that is intentional, because we want to check return value)

If we trace the data == nullptr case through the old code, we realize that for aInSyncMessage we will just continue.
(This is because nullptr doesn't queryInterface to anything)
Keywords: leave-open
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/b90c87fbab03
Refactor nsContentUtils::TransferableToIPCTransferable to make error handling more obvious. r=smaug
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/2e4c5ef41c73
Mark nsITransferable.getTransferData as [must_use]. r=mats
Keywords: leave-open
https://hg.mozilla.org/mozilla-central/rev/2e4c5ef41c73
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Depends on: 1526971
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: