CreateInstance implementation does not check for aggregation

RESOLVED INCOMPLETE

Status

()

Core
XPCOM
P3
normal
RESOLVED INCOMPLETE
18 years ago
8 years ago

People

(Reporter: Heikki Toivonen (remove -bugzilla when emailing directly), Unassigned)

Tracking

Trunk
Future
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Many implementations of CreateInstance do not check the value of the [in]
parameter (typically 'aOuter') that tells if aggregation is to be used. Most
implementations are not aggregations so they should check it and report
NS_ERROR_NO_AGGREGATION if appropriate.

Updated

18 years ago
Status: NEW → ASSIGNED
Target Milestone: M16

Comment 1

18 years ago
Yeah I have seen some of this too.
I must be really bored... I decided to flex my Perl muscle(s?) a bit to find
where this bug occurs. But not so bored that I would have made the script
perfect. I guess jst & julle @citec.fi are as bored as I am and we spent a
considerable amount of time figuring out how to run this script, heh.

Finally when all else was set and I started it on NT with the bash shell it went
fine for some time and then got access violation. So I asked jst to run the same
thing on Linux so eventually we got some output ;)

Anyway, the script is below and I will attach the script output.

--ht.pl--
#!perl
#
# Utitility to find CreateInstance implementations that do not
# return NS_ERROR_NO_AGGREGATION. See Bugzilla bug #16763.
#
# Invocation (from MOZ_TOP directory) (bash):
#   for i in `find . -name '*.h' -or -name '*.cpp'`; do ht.pl $i; done
#

$file = $ARGV[0];
$in = 0;
$line = 0;
$brace = 0;
$in_method = 0;
$create_line = "";

# If true, output is in HTML (need html, head, body tags)
$html = 1;
# LXR base
$lxr = "http://lxr.mozilla.org/seamonkey/source/";

if ($html) {
  print "<ul>\n";
}

while (<>) {
  $line++;

  if (/Factory::CreateInstance/) {
    if ($html) {
      $create_line = "<li><a href=\"$lxr$file#$line\">$file:$line:</a> $_</li>";
    } else {
      $create_line = "$file:$line: $_";
    }
    $in = 1;
  }

  if ($in) {
    if (/\{/) {
      if ($brace++ == 0) {
        $in_method = 1;
      }
    }
    if (/\}/) {
      $brace--;
    }

    if ($brace < 0) {
      if ($html) {
        print "</ul><p><b>Misplaced braces?</b></p>\n";
      } else {
        print "Misplaced braces?\n";
      }
      exit;
    }

    if ($in_method and $brace == 0) {
      $in = 0;
      $in_method = 0;
      print "$create_line";
    }

    if ($in_method and /NS_ERROR_NO_AGGREGATION/) {
      $brace = 0;
      $in = 0;
      $in_method = 0;
    }
  }
}

if ($html) {
  print "</ul>\n";
}
Created attachment 2662 [details]
Possible occurrences of this bug

Updated

18 years ago
Assignee: dp → scc
Status: ASSIGNED → NEW

Updated

18 years ago
Status: NEW → ASSIGNED

Comment 4

17 years ago
Note: this is another good thing to check for with the [XP]COM lint script.

Updated

17 years ago
Target Milestone: M16 → M20

Comment 5

17 years ago
mass re-assigning to my new bugzilla account
Assignee: scc → scc
Status: ASSIGNED → NEW

Updated

17 years ago
Status: NEW → ASSIGNED

Comment 6

17 years ago
dp is no longer @netscape.com. changing qa contact to default for this product
QA Contact: dp → kandrot

Comment 7

15 years ago
re-assigning to XPCOM owner
Assignee: scc → dougt
Status: ASSIGNED → NEW
QA Contact: kandrot → scc

Updated

15 years ago
Target Milestone: --- → Future
Assignee: dougt → nobody
QA Contact: scc → xpcom
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.