Giter Site home page Giter Site logo

mozilla / r2d2b2g Goto Github PK

View Code? Open in Web Editor NEW
392.0 71.0 139.0 5.03 MB

Firefox OS Simulator is a test environment for Firefox OS. Use it to test your apps in a Firefox OS-like environment that looks and feels like a mobile phone.

Home Page: https://addons.mozilla.org/en-US/firefox/addon/firefox-os-simulator/

License: Other

JavaScript 84.77% Python 7.61% CSS 7.62%

r2d2b2g's Introduction

Note: This project is no longer maintained in this repo. It has been merged into the main Gecko (Firefox) repo.

r2d2b2g is an experimental prototype test environment for Firefox OS in the form of a Firefox Desktop addon.

To hack on it, clone this repository, then:

git submodule init
git submodule update
make build
make run

Caution! You need plentiful disk and patience, as the submodules and build process require copious space and time.

r2d2b2g's People

Contributors

anantn avatar bkase avatar breck7 avatar brendandahl avatar ccarruitero avatar davidgomes avatar digitarald avatar frasertweedale avatar jryans avatar louisstow avatar mykmelez avatar ochameau avatar potch avatar rpl avatar sudheesh001 avatar tofumatt avatar victorb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r2d2b2g's Issues

Install Page as App crashes immediately

When I click on Install Page as App, it opens B2G for a second then immediately closes it.
The only information I have in Firefox error console is :
info: r2d2b2g: linux/b2g/b2g-bin terminated with 0

build.py installs first build in filelist rather than build it downloads

build.py installs the first build in the list of files in the directory rather than the build it downloads. That means it will install an older build that appears earlier in the filelist. For example, if I have the October 3 build, and I run build.py on October 4 to download that day's build, I get a filelist like:

-rw-r--r--@ 1 myk myk 56580573 Oct 3 14:08 2012-10-03-03-05-46-mozilla-central-b2g-18.0a1.en-US.mac64.dmg
-rw-r--r--@ 1 myk myk 56580177 Oct 4 09:30 2012-10-04-03-05-26-mozilla-central-b2g-18.0a1.en-US.mac64.dmg

And build.py installs the October 3 build instead of the October 4 build.

build.py should install the build it downloads.

Remove Install Page as App menu item

...to put the focus on commonly used features, point people to use the Manager more, and ensure that people will be more likely to point to manifests or at least the page they really want.

addon consumes significant processing time on startup

Jean Claveau noted in this blog comment that r2d2b2g takes 121ms on startup in this profile generated using Firefox's new SPS profiler.

That seems like a lot, and we should bring it down to a reasonable number (probably down to the low tens of ms, unless there is work that must be done on startup and has to take the time). Some of that time might be spent in SDK code that we don't control, but we should fix any issues in the r2d2b2g code and work around any issues in the SDK code that are possible to work around.

Home button needs to be discoverable

Currently, the user must push the home key on the keyboard (fn-left arrow on my Mac) to simulate the home button on the device. Since this is an extremely important thing for users to know, I think we should do something along these lines:

  • put a Home button on a toolbar (with a Rotate button as well, if we can get that in v1). A tooltip that reflects the keyboard shortcut would be useful, or
  • add a menu item to the B2G menu that says "Home"

I think the first is preferable, but the second is fine too if that's all we have time for.

document Home keybinding for returning to homescreen

It isn't obvious how to return to the homescreen from an app in B2G Desktop. As users of the addon won't necessarily know much about B2G, the addon should conspicuously document how to return to the homescreen.

create app in separate source directory outside Gaia profile

r2d2b2g's nascent "Create App" function creates an app in a webapps/{UUID}/ subdirectory of its Gaia profile directory, which it uses to store both source files and install files. This is problematic for several reasons:

  1. the files will be deleted when the user updates the addon, since the addon currently completely deletes and replaces its Gaia profile on update;
  2. the files are located in an obscure location, so users will have difficult finding them outside of an Open File Location function within the addon;
  3. there's the potential for source and install files to conflict;
  4. developers can't choose the location of the source files.

