Closed Bug 667817 Opened 8 years ago Closed 7 years ago

window.location object in page-mod contentscripts seems broken.


(Add-on SDK Graveyard :: General, defect, P2)



(Not tracked)



(Reporter: KWierso, Assigned: ochameau)




In the linked add-on in Builder, the contentscript runs on any page.
It logs the current page's window.location to the console.
It then shows the typeof for window.location.
It then iterates through all properties of the window.location object, logging each to the console.
After the loop finishes, it manually logs each of the properties to the console.

That should all work fine.

But it doesn't:

window.location logs the correct location.

typeof window.location is "object".

Nothing within the loop is logged. 

But all of the individual properties work when called manually.

This all works with Firebug and/or Firefox Nightly's new Scratchpad feature, for the record.
Location objects are handled differently in some wrapper code, e.g., [1].  I don't know what's going on here, but given the other sandbox- and wrapper-related bugs Jetpack has uncovered, this might be another one.

OS: Windows 7 → All
Priority: -- → P3
Hardware: x86 → All
Target Milestone: --- → Future
Upping priority just to get this figured out, at least.

Alex, any idea?
Priority: P3 → P2
Target Milestone: Future → 1.2
Assignee: nobody → poirot.alex
Target Milestone: 1.2 → 1.1
The proxy code is buggy when you use loop.
The following code is wrong:
I should not use Object.keys as it list only *own* enumerable properties although `enumerate` trap expect to retrieve names of all enumerable properties: own and prototype inherited ones.
Unfortunately, if I use a correct code:
  let result = [];
  for (let name in obj) {
  return result;
I end up facing another bug around collection, where this loop goes wrong (enumerate more items than expected)
(First bug around Collection fixed here: )

I definitively need to digg these Collections issues. I was not able to reduce these buggy behaviors to simple snippets. FYI, because of this, it is the only one wrapper issue that doesn't have a platform bug opened.
Another issue has been reported around `location`.
If you change location using:
Nothing happens, instead, `location` attribute is just replaced by a string.
(Pushing all open bugs to the --- milestone for the new triage system)
Target Milestone: 1.1 → ---
Blocks: 692539
I think that these issues around location have been fixed with the removal of proxies for content scripts.
Please reopen if needed.
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.