Open Bug 905450 Opened 11 years ago Updated 2 years ago

Blackbox individual functions

Categories

(DevTools :: Debugger, enhancement, P3)

25 Branch
x86
macOS
enhancement

Tracking

(Not tracked)

People

(Reporter: fitzgen, Unassigned)

References

(Blocks 1 open bug)

Details

Sometimes you don't want to blackbox a whole source, but just a specific function. We could do something like

  function someFunc() {
    // ... do stuff somehow, we don't care it's a black box ...
  }
  someFunc.blackbox = true;

and someFunc would be considered black boxed.

Question: is it only the assigned function, or does this propagate like strict mode does? Would be fairly easy to implement either way (just walk the env chain for the latter option).
I would think function only since it's easy enough to propagate down manually (with extra annotations) but not so easy to go the other way.
I would think function only since it's easy enough to propagate down manually (with extra annotations) but not so easy to go the other way.
While it's true that inheriting by scope would be more difficult to override (impossible without serious source rewriting really), I also think it's the common use case. Perhaps a compromise can be made, by having the value be an enumeration rather than a boolean? Something like:

> func.blackbox = "self"
> func.blackbox = "children"
> func.blackbox = "cascading"

Or whatever bikeshedding the names comes up with.

Also I'd recommend making it into a more obscure property, with the goal of eventually transitioning to using a Symbol when they become available in SpiderMonkey. "@blackbox" for now or something otherwise unlikely to accidentally ever be used.
(In reply to Brandon Benvie [:bbenvie] from comment #3)
> While it's true that inheriting by scope would be more difficult to override
> (impossible without serious source rewriting really), I also think it's the
> common use case. Perhaps a compromise can be made, by having the value be an
> enumeration rather than a boolean? Something like:
> 
> > func.blackbox = "self"
> > func.blackbox = "children"
> > func.blackbox = "cascading"

Great idea :)

"self" would be only fun

"cascading" would be like strict mode

"children" would be not func, but all of func's children?

Is that correct? "children" seems off to me... I'm not a fan, but could be convinced otherwise.

> Also I'd recommend making it into a more obscure property, with the goal of
> eventually transitioning to using a Symbol when they become available in
> SpiderMonkey. "@blackbox" for now or something otherwise unlikely to
> accidentally ever be used.

Another great idea. +1
(In reply to Nick Fitzgerald [:fitzgen] from comment #4)
> "self" would be only fun
> "cascading" would be like strict mode
> "children" would be not func, but all of func's children?
> 
> Is that correct? "children" seems off to me... I'm not a fan, but could be
> convinced otherwise.

That is correct. I'm not too sure on it either, I'd probably lean toward just "self" and "cascading". I dislike the name "cascading" though, but couldn't think of a better word for "self+children".
And actually it's not "self+children" but "self+all functions inside". Maybe just "self" and "cascade".
Priority: -- → P3
Component: Developer Tools: Debugger → Developer Tools: User Stories
Summary: add ability to black box specific functions rather than whole sources → Blackbox individual functions
Component: Developer Tools: User Stories → Developer Tools: Debugger
Product: Firefox → DevTools
Type: defect → enhancement

just add it, 7 years gone, this is simple -_-

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.