Closed
Bug 298807
Opened 20 years ago
Closed 16 years ago
nsIBookmarksService::ResolveKeyword can make a better use of strings
Categories
(Firefox :: Bookmarks & History, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jshin1987, Assigned: jshin1987)
References
Details
Attachments
(2 files, 1 obsolete file)
|
7.91 KB,
patch
|
jshin1987
:
review+
neil
:
superreview+
asa
:
approval-aviary1.1a2+
|
Details | Diff | Splinter Review |
|
8.05 KB,
patch
|
Details | Diff | Splinter Review |
ResolveKeyword is currently declared as string resolveKeyword(in wstring aName, out wstring aPostData) What it returns is actually in UTF-8 so that we'd better declare it as AUTF8String resolveKeyword(in wstring aName, out AString aPostData) With that, we can avoid ToNewUnicode and ToNewUTF8String in actual implementations.Moreover, the string conversion across XPConnect will be done properly instead of 'blind inflation'.
| Assignee | ||
Comment 1•20 years ago
|
||
asking for r perhaps, we have to change most of string/wstring to A(C)String in nsIBookmarksService.idl (especially for out parameters and return values)
Attachment #187345 -
Flags: review?(vladimir)
Comment on attachment 187345 [details] [diff] [review] patch r=me
Attachment #187345 -
Flags: review?(vladimir) → review+
| Assignee | ||
Comment 3•20 years ago
|
||
Comment on attachment 187345 [details] [diff] [review] patch thanks for r. asking for sr.
Attachment #187345 -
Flags: superreview?(neil.parkwaycc.co.uk)
Comment 4•20 years ago
|
||
Comment on attachment 187345 [details] [diff] [review] patch Wouldn't nsAString& be better still? Then you could simply return GetURLFromResource(source, aShortcutURL);
| Assignee | ||
Comment 5•20 years ago
|
||
(In reply to comment #4) > (From update of attachment 187345 [details] [diff] [review] [edit]) > Wouldn't nsAString& be better still? Then you could simply return > GetURLFromResource(source, aShortcutURL); I debated it myself and left it alone (reminding myself that some people here prefer UTF-8 to UTF-16 when most of time, we have ASCII). However, if you like that way, I'm happy to use AString instead of AUTF8String.
Status: NEW → ASSIGNED
(In reply to comment #5) > (In reply to comment #4) > > (From update of attachment 187345 [details] [diff] [review] [edit] [edit]) > > Wouldn't nsAString& be better still? Then you could simply return > > GetURLFromResource(source, aShortcutURL); > > I debated it myself and left it alone (reminding myself that some people here > prefer UTF-8 to UTF-16 when most of time, we have ASCII). However, if you like > that way, I'm happy to use AString instead of AUTF8String. Neil makes a good point.. also, all of the callers of this are in JS where everything is UTF16 anyway, so changing it to use AString won't affect any callers (and will avoid the need for another UTF8->16 conversion).
| Assignee | ||
Comment 7•20 years ago
|
||
(In reply to comment #6) > all of the callers of this are in JS where > everything is UTF16 anyway, so changing it to use AString won't affect any > callers (and will avoid the need for another UTF8->16 conversion). I considered that, too... Wasn't it overwhelmingly in favor of AString? It sure looks that way, but somehow it didn't look that way when I wrote the patch.. |return GetURLFromResource(source, aShortcutURL);| would change the behavior slightly if GetURLFromResource succeeds while returning an empty string for aShortcutURL. I guess that never happens and checking with IsEmpty (after checking with NS_FAILED) in the current tree is redundant. Unless I'm wrong on this point, I'll do |return GetURLFromResource(source, aShortcutURL);| as suggested.
| Assignee | ||
Comment 8•19 years ago
|
||
now I use AString as suggested.
Attachment #187345 -
Attachment is obsolete: true
Attachment #188012 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #188012 -
Flags: review?(vladimir)
| Assignee | ||
Updated•19 years ago
|
Attachment #187345 -
Flags: superreview?(neil.parkwaycc.co.uk)
Comment 9•19 years ago
|
||
Comment on attachment 188012 [details] [diff] [review] patch (use AString) >- nsDependentString postDataStr(postDataVal); >- *aPostData = ToNewUnicode(postDataStr); >+ aPostData = postDataVal; I note that the original author of the code failed to follow XPCOM rules and only set aPostData when they felt like it...
Attachment #188012 -
Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
| Assignee | ||
Comment 10•19 years ago
|
||
Comment on attachment 188012 [details] [diff] [review] patch (use AString) Thanks for sr. transferring r and asking for a. I'll truncate aPostData in other cases. This is a little enhancement in terms of the code quality and I18n-correctness with little risk.
Attachment #188012 -
Flags: review?(vladimir)
Attachment #188012 -
Flags: review+
Attachment #188012 -
Flags: approval-aviary1.1a2?
Updated•19 years ago
|
Attachment #188012 -
Flags: approval-aviary1.1a2? → approval-aviary1.1a2+
| Assignee | ||
Comment 11•19 years ago
|
||
landed on the trunk
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 12•19 years ago
|
||
regression: bug 300170.
Comment 13•19 years ago
|
||
Please back this out for 1.1a2 due to the regressions in bug 300170, unless there is a very simple and obvious bustage fix.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Comment 14•19 years ago
|
||
sorry for the regression. It's not obvious why this regressed. For now, I backed out the patch.
Comment 15•19 years ago
|
||
Comment on attachment 188012 [details] [diff] [review] patch (use AString) Well, this has regressed due to the null checks on the return value of |ResolveKeyword()| (in browser.js/navigator.js) That is, you need to replace |if(!foo)| checks to |if (foo == "")| etc.) The postdata change might be more tricky, at least for JS callers.
Comment 16•19 years ago
|
||
adding in browser/components/bookmarks/src/nsBookmarksService.cpp:
if (aShortcutURL.IsEmpty())
return NS_ERROR_NULL_POINTER;
replacing the removed:
NS_PRECONDITION(aShortcutURL != nsnull, "null ptr");
if (! aShortcutURL)
return NS_ERROR_NULL_POINTER;
removes the regression (bug 300170).
Comment 17•19 years ago
|
||
| Assignee | ||
Comment 18•19 years ago
|
||
(In reply to comment #15) > (From update of attachment 188012 [details] [diff] [review] [edit]) > Well, this has regressed due to the null checks on the return value of > |ResolveKeyword()| (in browser.js/navigator.js) > > That is, you need to replace |if(!foo)| checks to |if (foo == "")| etc.) > > The postdata change might be more tricky, at least for JS callers. Yup, I was just looking at JS callers and realized that, too. Thanks, anyway.
Comment 19•19 years ago
|
||
Did this also cause the issue of not being to open links with target="_content" from pages bookmarked in the sidebar? Try the tinderbox sidebar as an example.
Comment 20•19 years ago
|
||
(In reply to comment #19) > Did this also cause the issue of not being to open links with target="_content" > from pages bookmarked in the sidebar? Try the tinderbox sidebar as an example. Maybe. BuildID 2005070900 (with attachment #188012 [details] [diff] [review]) has the problem and BuildID 2005070922 (without attachment #188012 [details] [diff] [review]; backed out at 2005-07-09 07:29 PDT) doesn't have it. Mozilla/5.0 (Windows; U; Win 9x 4.90; ja; rv:1.8b3) Gecko/20050709 Firefox/1.0+
Updated•16 years ago
|
Version: unspecified → 1.0 Branch
Comment 21•16 years ago
|
||
Places code is different and not going to take further fixes on 2.x or previous
Status: REOPENED → RESOLVED
Closed: 19 years ago → 16 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•