test suite: making countHeap available when running from browser

NEW
Unassigned

Status

()

Core
JavaScript Engine
--
enhancement
11 years ago
4 years ago

People

(Reporter: Igor Bukanov, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
countHeap is a new function available with js shell to count the number of live objects available in JS heap, see bug 394853 comment 23 for details. It would be nice to have the same functionality available in jsd so the test suite for the browser can use it for a leak detection.

Comment 1

11 years ago
I don't understand this request at all. What does jsd have to do with the test suite for the browser? Venkman doesn't even ship with Firefox (and JSD-the-backend doesn't really seem like a particularly good place to put this - in fact, I wouldn't be sure how to do that implementation-wise - would it be a method on jsdDebuggerService or something?)
(Reporter)

Comment 2

11 years ago
(In reply to comment #1)
> I don't understand this request at all. What does jsd have to do with the test
> suite for the browser? Venkman doesn't even ship with Firefox (and
> JSD-the-backend doesn't really seem like a particularly good place to put this
> - in fact, I wouldn't be sure how to do that implementation-wise - would it be
> a method on jsdDebuggerService or something?)

The reason for using jsd to expose this functionality is that jsdIDebuggerService already has "GC" as method that exposes JS_GC() functionality. For some time JavaScript's test suite used that method to trigger GC using code like:

function jsdgc()
{
  try
  {
    // Thanks to dveditz
    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
    var jsdIDebuggerService = Components.interfaces.jsdIDebuggerService;
    var service = Components.classes['@mozilla.org/js/jsd/debugger-service;1'].
      getService(jsdIDebuggerService);
    service.GC();
  }
  catch(ex)
  {
    print('gc: ' + ex);
  }
}

I thought that since the test suite accessed the method, it would make sense to  piggy-back on jsd and add countHeap to jsdIDebuggerService.

Now, that was not a good idea since I missed the fact that the test suite no longer calls that jsdgc function. I guess this was due to the fact that there was JS code that reliably can trigger GC in SpiderMonkey and having debugger installed could influence the test results.

I CC Bob Clary to clarify this.

I will change Product/Component when I find out what would be the best place to add the function.


exposes the method named GC to trigger that JS code calls like:



thats GC function that 
This is similar to GC provided by 
(Reporter)

Comment 3

11 years ago
(In reply to comment #2)
> 
> exposes the method named GC to trigger that JS code calls like:
> 
> 
> 
> thats GC function that 
> This is similar to GC provided by 
> 

Ignore these lines. They are leftover from a draft.

Comment 4

11 years ago
(In reply to comment #2)

> 
> Now, that was not a good idea since I missed the fact that the test suite no
> longer calls that jsdgc function. I guess this was due to the fact that there
> was JS code that reliably can trigger GC in SpiderMonkey and having debugger
> installed could influence the test results.
> 
> I CC Bob Clary to clarify this.
> 

The browser based version of gc() at one time used the jsd code however I stopped using the jsd version of the gc since it was causing crashes which were not meaningful to the browser. I left the code in a renamed function for posterity and memory reasons.
(Reporter)

Comment 5

11 years ago
I move the bug to Core/JavaScript: ideally it should be something related to the test suite, but for now JS should be good enough.
Assignee: igor → general
Component: JavaScript Debugger → JavaScript Engine
Product: Other Applications → Core
QA Contact: venkman → general
(Reporter)

Updated

11 years ago
Assignee: general → igor
Summary: countHeap for the debugger → test suite: making countHeap available when running from browser
(Reporter)

Comment 6

10 years ago
I am not working on the bug right now.
Assignee: igor → general
(Assignee)

Updated

4 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.