Closed Bug 1065516 Opened 10 years ago Closed 10 years ago

[System] Remove window.self in appWindow to reflect the dependency

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

x86
macOS
defect
Not set
normal

Tracking

(b2g-v2.0 wontfix, b2g-v2.1 fixed, b2g-v2.2 fixed)

RESOLVED FIXED
2.1 S4 (12sep)
Tracking Status
b2g-v2.0 --- wontfix
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: kgrandon, Assigned: kgrandon)

References

Details

(Whiteboard: [systemsfe])

Attachments

(1 file)

It seems like we have a lot of invalid references to some magic variable `self` from within app_window.js. Not sure how these got here, but the usage is not clear so we should fix it.
Attached file Github pull request
Just looking for a review here, thanks! This seems to impact testing as well, so we should try to get this into 2.1.
Attachment #8487347 - Flags: review?(alive)
Attachment #8487347 - Flags: review?(21)
Comment on attachment 8487347 [details] [review]
Github pull request

I really prefer Alive to review this patch as he creates the |self| variable here.
Attachment #8487347 - Flags: review?(21)
Comment on attachment 8487347 [details] [review]
Github pull request

window.self points to window object so it's not invalid.

Read https://developer.mozilla.org/en-US/docs/Web/API/Window.self

I am going to r+ it because we need to reflect the dependency of appWindow by putting global object in /* global */.
Attachment #8487347 - Flags: review?(alive) → review+
Summary: [System] Invalid references to `self` objects → [System] Remove window.self in appWindow to reflect the dependency
(In reply to Alive Kuo [:alive][NEEDINFO!] from comment #3)
> Comment on attachment 8487347 [details] [review]
> Github pull request
> 
> window.self points to window object so it's not invalid.
> 
> Read https://developer.mozilla.org/en-US/docs/Web/API/Window.self
> 
> I am going to r+ it because we need to reflect the dependency of appWindow
> by putting global object in /* global */.

Thanks Alive, that makes sense now. I think that reflecting the global usage in /* global */ will help us in the future.

We also may have another bug then, there was a bug reported over IRC that self.AppChrome was undefined. I assumed that this was because of a leaked `self` variable, but I could be wrong. In any case, we can land this and I'll also try to track down if there's a case where AppChrome can be null while we're instantiating an app window.
In master: https://github.com/mozilla-b2g/gaia/commit/68e2fb96c725d434eb21040b718dc2a11321dbe9
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [systemsfe]
Comment on attachment 8487347 [details] [review]
Github pull request

I would like to uplift this to 2.1 because although minor, it should help us debug a reported error when creating an app window.

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): Cleanup of existing code.
[User impact] if declined: None, but this may help us find and fix a user-facing error.
[Testing completed]: Manual testing.
[Risk to taking this patch] (and alternatives if risky): Low risk, only semantic changes.
[String changes made]: None.
Attachment #8487347 - Flags: approval-gaia-v2.1?(fabrice)
Blocks: 1065919
Attachment #8487347 - Flags: approval-gaia-v2.1?(fabrice) → approval-gaia-v2.1+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: