Closed Bug 78810 Opened 25 years ago Closed 24 years ago

CreateFixupURI does not handle view-source:www.cnn.com correctly

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.6

People

(Reporter: bzbarsky, Assigned: adamlock)

Details

Attachments

(4 files, 1 obsolete file)

In NS 4.x, view-source:www.cnn.com will show the source of http://www.cnn.com In Mozilla it will not. This is because CreateFixupURI will convert the above to http://view-source:www.cnn.com ... it should convert it to view-source:http://www.cnn.com
reviews?
Keywords: patch, review
about:view-source:about:view-source:http://bugzilla.mozilla.org/showattachment. cgi?attach_id=33118 [mind you it's an eclectic case and doesn't behave particularly well]
Hmm... good point.... We need to be smarter about matching. Better patch coming up. :)
hmm... Thinking a bit more. We need to remove the view-source: part before calling NS_NewURI; otherwise NS_NewURI will return no error. On the other hand, if we do remove it, NS_NewURI will return no error for things like view-source:http://www.mozilla.org and we will just load http://www.mozilla.org without viewsourcing it. So NS_NewURI could use some changes, maybe. So this actually needs some thought. My original approach is really no good. Doron, it may make sense to workaround this bug in view source for the time being.
Keywords: patch, review
hmm. I can override it by calling it up from the js which you already coded ;) for the time being.
-> 0.9.3
Target Milestone: --- → mozilla0.9.3
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Target Milestone: mozilla0.9.4 → mozilla0.9.5
Retargetting
Target Milestone: mozilla0.9.5 → mozilla0.9.6
I've submitted a new patch to fix view-source. This patch works by lopping off the "view-source:" from the front of the string and calling the nsDefaultURIFixup::CreateFixupURI again before rebuilding the result. This ensures stuff like view-source:www.cnn.com is correctly fixed up. Reviews please?
Comment on attachment 54678 [details] [diff] [review] New patch for this, some notes for follow >+ nsAutoString uriSansViewSource; weird indentation... >+ nsCOMPtr<nsIURI> uri; >+ uriString.Mid(uriSansViewSource, 12, uriString.Length() - 12); >+ nsresult rv = CreateFixupURI(uriSansViewSource.get(), getter_AddRefs(uri)); Would something like: nsCOMPtr<nsIURI> uri; nsresult rv = CreateFixupURI(PromiseFlatString(Substring(uriString, 12, uriString.Length() - 12)).get(), getter_AddRefs(uri)); not be better? That way you don't need the uriSansViewSource temporary variable an you avoid allocating, copying, and the like. >+ uriString.AssignWithConversion("view-source:"); use |uriString.Assign(NS_LITERAL_STRING("view-source:"));| >+ uriString.AppendWithConversion(spec.get()); I think a |.Append(NS_ConvertASCIItoUCS2(spec))| may be better here. Other than that, looks good.
Comment on attachment 54871 [details] [diff] [review] Patch with revised string stuff. Submitting this for sr r=bzbarsky
Attachment #54871 - Flags: review+
do we need to worry about these 'malformed' view-source URIs hitting the keyword server? it seems like we want to limit the 'fixup' to prepending 'http://' i'm not even sure if we want to tack on the 'www' and 'com' ... -- rick
Rick, the code for tacking on www. & .com is still in nsWebShell and nothing to do with the nsDefaultURIFixup. I understand what you're saying about the keyword service so I'll try and work out a patch that disables it cleanly for view-source.
yeah... at some point i want to remove the remaining stuff from nsWebShell and move it all into the URIFixup component... so i think that we need to specify a way that we can do 'limited' fixups for this class of URI string... -- rick
This patch adds a flags parameter to the nsIURIFixup::CreateFixupURI method. If this method is called with FIXUP_FLAG_NO_KEYWORD it will skip the keyword lookup on the URI. I ensure this flag is set when I call the method during view-source: fixup. Ultimately this interface should also to the post-fixup to tack on the www. & .com but that's another issue altogether. r/sr= please?
Comment on attachment 56092 [details] [diff] [review] Patch disable keyword service via a flag (notes to follow) r=bzbarsky (good thing we have no calls to createFixupURI anywhere in the chrome. :) )
Attachment #56092 - Flags: review+
Attachment #54871 - Attachment is obsolete: true
Comment on attachment 56736 [details] [diff] [review] Flipped the default for keyword lookup. Keyword lookup must now be enabled by a flag r/sr=blizzard
Attachment #56736 - Flags: superreview+
Comment on attachment 56736 [details] [diff] [review] Flipped the default for keyword lookup. Keyword lookup must now be enabled by a flag look good r=bzbarsky
Attachment #56736 - Flags: review+
Fix is in.
Status: NEW → RESOLVED
Closed: 24 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: