Closed Bug 571074 Opened 10 years ago Closed 1 year ago

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

Categories

(Core :: DOM: Serializers, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: mats, 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: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.