Auto merge of #27325 - paulrouget:sessionavailable, r=jdm

Fire sessionavailable

Depends on #27304
Fix #27272
This commit is contained in:
bors-servo 2020-07-23 09:52:27 -04:00 committed by GitHub
commit b0b4f8ac6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -136,7 +136,7 @@ const char *prompt_input(const char *message, const char *default,
Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width,
GLsizei height, EGLNativeWindowType eglNativeWindow, float dpi,
ServoDelegate &aDelegate)
ServoDelegate &aDelegate, bool transient)
: mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) {
ApplicationDataContainer localSettings =
ApplicationData::Current().LocalSettings();
@ -192,6 +192,14 @@ Servo::Servo(std::optional<hstring> initUrl, hstring args, GLsizei width,
#endif
}
if (transient) {
capi::CPref cpref;
cpref.key = "dom.webxr.sessionavailable";
cpref.pref_type = capi::CPrefType::Bool;
cpref.value = &transient;
cprefs.push_back(cpref);
}
capi::CPrefList prefsList = {cprefs.size(), cprefs.data()};
capi::CInitOptions o;

View file

@ -28,7 +28,7 @@ class ServoDelegate;
class Servo {
public:
Servo(std::optional<hstring>, hstring, GLsizei, GLsizei, EGLNativeWindowType,
float, ServoDelegate &);
float, ServoDelegate &, bool);
~Servo();
ServoDelegate &Delegate() { return mDelegate; }

View file

@ -407,7 +407,7 @@ void ServoControl::Loop() {
ServoDelegate *sd = static_cast<ServoDelegate *>(this);
EGLNativeWindowType win = GetNativeWindow();
mServo = std::make_unique<Servo>(mInitUrl, mArgs, mPanelWidth, mPanelHeight,
win, mDPI, *sd);
win, mDPI, *sd, mTransient);
} else {
// FIXME: this will fail since create_task didn't pick the thread
// where Servo was running initially.