Closed Bug 277658 Opened 20 years ago Closed 20 years ago

Make error pages URL a pref

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Biesinger, Assigned: vhaarr+bmo)

References

()

Details

Attachments

(1 file, 1 obsolete file)

currently, the error page url is hardcoded in nsDocShell.cpp:
2847     errorPageUrl.AssignLiteral("chrome://global/content/netError.xhtml?e=");

it would be nice if embeddors could specify a different URL - I was specifically
asked by the epiphany people to offer such a way.

I suggest using a pref for this. this would also allow overriding them by users,
for better or worse. other possibilities would include a category entry, or a
per-docshell setting (nsIDocShell::setErrorPageURL), but I think I like the pref
best.
Pref sounds good to me.
Be careful about making this too easy - we don't want to allow malware to
forward people to an advertising-filled page.

Also, the error page must be local, otherwise it could become an endless loop.
Attached patch version 1.0 (obsolete) — Splinter Review
First version.

I use CharPref, because it was (not clearly) decided in #devs that a
ComplexPref was not needed, as long as embeddors can encode any intl chars
they'd want in there ..

I don't think we need to take any special considerations on this as opposed to
other prefs that have URIs in them, regarding security. If someone has access
to the prefs, I think we'd have bigger problems in store than people getting
sent on roundabouts or to ad sites.

biesi: Can you review this?
Attachment #173019 - Flags: review?(cbiesinger)
Comment on attachment 173019 [details] [diff] [review]
version 1.0

timeless kindly let me know that if (!prefBranch), I'm dereferencing random
memory in
+    errorPageUrl.AssignASCII(errorPagePrefLocation);
And suggested I use nsXPIDLCString instead of char for errorPagePrefLocation.

He also asked if I could fixup the PR_FREEIF's to us nsMemory::Free, since
that's what allocs them.

I'll patch it tonight.
Attachment #173019 - Attachment is obsolete: true
Attachment #173019 - Flags: review?(cbiesinger)
Attached patch version 1.2Splinter Review
Updated as per comment #4
Assignee: cbiesinger → bugmail
Status: NEW → ASSIGNED
Attachment #173119 - Flags: review?(cbiesinger)
Comment on attachment 173119 [details] [diff] [review]
version 1.2

thanks.
Attachment #173119 - Flags: superreview?(bzbarsky)
Attachment #173119 - Flags: review?(cbiesinger)
Attachment #173119 - Flags: review+
So... GetCharPref() only does ascii, no?  How exactly are non-ascii URIs
supposed to be done?
Yes, it only does ASCII .. We figured that it wasn't that important, and that
people could encode intl chars if they needed them (although I'm not entirely
sure what scheme you would use?).

bz: If you're more comfortable with using GetCompexPref with an
nsISupportsString, for example, I could do that ?
Comment on attachment 173119 [details] [diff] [review]
version 1.2

Hmm... Right.  This is a URI, so they can URI-escape the UTF8 (and should).
Attachment #173119 - Flags: superreview?(bzbarsky) → superreview+
Checked in by silver%warwickcompsoc.co.uk.
Thanks! Marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: