Closed Bug 1266724 Opened 9 years ago Closed 8 years ago

JavaScript error: TypeError: sourceDocument.defaultView is null

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox48 --- affected
firefox49 --- fixed

People

(Reporter: alessarik, Assigned: ajain2, Mentored)

References

Details

(Whiteboard: [good first bug] btpp-backlog)

Attachments

(1 file)

JavaScript error: file: .../dist/bin/components/contentAreaDropListener.js, line 123: TypeError: sourceDocument.defaultView is null Looks like it happens in > if (sourceDocument && eventDocument) { > let sourceRoot = sourceDocument.defaultView.top; > if (sourceRoot && sourceRoot == eventDocument.defaultView.top) > return false; > } It happens if we go to new page by link, but before page loaded we drag some picture element on previous page and try to move it over new loaded page.
Depends on: 1181564
Component: Untriaged → Drag and Drop
Product: Firefox → Core
We can just null-check sourceDocument.defaultView here and return true. This can happen if someone removes the node being dragged from its document while dragging.
Mentor: enndeakin
Neil, is this a good first bug? Backlog?
Flags: needinfo?(enndeakin)
Whiteboard: btpp-followup-2016-05-05
Yes, this is an easy null-pointer fix.
Flags: needinfo?(enndeakin)
Whiteboard: btpp-followup-2016-05-05 → [good first bug] btpp-backlog
Can I work on this? I am a beginner so Could someone help me fix this bug?
Hi, thanks you helping out. You can take this bug by assigning it yourself. The error is shown in the first comment: sourceDocument.defaultView is null To fix this, add a null check for this in contentAreaDropListener.js.
Hi Neil, thanks you for that. What release do I need to clone? I tried to find but failed to get the link.
If you'd like to build Mozilla, you can get mozilla-central as described at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build
Hi there, There are two such files, one under /dom/base/ and one under ../dist/bin/components/ . Does both files need change or just under the ../dist/bin/components?
Just the one under dom/base. The one under dist/bin/components is the generated output.
Within my knowledge I think I should check the null value for equality(==) and not identity(===), right? > if (sourceDocument && eventDocument) { > if(sourceDocument.defaultView == null) > return true; > let sourceRoot = sourceDocument.defaultView.top; > if (sourceRoot && sourceRoot == eventDocument.defaultView.top) > return false; > } I am building it right now but What do you think about this snippet?
That looks good. You will need to attach a patch to the bug and request review from me.
Thanks for the response. Any suggestions on how to submit a patch for a review? How do I request a review tag for the patch?
Flags: needinfo?(enndeakin)
Attached patch DefaultViewNull.patch (deleted) — Splinter Review
The Build was successful on my local system. Please review the patch and let me know the changes, if any. Thanks
Comment on attachment 8753705 [details] [diff] [review] DefaultViewNull.patch OK thanks! I reviewed this patch. In future, you can request review from someone when attaching a patch; there should be a dropdown where you can set it to a question mark, then fill in the reviewer. The next step would normally be to post it to our 'try' server which would perform all of our automated tests. That probably isn't necessary for this patch as it is just a null check on code that isn't easily tested automatically. Otherwise, I can check this in. Thanks again.
Flags: needinfo?(enndeakin)
Attachment #8753705 - Flags: review+
Assignee due to facts
Assignee: nobody → ajain2
Status: NEW → ASSIGNED
(In reply to Neil Deakin from comment #14) > Otherwise, I can check this in. Thanks again. @Neil: I think you should check in to trunk
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: