Closed Bug 173069 Opened 22 years ago Closed 22 years ago

Default Plug-ins receive relative URLS

Categories

(Core Graveyard :: Plug-ins, defect, P3)

x86
All
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.3beta

People

(Reporter: TaylorToddK, Assigned: peterl-bugs)

References

()

Details

(Keywords: topembed+, Whiteboard: [PL2:NA])

Attachments

(1 file, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0

Default plug-ins can receive relative URLS for PLUGINURL and PLUGINPAGE
attributes.  This means the plug-in would have to resolve the URL itself. 
Plug-ins are not initialized with the URL they are embedded in and can receive
both absolute and relative URLS.  It would beneficial if the plug-in manager
resolved all relative URLs to absolute ones, so plug-ins only have to handle one
scenario.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Summary: Default Plug-ins receive relative URLS → Default Plug-ins receive relative URLS
handing over to Serge for plug-in manager work
Assignee: beppe → serge
Priority: -- → P3
Whiteboard: [Plug-in Mgr]
Target Milestone: --- → mozilla1.3alpha
plug-in manager work???

The fix-up of relative URLs for PLUGINSPAGE/PLUGINURL can probably happen on the
array we pass the default plugin right before we call NPP_New.
I think CODEBASE has the same problem with the ActiveX plugin.
-->taking bug to fix for ActiveX for 1.3
Assignee: serge → peterl
Status: UNCONFIRMED → NEW
Ever confirmed: true
adding the topembed+ marker
Keywords: topembed+
moving to 1.3 beta
Whiteboard: [Plug-in Mgr] → [PL2:NA]
Target Milestone: mozilla1.3alpha → mozilla1.3beta
Attached patch patch v.1 (obsolete) — Splinter Review
patch to resolve relative URLS on PLUGINSPAGE or PLUGINSURL
Attached patch patch v.2 (obsolete) — Splinter Review
better patch: resolves relative urls for PLUGINURL or PLUGINSPAGE if it's in
either an attribute or PARAM tag.
Attachment #108761 - Attachment is obsolete: true
Attachment #109677 - Flags: superreview?(darin)
Attachment #109677 - Flags: review?(av)
Comment on attachment 109677 [details] [diff] [review]
patch v.2

>Index: nsObjectFrame.cpp

>+      nsCAutoString newURL, oldURL (ToNewUTF8String(value));

use:	NS_ConvertUCS2toUTF8 oldURL(value);

instead of ToNewUTF8String as it cuts out one buffer copy and
potentially avoids a heap allocation.


>+      if (NS_SUCCEEDED(baseURL->Resolve(oldURL, newURL))) {
>+        value.AssignWithConversion(newURL.get());

do you really mean to truncate any non-ASCII characters?  i.e.,
are you certain newURL is entirely ASCII?  if not, then use

	  value = NS_ConvertUTF8toUCS2(newURL);

>Index: nsObjectFrame.h

>+  void FixUpURLS(nsString &name, nsString &value);

looks to me like |name| could be a |const| param, i.e.:

    void FixUpURLS(const nsString &name, nsString &value);
Attachment #109677 - Flags: superreview?(darin) → superreview-
Attached patch patch v.3 (obsolete) — Splinter Review
NS_MakeAbsoluteURI seems to do all of that
Attachment #109677 - Attachment is obsolete: true
Attachment #109683 - Flags: superreview?(darin)
Attachment #109683 - Flags: review?(av)
Comment on attachment 109683 [details] [diff] [review]
patch v.3

hmm... a little wierd to use an input string as an output string in the same
function call.	fortunately, in this case NS_MakeAbsoluteURI doesn't do
anything like truncate the output buffer before anything else.	i fear that if
NS_MakeAbsoluteURI ever changed its behavior in this regard that your code
would simply break.  that makes it fairly fragile, so maybe it would be better
to not use NS_MakeAbsoluteURI here.  make sense?
Attachment #109683 - Flags: superreview?(darin) → superreview-
Attached patch patch v.4Splinter Review
oops, I meant to use a temp var instead of the same one for in/out. Here's that
patch.
Attachment #109683 - Attachment is obsolete: true
Attachment #109692 - Flags: superreview?(darin)
Attachment #109692 - Flags: review?(av)
Comment on attachment 109692 [details] [diff] [review]
patch v.4

sr=darin (although i would use a nsAutoString for newURL... no need for a new
patch if you agree.)
Attachment #109692 - Flags: superreview?(darin) → superreview+
Comment on attachment 109692 [details] [diff] [review]
patch v.4

r=av
Attachment #109692 - Flags: review?(av) → review+
patch w/ AutoString in trunk, marking FIXED.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Attachment #109677 - Flags: review?(av)
Attachment #109683 - Flags: review?(av)
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: