Closed
Bug 148671
Opened 24 years ago
Closed 24 years ago
function retrieveURLFromData() is triplicated (?) in the code with slight differences.
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect)
Core
DOM: Copy & Paste and Drag & Drop
Tracking
()
RESOLVED
FIXED
People
(Reporter: p_ch, Assigned: p_ch)
Details
Attachments
(1 file, 2 obsolete files)
|
6.97 KB,
patch
|
Details | Diff | Splinter Review |
I have selected the best retrieveURLFromData I found and added on optimization.
and I put it in transferUtils inside nsTransferable.js
Patch will follow.
rginda, jag, ben, do you agree with the way this cleanup is done?
| Assignee | ||
Comment 1•24 years ago
|
||
r and sr needed
i think you should document in tabbrowser.xml that you require transferUtils
from nsTransferable.js
otherwise someone who decides to use a <tabbrowser/> might not know that it's
required...
| Assignee | ||
Comment 3•24 years ago
|
||
tabbrowser uses also nsDragAndDrop.js. It could be a good idea to specify the
dependencies in a header of tabbrowser.xml
Comment on attachment 85982 [details] [diff] [review]
Patch v1.0
just a reminder about an else after return here:
+ if (aData.search(client.linkRE) != -1)
+ return aData;
+ else
+ return null;
you might consider
+ if (aData.search(client.linkRE) == -1)
+ return null;
+ return aData;
Attachment #85982 -
Flags: review+
Comment 5•24 years ago
|
||
Pierre: client.linkRE is a chatzilla thing which doesn't apply to tabbrowser etc.
You could factor out the text/unicode case like:
switch (flavour) {
case "text/unicode":
var url = ... // do whatever needs doing at each site
return url;
default:
return transferUtils.retrieveURLFromData(data, flavour);
}
and make retrieveURLFromData deal with just the x-moz-url and x-moz-file cases.
Or add the |case "text/unicode": return data;| to retrieveURLFromData and
override it for chatzilla.
| Assignee | ||
Comment 6•24 years ago
|
||
Patch adressing jag's and rginda's concerns by leaving the link filtering on
the chatzilla side.
Attachment #85982 -
Attachment is obsolete: true
Comment 7•24 years ago
|
||
Comment on attachment 90560 [details] [diff] [review]
Patch v1.1
r=rginda on the chatzilla changes
Attachment #90560 -
Flags: review+
Comment 8•24 years ago
|
||
Comment on attachment 90560 [details] [diff] [review]
Patch v1.1
>+ var ioService = Components.classes["@mozilla.org/network/io-service;1"]
>+ .getService(Components.interfaces.nsIIOService);
Could you format it like this:
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
No need for a new patch for this.
>Index: extensions/irc/xul/content/static.js
>===================================================================
>RCS file: /cvsroot/mozilla/extensions/irc/xul/content/static.js,v
>retrieving revision 1.53
>diff -u -r1.53 static.js
>--- extensions/irc/xul/content/static.js 25 May 2002 00:39:59 -0000 1.53
>+++ extensions/irc/xul/content/static.js 8 Jul 2002 23:55:11 -0000
>@@ -1932,8 +1907,8 @@
> contentDropObserver.onDrop =
> function tabdnd_drop (aEvent, aXferData, aDragSession)
> {
>- var url = retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
>- if (!url)
>+ var url = transferUtils.retrieveURLFromData(aXferData.data, aXferData.flavour.contentType);
>+ if (!url || url.search(client.linkRE) == -1)
> return;
>
> if (url.search(/\.css$/i) != -1 && confirm (getMsg("tabdnd_drop", url)))
Is it okay to search on client.linkRE for all flavours?
Comment 9•24 years ago
|
||
> Is it okay to search on client.linkRE for all flavours?
yes.
Comment 10•24 years ago
|
||
For the indentation, this is what I meant (stupid bugzilla turning spaces into tabs)
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
sr=jag
Updated•24 years ago
|
Attachment #90560 -
Flags: superreview+
| Assignee | ||
Comment 11•24 years ago
|
||
indentation corrected
Attachment #90560 -
Attachment is obsolete: true
| Assignee | ||
Updated•24 years ago
|
Summary: function retreiveURLFromData() is triplicated (?) in the code with slight differences. → function retrieveURLFromData() is triplicated (?) in the code with slight differences.
| Assignee | ||
Comment 12•24 years ago
|
||
checked in by timeless weeks ago, marking fix
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.
Description
•