| Summary: | REGRESSION: Function declaration inside a function and using the same name as an argument to the containing function no longer takes precedence over the argument | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Rob Brackett <rob> | ||||
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | fpizlo, ggaren, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | 528+ (Nightly build) | ||||||
| Hardware: | Unspecified | ||||||
| OS: | OS X 10.10 | ||||||
| Attachments: |
|
||||||
|
Description
Rob Brackett
2015-02-02 19:05:33 PST
Well, in the process of writing a test for this, it seems like this only fails when the inspector is open, so this might not actually be JSC, but instead something about the web inspector. Still not sure why Instapaper doesn’t work in WebKit Nightly; assuming it’s unrelated to this (and hard to determine since the inspector can’t be open!) :( OK! This took a fair amount of poking before I finally narrowed it down. The cause of the problem I was seeing on Instapaper was actually code in the form:
```
(function(Thing) {
Thing.whatever = "This breaks.";
function Thing() {
// referencing `Thing` in this inner scope here is what does it
Thing;
}
})()
```
It seems like referencing `Thing` inside the `Thing` function inside a function with `Thing` as an argument (wow) causes `Thing` in the outer function to reference the argument instead of the function declaration.
As far as what I was seeing with the inspector open, I have no idea whether it was related or completely different. Whether or not the cause is the same, the symptoms are.
Created attachment 245929 [details]
Simple test case for function declaration names vs. argument names
FWIW, I have encountered this issue on several more sites in regular browsing. It may be an odd construction, but it’s definitely a real-world problem. |