Instead of creating the app in a subdirectory of the profile, the Create App function should create it in a subdirectory of a common location (like the user's default Documents directory) or let the user pick a location. One might combine these two with code that uses the file picker to prompt the user for a name while suggesting both a name ("My App") and a location (using Services.dirsvc from Services.jsm to get the location via the platform-specific definitions in nsDirectoryServiceDefs.h).

Once the source files are in a reasonable, potentially user-specified directory, the rest of the code, refactored, can behave much the same way: installation consists of packaging the files into a ZIP archive, installing the package into a webapps/{UUID}/ subdirectory of the Gaia profile directory, and adding an app record to webapps/webapps.json.

expose "created apps" list/tools in Helper

The Helper page lets users create an app, but it doesn't expose any information about apps the user has created. That makes it hard for users to do much after creating an app. Helper should list apps the user has created and give them a short set of tools for performing common tasks. The particular tools to provide are listed in issue #16--expose "created apps" API to helper--and are:

  1. Start App (re/install app, re/start B2G Desktop, and go directly to the app via the -webapp command-line option);
  2. Open File Location (open a File Manager window--Explorer on Windows, Finder on Mac, Files on GNOME--to the directory containing the app's files, probably by using nsIFile::reveal());
  3. Package App (archive the app in a ZIP archive suitable for uploading to Marketplace).

This issue obviously depends on issue #16, as it isn't possible for Helper to expose this information to users until the addon provides it to Helper! However, it might be possible to do some of the work in advance while awaiting the details of the API.

simulator crashes on startup on Windows

On Windows, the simulator crashes on startup due to bug 795484. To fix this bug, we probably need to fix that one, although it's possible that there's a workaround that'll enable us to avoid the crash. Some comments in that bug suggest we might be able to do it by disabling OOP apps, although it isn't clear exactly how to do that.

document 64-bit Linux workaround(s)

Bug 776845 tracks building 64-bit Linux nightlies of B2G Desktop, which we could package into the Linux version of r2d2b2g (choosing which build to use at runtime).

Until then, a workaround would be to install 32-bit compatibility libraries, which is easy on Debian/Ubuntu, although it's hard on Fedora. However, it isn't clear that this is sufficient, as the 32-bit executable seems to have trouble locating its own libraries on 64-bit systems (unless you set LD_LIBRARY_PATH=.).

Perhaps that's a bug we can file and get fixed (or work around in our code). But at the very least, if the workaround of running a 32-bit binary on 64-bit Linux is viable (or there is some other workaround), then we should document what it takes to make it happen!

Pressing home takes to a blank home screen in linux.

If I open some app, pressing ESC does not close the app.
I had also experienced this in B2G build for desktop that I had downloaded sometime back from Mozilla's FTP.

If I open some app and press home screen, I goto blank home screen where I do not
see any icons. The screen shot has been attached below.

OS: Kubuntu-32bit (Linux)
Screenshot: http://i.imgur.com/8r1JX.png

Add auto-generated app from URL/Tab

  1. User click "Add App from URL/Tab"
  2. User selects tab or enter URL
  3. Manifest gets generated from page title and URL
  4. App gets installed, no "Update" button required
  5. Actions: Edit manifest (?)

Add packaged app from existing folder

  1. Click "Add from Folder" button
  2. Select folder (or select *.webapp?)
  3. App gets packaged and installed
  4. Clicking "Update" repackages and installs the app

App list needs frontend

I might repeat things from the spec, this is just a brain dump from what's in there now and what should be there.

See spec for list actions (Add app …)

Each app is displayed with

  • name
  • icon
  • type, local directory, hosted (with manifest) or generated (generated manifest)
  • location, local path, URL to manifest or URL to page, depending on type

Actions for each app:

  • Install, only when not installed
  • Update, only when already installed (I currently show the last updated datetime as reference)
  • Delete (removes app from phone and addon) P2?
  • Open location

I currently just throw in the buttons and fields I need when adding the actual features to the add-ons, but the list still needs styling, which involves adding some template engine to JS and event delegation (or whatever pattern works best) to make coding easier.

Welcome Page?

r2d2b2g had a welcome screen in its first version. I just switched it back on, but now thinking about its usefulness.

Some questions:

  • When to show it? Its introduction might only be useful in first launch and upgrade (it later could feature a changelog)
  • What to show? Currently explains how to open the FxOS Simulator dashboard and the home button shortcut.

Thoughts? @dangoor @mykmelez

expose "created apps" API to Helper

r2d2b2g exposes a Create App function to the Helper page, but it doesn't expose an API for Helper to retrieve information about created apps. It should do so, so Helper can list the user's created apps and give the user tools for accessing them and performing common tasks, in particular:

  1. Start App (re/install app, re/start B2G Desktop, and go directly to the app via the -webapp command-line option);
  2. Open File Location (open a File Manager window--Explorer on Windows, Finder on Mac, Files on GNOME--to the directory containing the app's files, probably by using nsIFile::reveal());
  3. Package App (archive the app in a ZIP archive suitable for uploading to Marketplace).

support both 32-bit and 64-bit executables in Linux package

Bug 804330 will add 64-bit Linux builds of B2G Desktop, and we should bundle the 64-bit build with the 32-bit build in the Linux package, selecting the executable to run at runtime based on the bit-depth of the user's Linux installation.

(We need to bundle the builds into the same package and select the executable to run at runtime because AMO, on which we plan to distribute the package, only supports a single Linux XPI.)

track created apps outside Gaia profile

r2d2b2g's nascent Create App function installs an app into the Gaia profile but doesn't record its existence anywhere other than the webapps/webapps.json file in the profile. That means it'll lose track of the app after an addon update, when the addon completely removes and replaces the profile. It also means that it's hard to distinguish between built-in apps and those created by the addon.

r2d2b2g should track created apps in a persistent store that survives updates and clearly distinguishes between the user's apps and built-in apps. One option would be to use the simple-storage module https://addons.mozilla.org/en-US/developers/docs/sdk/latest/packages/addon-kit/simple-storage.html.

Use mobile user agent instead of host machine's

The user agent that's showing up for me is:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:18.0) Gecko/18.0 Firefox/18.0

Which means many sites are returning desktop content. I'd think for the purposes of quick and easy app testing, r2d2b2g should use the (generally agreed upon) mobile user agent:

Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0

(Obligatory: Yes, it's better for developers to do feature detection and responsive design than user agent sniffing.)

created app sometimes shows blank screen

Sometimes, when you create an app, start B2G Desktop, and then start the app, the app displays a black screen instead of the app, and B2G Desktop becomes unresponsive (it isn't possible to go back to the home screen). When that happens, I don't see any different error messages in the console, just these same two that always appear:

Content JS INFO at app://system.gaiamobile.org/js/window_manager.js:802 in createFrame: %%%%% Launching My App 39 as remote (OOP)
Content JS LOG at app://system.gaiamobile.org/js/window_manager.js:379 in anonymous: Window Manager: No screenshot in database. This is expected from a fresh installed app.

I wonder if that black screen is some kind of default screenshot that appears when an app doesn't have a screenshot, per that log message. And then something goes wrong between the display of the screenshot and the loading of the app's actual content.

In any case, starting the app should always show the app! So if there's something we're doing wrong when creating the app that causes it to sometimes fail to start, then we need to fix that. Or, if this is a B2G Desktop bug, then fix that.

Clearing App Cache

Seems like apps don't have a separated cache (correct me if I am wrong) in B2G, which makes cleaning cache for just one app hard.

Some ideas:

  • Clearing the cache when the user updates an app. Might have unexpected results, as other apps that weren't updated will also be reset.
  • An option to Clear Cache on Launch, similar to JS Console.
  • Alternatives, like changing install flow (to give apps a new ID on install), experimenting.

What are your thoughts on that, @dangoor, @mykmelez ?

Re-install apps on add-on update

The last thing missing for #14 is a smooth update process, where the B2G profile gets populated automatically after update with all the apps installed before.

rename addon to Firefox OS Simulator

Wherever "Ready to Deliver to Boot to Gecko" or "r2d2b2g" appears to users, we should change the string to "Firefox OS Simulator", or "simulator" for short. I'm thinking particularly of the addon's listing in Add-on Manager (for which we just need to update the addon's name/description in package.json).

One place we should not change (right now) is the manager's URL. That is derived from the addon's ID, and it should be simpler (perhaps as simple as about:simulator), but doing that is probably complicated and doesn't matter for v1.

Error while loading localization file

When running FX Nightly from the terminal, I get this error on startup—

info: r2d2b2g: Error while loading localization: There is no localization file for your language.
info: r2d2b2g: linux/b2g/b2g-bin terminated with 0
Running global cleanup code from study base classes.

Nightly continues to function (more or less) normally, but Tools►B2G Desktop doesn't work.

I'm running 19.0a1 (2012-10-13), on Ubuntu 12.10 64-bit.

manager always has horizontal scrollbar

No matter how wide I make the browser window, the manager always has a horizontal scrollbar. It should fit into the available space provided the browser window is a reasonable size.

Crashes when you open the Firefox app

Windows 7 SP3 x64, running the extension under Firefox UX 19.0a1 (2012-11-06).

Just installed for the first time, started it up, unlocked, ran the Firefox app.

Mozilla B2G crash reporter comes up, Details button doesn't seem to do anything.

I put a link to this issue in the comments field of the crash report before sending it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.