Closed Bug 1015887 Opened 11 years ago Closed 11 years ago

Expose realFrameElement to Chrome JS

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.0 S3 (6june)

People

(Reporter: vingtetun, Unassigned)

References

Details

Attachments

(1 file)

In 2.0 Loop will be a privileged application that should be able to use the attention screen. the attention screen is a window that lives on top of all other windows, and also on top of the lockscreen. In the current state the permission request from the child usually goes directly from the child process -> main process -> b2g/components/ContentPermissionPrompt.js -> Gaia system app. In the system app all informations relative to the opener has been lost, and so the prompt can not be easily mapped to the opener. We tried to infer that based on the current visible element on the script but this is not very reliable. The right fix for that could be to fix bug 852013 but it also implies a lot of other changes on the platform side and on the permission prompt logic in the system app, which sounds risky in the 2.0 timeframe. This one will let b2g/components/ContentPermissionPrompt.js tell the system app directly from which iframe the prompt request comes from with a minimal amount of changes. I also assume that realFrameElement would be useful in the future for other use cases from JS code. Also once bug 789261 lands I wonder if we can just remove the hacks for GetControllers and this one for GetRealFrameElement, which would make the patch much less hacky... (needinfo'ing peterv).
Peter, once bug 789261 can we just remove the XrayWrapper.cpp hacks for GetControllers and GetRealFrameElement ? Those are basically [noscript] instructions in nsIDOMWindow.idl, and [ChromeOnly] instructions into Window.webidl.
Flags: needinfo?(peterv)
(In reply to Vivien Nicolas (:vingtetun) (:21) (NOT reading bugmails, needinfo? please) from comment #2) > Peter, once bug 789261 can we just remove the XrayWrapper.cpp hacks for > GetControllers and GetRealFrameElement ? No, we can remove them once we remove the pref for switching Window to WebIDL. While we have the pref the code for Window on XPConnect must stick around.
Flags: needinfo?(peterv)
Comment on attachment 8428611 [details] [diff] [review] expose.realFrameElement.to.js.patch Review of attachment 8428611 [details] [diff] [review]: ----------------------------------------------------------------- r=bholley with the fixes below. ::: dom/webidl/Window.webidl @@ +363,5 @@ > [ChromeOnly, Throws] readonly attribute object? __content; > > [Throws, ChromeOnly] any getInterface(IID iid); > + > + [ChromeOnly, Throws] readonly attribute Element? realFrameElement; Can you make the ordering here match that in nsGlobalWindow.h? ::: js/xpconnect/wrappers/XrayWrapper.cpp @@ +1050,5 @@ > + f, nullptr, nullptr, true, > + desc.value()); > + } > + > + if (NS_FAILED(rv.ErrorCode()) || !f) { a null |f| isn't necessarily an error condition, right? Also, Elements are on WebIDL, so this dance can be simplified. How about: ErrorResult rv; Element* f = win->GetRealFrameElement(rv); if (!f) { desc.object().set(nullptr); return true; } if (!WrapNewBindingObject(cx, f, desc.value()) return false; desc.object().set(wrapper); return true;
Attachment #8428611 - Flags: review?(bobbyholley) → review+
This push hit desktop B2G mochitest failures. Not knowing the interdependencies of the push, I backed the entire thing out. https://hg.mozilla.org/integration/mozilla-inbound/rev/616163ca1aa5 https://tbpl.mozilla.org/php/getParsedLog.php?id=41052634&tree=Mozilla-Inbound
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0 S3 (6june)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: