Closed
Bug 70083
Opened 24 years ago
Closed 23 years ago
[API] work on |GetXXXFragment|
Categories
(Core :: XPCOM, defect, P1)
Core
XPCOM
Tracking
()
RESOLVED
WONTFIX
mozilla1.0
People
(Reporter: scc, Assigned: jag+mozilla)
References
Details
(Whiteboard: [driver:scc])
Attachments
(3 files, 4 obsolete files)
2.94 KB,
text/plain
|
Details | |
22.22 KB,
patch
|
scc
:
superreview+
|
Details | Diff | Splinter Review |
118.74 KB,
patch
|
Details | Diff | Splinter Review |
The current |GetXXXFragment| routines API and requirements force sub-optimal
behavior for multi-fragment strings. I have an ancient patch that shows what I
want; will attach anon.
Reporter | ||
Comment 1•24 years ago
|
||
Targeting mozilla0.9.1, but this is one of the bugs I would like to pull in to
0.9 if I have time.
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla0.9.1
Reporter | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.1 → mozilla0.9
Reporter | ||
Updated•24 years ago
|
Reporter | ||
Comment 2•24 years ago
|
||
Correcting this problem is the actual solution to bug #74709.
Summary: work on |GetXXXFragment| → [API] work on |GetXXXFragment|
Reporter | ||
Comment 4•24 years ago
|
||
re-targeting milestones, starting from a clean slate
Target Milestone: mozilla0.9.2 → ---
Reporter | ||
Comment 5•24 years ago
|
||
All planned string API fixes need to be in by mozilla1.0.
Target Milestone: --- → mozilla1.0
Reporter | ||
Comment 6•24 years ago
|
||
Reporter | ||
Comment 7•24 years ago
|
||
The patch above is the real deal. It addresses the concerns in this bug as well
as bug #70082. This fixes the /Get(Read|Writ)ableFragment/ machinery. The
machinery is now slightly more complicated for sub-class authors, but eliminates
all limitations (other than size-of-memory) on the complexity of concatenations,
substrings, iteration over multi-fragment strings, and combinations thereof.
I've been working on this patch for some time now, bouncing ideas and
implementations off of jag and others. It's ready for more formal review now,
though I'm still testing it.
Reporter | ||
Comment 8•24 years ago
|
||
Still waiting on reviews from jag, saari, and waterson (who has tentatively
rubber-stamped this change, I guess)
Assignee | ||
Comment 9•24 years ago
|
||
Yeah, sorry about that. It looks good, but since you mentioned that this didn't
work yet as expected (you were hanging somewhere?), I was hoping to find an
updated patch soonish after you attached this one. I guess I'll go finish my
review.
Assignee | ||
Comment 10•24 years ago
|
||
Index: public/nsSharableString.h
===================================================================
RCS file: /cvsroot/mozilla/string/public/nsSharableString.h,v
retrieving revision 1.5
diff -u -2 -r1.5 nsSharableString.h
--- public/nsSharableString.h 2001/06/29 12:46:51 1.5
+++ public/nsSharableString.h 2001/07/29 09:36:00
@@ -47,15 +47,13 @@
public:
typedef nsSharableString self_type;
- typedef PRUnichar char_type;
- typedef nsAString string_type;
@@ -78,14 +77,14 @@
typedef nsSharableCString self_type;
typedef char char_type;
- typedef nsACString string_type;
I guess you could remove the typedef for char_type here too then.
-----
+void
+nsASingleFragmentString::GetNextFragmentByIndex( const_fragment_type&
aResultFragment, int /*aIndex*/ ) const
+ {
+ aResultFragment.mEnd = aResultFragment.mStart;
+ aResultFragment.mStart = 0;
+ }
Call FaultNextFragment(aResultFragment);
This is actually causing problems with normalize_forward (crashing because
|first| is expected to point to the same thing as |last| but ends up pointing at
|0| when it faults).
-----
+nsDependentConcatenation::IsDependentOn( const abstract_string_type& aString )
const
{
return mStrings[0]->IsDependentOn(aString) ||
mStrings[1]->IsDependentOn(aString);
}
|kFirstString| and |kLastString| instead of |0| and |1| resp.
-----
More in a bit.
Reporter | ||
Comment 11•24 years ago
|
||
...and in fact that problem with |normalize_forward| was exactly the problem
that was stopping me. I told you that you might discover it, and that it would
probably be obvious. :-) Making the corrections and testing them; a new patch
anon.
Assignee | ||
Comment 12•24 years ago
|
||
So just trying to run mozilla, I run into an old problem :-)
nsXPIDLString foo; foo.get();
That get() doesn't RecalculateBoundaries any longer. It used to end up calling
|GetSharedBufferHandle|, now it goes through |BeginReading|.
Assignee | ||
Comment 13•24 years ago
|
||
Well, I found the normalize_forward() problem's cause by reading, but I didn't
realize it was the cause, nor the extent of the problem, till I tried to run
Mozilla and ended up in the debugger :-)
Assignee | ||
Comment 14•24 years ago
|
||
So overriding GetFragmentByIndex on nsXPIDLString and doing something similar to
GetSharedBufferHandler gets me further, now to an assertion that we're asking
for an index other than 0 on a single fragment string. Looking at that now (but
maybe I caused it with the previously mentioned "fix"?)
Assignee | ||
Comment 15•24 years ago
|
||
Hrm. For some reasong it thinks an nsAutoString has two fragments.
Could this be because moving an iterator to the end of the first fragment ends
up causing FaultNextFragment to be called, thus giving the impression of a
second fragment?
Assignee | ||
Comment 16•24 years ago
|
||
Yep, that's exactly it. Urgh. scc, HEEEEELP!
Assignee | ||
Comment 17•24 years ago
|
||
Yay! A normalize_backward in nsDependentSubstring fixed that. Next I'm just
hanging somewhere after mozilla couldn't find some file. Pulling and building
clobber, maybe that'll clear this up.
Reporter | ||
Comment 18•24 years ago
|
||
Reporter | ||
Comment 19•24 years ago
|
||
with the current patch, everything runs great right up to the point something
funny happens in the parser that looks like |theParser| in |nsParser::Tokenize|
is bad, though I haven't yet found the connection to strings. The bad tokenizer
then passes what looks like uninitialized iterators into the string machinery,
and everything starts to break. I haven't yet found the connection that makes
this easy to debug, so I've been stepping through the places where tokenizers
are created and requested, near this code.
Reporter | ||
Comment 20•24 years ago
|
||
Reporter | ||
Comment 21•24 years ago
|
||
Comment 22•24 years ago
|
||
r=pchen for jag's plan for this work
Assignee | ||
Comment 23•24 years ago
|
||
Assignee | ||
Comment 24•24 years ago
|
||
Reporter | ||
Comment 25•24 years ago
|
||
Comment on attachment 54473 [details] [diff] [review]
Attempt at extracting nsASingleFragmentString change from above patch
looks good, sr=scc
Attachment #54473 -
Flags: superreview+
Assignee | ||
Comment 26•24 years ago
|
||
Attachment #44006 -
Attachment is obsolete: true
Attachment #45816 -
Attachment is obsolete: true
Attachment #46447 -
Attachment is obsolete: true
Attachment #53447 -
Attachment is obsolete: true
Comment 27•24 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Comment 28•23 years ago
|
||
per comment 5 marking 1.0. beyond that what's the status of this bug? dbaron
mentioned it in bug 121841 which is a live instance of runaway recursion ala
bug 74709 although it's unclear whether it's related.
Keywords: mozilla1.0
Target Milestone: mozilla1.0.1 → mozilla1.0
Blocks: 125389
Comment 29•23 years ago
|
||
adding adt1.0.0+ for api changes only. please get drivers approval and then
check into the 1.0 branch.
Keywords: adt1.0.0+
Comment on attachment 59091 [details] [diff] [review]
Initial patch updated to trunk
So this patch removes GetReadableFragment and GetWritableFragment from
nsAString, but it doesn't remove nsSharableString::GetWritableFragment.
Does it add code somewhere else to fix bug 114438? If not, this suggests that
we might need to fix bug 114140, rather than just leave things as-is (which I
was thinking would be acceptable, although not ideal).
Assignee | ||
Comment 31•23 years ago
|
||
Sorry, let me clarify this. I'm going to attach a patch RSN (tm) which only adds
the new APIs with empty implementations, and doesn't remove the old ones just
yet (per drivers request).
Reporter | ||
Comment 32•23 years ago
|
||
OK, here's our answer on how to get binary compatible stubs in to do this stuff
by Thursday (thanks to shaver for the saving the day with the #ifdef advice).
Stub in the needed API calls, all empty
#ifndef MOZILLA_STRICT_STRING_API
structures and methods that will break binary compatibily
for a plugin built now, against our library with the working fixes
i.e., 1.0+string_fixes
People who are willing to recompile for 1.0+ need not define. People who want
their binary to work with 1.0 and 1.0+ define it and live with restricted string
functionality _within_ their code. That is, they can't use |+| to concatenate
strings, for instance, and a few other things. Exact list will be added as a
comment to the bug.
This is the safest and quickest path. This is the path we are following.
Patches to follow.
Reporter | ||
Comment 33•23 years ago
|
||
noting that I'm driving this, and that really, this is jag's bug and has been
for a while
Assignee: scc → jaggernaut
Status: ASSIGNED → NEW
Whiteboard: [driver:scc]
Reporter | ||
Comment 34•23 years ago
|
||
This is the decision: to maintain binary compatibility, and to get to 1.0, we
have decided not to fix this bug.
Information on how to code around to be presented, in a later comment.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Assignee | ||
Comment 35•23 years ago
|
||
So it's all pretty simple, really:
You can still use concatenation of strings within your code, as long as you
don't do anything that casts away the concatenated string's type. The most
common form of this is passing a concatenation into a function as a |const
nsA{C}String&| parameter. If you do need to hand a concatenation to a function,
store it in an intermediate string for now, e.g. |nsString d(a+b+c);| and pass
in |d|.
Comment 38•23 years ago
|
||
If this bug is WONTFIX, then what is the status of bug 74709 which was marked as
a duplicate of this one?
I can understand why the WONTFIX decision was made for Mozilla 1.0, but does
that reasoning carry through for ALL future Mozilla releases. It seems like
there are still issues here that need to be addressed at some point.
If this is WONTFIX, how does that affect bug 76334 and bug 125389 which depend
on this bug?
Updated•5 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•