Closed Bug 1118309 Opened 9 years ago Closed 7 years ago

Find better solution to identify other applications beside Firefox

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: ato, Unassigned)

Details

(Keywords: pi-marionette-server)

Bug 1107706 will introduce an “enum” for referring to the different contexts "chrome" and "content".

The server code has many references to this.appName which comes from Services.appinfo.name.  This leads to a lot of code using ternaries such as if (this.appName == "B2G") ? foo : bar.

This leads to a lot of ugly and unreadable code.  It also creates problems when there are more than “B2G” and “non-B2G” options, e.g. when you need to write code that is desktop specific (or Fennec specific).

It would be in our interest to find a better solution to this.  Whether that solution is following the context enum approach, setting some prototype-scope shorthands isB2G/isDesktop/isFennec, or both should be discussed.
The problem with an enum-like object is JavaScript is that "Context.CONENT" evaluates to undefined, which is falsy, without any static or dynamic error. Plain old constants might be better for this, because if we have a "const MOZ_IS_B2G = true;" and try to write "if (MOZ_IS_G2B) { ... }" we get a reference error.
[Mass closure] Closing as these features are no longer needed or wanted
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
I wouldn't call it incomplete. We still have a lot of spaghetti-code when it comes to differences between Firefox and Fennec. A better separation of those code snippets would be great!
Status: RESOLVED → REOPENED
Resolution: INCOMPLETE → ---
Summary: Find better solution to identify B2G and other products → Find better solution to identify other applications beside Firefox
Since we no longer manipulate this.appName, it is no longer necessary to pass it into GeckoDriver’s ctor.  We can get away with retrieving the current application name from Services.appinfo.name directly.
Let's raise more specific bugs then.

Closing.
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → INVALID
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.