Closed Bug 267990 Opened 20 years ago Closed 20 years ago

crash [@ nsXFormsModelElement::DocumentChanged]

Categories

(Core Graveyard :: XForms, defect)

x86
Linux
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: darin.moz, Assigned: darin.moz)

References

()

Details

(Keywords: crash)

Crash Data

Attachments

(3 files)

crash [@ nsXFormsModelElement::DocumentChanged] will attach stack trace here's where we crash: 186 nsIScriptGlobalObject *window = doc->GetScriptGlobalObject(); 187 188 nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(window); 189 targ->AddEventListener(NS_LITERAL_STRING("load"), this, PR_TRUE); |targ| is null when we get to line 189. it is null because |window| is null. to repro, browse to the given URL.
Attached file stack trace
If I hack around the problem with a 'NS_ENSURE_TRUE(window);', I then crash inside nsXFormsInstanceElement::GetModel, which is being called by nsXFormsInstanceElement::Load.
Attached file reduced testcase
save this attachment locally as 'crash-bug-267990.xhtml', and then load it to reproduce this crash.
this crash only appears to occur when the instance data is the document containing the xforms. is it possible that we crash because we are trying to evaluate xforms in the instance document?
Alex: Should XTF restrict bindings to cases where XML content is actually loading in a browser window? Or, how can we make sure that XForms is only invoked when loading content in a browser window?
Attached patch v1 patchSplinter Review
Here's a solution for this crash that only involves changes to XForms. I've added some null checks, and added a check to ensure that we only load external instance documents when the <instance> element lives in a document w/ an associated DOM window.
Assignee: bryner → darin
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8beta
Attachment #166916 - Flags: review?(bryner)
Comment on attachment 166916 [details] [diff] [review] v1 patch >+ // Do not try to load an instance document if the current document >+ // is not associated with a DOM window. This could happen if some >+ // XForms document loaded itself as instance data. Yes, it does Really if it loaded any XML document that has XForms elements... doesn't need to be itself. r=me with a slight comment clarification.
Attachment #166916 - Flags: review?(bryner) → review+
fixed-on-trunk with tweak to comment.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Severity: major → critical
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8a6) Gecko/20041201 Firefox/1.0+ No crash with the test case
Crash Signature: [@ nsXFormsModelElement::DocumentChanged]
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: