Your Search Results

    Firefox OS Simulator

    This translation is incomplete. Please help translate this article from English.

    The Firefox OS Simulator does not currently work with Mac OS X 10.9 (Maverick). See bug 930511 for the details. There is a workaround, which is to run Firefox from the disk image (DMG) file without actually installing it.

    Firefox OS Simulator je stále v počáteční fázi vývoje, není dokončen a dostatečně spolehlivý, jak bychom si sami přáli.

    Pokud neleznete jakoukoliv chybu, please nahlaste ji prosím na serveru GitHub. Pokud máte jakoukoliv otázku, zkuste se zeptat v poštovní konferenci dev-developer-tools nebo na kanálu #devtools na irc.mozilla.org.

    Přečtěte si, jak povolit podobné logování a stáhněte si nejnovější sestavení v sekci Získání pomoci.

    Doplněk Firefox OS Simulator je nástroj, který vám umožní vyzkoušet a odladit vaši Firefox OS aplikaci na desktopu. Cyklus kód-vyzkoušení-ladění je se simulátorem mnohem rychlejší než s reálným zařízením a samozřejmě vám umožňuje vývoj bez vlastnictví zařízení.

    Doplněk Simulator zahrnuje:

    • Simulator: zahrnuje klienta Firefox OS pro desktop, což je verze vyšších vrstev Firefox OS, které běží na vašem desktopu. Simulator též obsahuje některé emulované vlastnosti, které nejsou součástí sestavení Firefox OS pro desktop.
    • Dashboard: nástroj hostovaný prohlížečem Firefox, který umožňuje spouštět a ukončovat Simulator a instalovat, odinstalovávat či ladit aplikace, když běží. Dashboard vám též pomáhá nahrávat vaše aplikace do reálného zařízení a kontrolovat instalační manifest na základní chyby.

    Obrázek níž ukazuje ladění pomoci doplňku Simulator.

    Dashboard je vpravo nahoře a běží uvnitř okna Firefoxu. Přidali jsme jednu zabalenou aplikaci s názvem "Where am I?". Vlevo nahoře běží aplikace uvnitř Simulator. Jsme též připojeni pomocí ladících nástrojů, které jsou v dolní části okna. Můžete si též všimnout, že jsme právě zastavili u zarážky.

    Tato stránka pokrývá následující témata:

    Pro praktický ukázky, které ukazují, jak používat Simulator pro ladění reálné webové aplikace, si přečtěte článek Simulator Walkthrough.

    Instalace doplňku Simulator

    Simulator je zabalen a distribuován jako doplněk pro Firefox. Pro instalaci:

    1. Ve Firefoxu přejděte na stránku doplňku Simulator na addons.mozilla.org.
    2. Klepněte na "Přidat do Firefoxu".
    3. Jakmile bude doplněk stažen, budete dotázání na jeho instalaci: klepněte na "Instalovat nyní".

    Protože je velikost doplňku velká, může Firefox při instalaci na několik sekund zamrznout a objevit se dialog "Upozornění: Skript nereaguje". Pokud se objeví, klepněte na tlačítko "Pokračovat" a vyčkejte až se dokončí instalace. Od verze Firefoxu 27 by k tomuto již nemělo docházet.

    Jakmile budete mít doplněk Simulator nainstalován, bude Firefox pravidelně kontrolovat, zda není k dispozici jeho aktuálnější verze.

    Po instalaci doplňku Simulator se automaticky otevře úvodní obrazovka, kterou můžete kdykoliv znovu otevřít v nabídce "Firefox" (či nabídce "Nástroje" na OS X a Linuxu), kde zvolíte "Vývoj webu", a následně "Firefox OS Simulator":


    Úvodní obrazovka je nástroj, který je používán pro přidání vaší aplikace do doplňku Simulator a její spuštění. Vypadá následovně:

     

    Přidávání, aktualizace a odebírání aplikací

    Přidávání aplikací

    Pro přidání zabalené aplikace do Simulátoru, otevřete Dashboard a klepněte na "Add Directory" a vyberte manifest soubor pro vaši aplikaci.

    Pro přidání hostované aplikace vložte URL do textového pole, které je nadepsáno "URL for page or manifest.webapp" a klepněte na tlačítko "Add URL". Pokud URL odkazuje na manifest, bude použit. Pokud ne, vygeneruje Nástěnka pro URL manifest automaticky. Máte tak možnost přidat libovolnou aplikaci pouze vložením její URL.

    Když přidáte aplikaci, nástěnka spustí sérii testů vašeho souboru s manifestem a zkontroluje jej na nejčastější problémy. Pro informace, jaké testy jsou spouštěny, nahlédněte do sekce Kontrola manifestu.

    Pakliže kontrola manifestu nezjistí u vaší aplikace chyby, pak nástěnka automaticky spustí vaši aplikaci v simulátoru.

    Správa aplikací

    Jakmile přidáte aplikaci, objeví se v seznamu nainstalovaných aplikací:

    Každá položka vám dá následující informace o aplikaci:

    • její název, který je vzaný z manifestu
    • její typ, který je "Packaged", "Hosted" či "Generated"
    • odkaz na její soubor s manifestem
    • výsledek kontroly manifestu

    Máte též k dispozici tři příkazy:

    • "Refresh": use this to update and reload the app in the Simulator after you have made changes to it. This also makes the Dashboard validate the manifest again. If you make changes to your app they will not be reflected automatically in the installed app: you will need to refresh the app to apply the changes.
    • "Connect": use this to connect developer tools to the selected app. The Dashboard will start the Simulator and app if they aren't already running.
    • "Remove" ("X"): odebere aplikaci z nástěnky doplňku Simulator. Tuto akci můžete vrátit zpět po dobu, kdy je nástěnka otevřena.
    • "Receipt": use this to test receipt verification for paid apps. After you select a type of receipt to test, the app will be reinstalled with a test receipt of the given type.

    Refresh App from the Simulator window: you can update and reload an app directly from the Simulator window using the menubar action or its associated shortcut while the app is running.

    Manifest validation

    When you supply a manifest, the Manager will run some validation tests on it. It reports three categories of problems:

    • manifest errors: problems that will prevent your app from installing or running
    • manifest warnings: problems that may prevent your app from working properly
    • simulator-specific warnings: features your app is using that the Simulator doesn't yet support

    It summarises the problems encountered in the entry for the app: clicking on the summary provides more details.

    Manifest errors

    The Dashboard will report the following conditions as errors, meaning that you won't be able to run your app in the Simulator without fixing them:

    • the manifest does not include the mandatory "name" field
    • the manifest is not valid JSON
    • the app is a hosted app, but the type field in its manifest is "privileged" or "certified", which are only available to packaged apps
    • common appCache errors (packaged apps can't use appCache, requests to the manifest URL return an HTTP redirect or an HTTP error status)

    Here's the result of trying to add a manifest file with a missing "name":

    Manifest warnings

    The Dashboard will report the following manifest issues as warnings:

    • missing icons
    • the icon is less than 128 pixels: all apps submitted to the Marketplace must have at least one icon that is at least 128 pixels square
    • the type field is unrecognized
    • the manifest requests a permission that is unrecognized
    • the manifest requests a permission which will be denied
    • the manifest requests a permission for which access could not be determined

    Simulator-specific warnings

    Finally, the Manager will emit warnings for apps that use features of Firefox OS not yet fully supported by the Simulator:

    • the type field is "certified", but the Simulator does not yet fully support certified apps
    • the manifest requests a permission to use an API that is not yet supported by the Simulator

    Running the Simulator

    There are two different ways the Simulator may be started:

    • if you add an app or click the "Refresh" or "Connect" button next to your app's entry, the Dashboard will automatically run your app in the Simulator
    • if you click the button labeled "Stopped" on the left-hand side of the Dashboard, the Simulator will boot to the Home screen and you'll need to navigate to your app

    Either way, once the Simulator is running, the button labeled "Stopped" turns green and the label changes to "Running". To stop the Simulator, click this button again.

    The Simulator appears as a separate window, sized so the simulated screen area is 320x480 pixels, with a toolbar at the bottom and a menubar at the top that contains some extra features:

    To simulate touch events you can click the mouse button and drag while holding the button down. So by clicking and dragging right-to-left from the Home Screen, you'll see the built-in apps, as well as any apps you have added:

    Simulator toolbar

    In the bottom toolbar, from left to right, these are the Home button, the Screen Rotation button, and the Geolocation button.

    • the Home button takes you to the Home screen (or to the task list if you keep it pressed for a couple of seconds)
    • the Screen Rotation button switches the device between portrait and landscape orientation. This will generate the orientationchange event.
    • the Geolocation button triggers a dialog asking you to share your geographic location, either using your current coordinates or supplying custom coordinates: this will be made available to your app via the Geolocation API.

    Simulator menubar

    In the top menubar, you can access some useful commands to make development more efficient:

    • File -> Quit (Ctrl/Cmd - Q): shut down the Simulator
    • App -> Refresh (Ctrl/Cmd - R): refresh the running app

    The keyboard shortcut for the "App Refresh" command makes it possible to iteratively develop an app much like a web page:

    • make a change to the code (and rerun your build tool if needed, e.g. volo / yeoman / grunt)
    • type the keyboard shortcut to refresh the app running in the Simulator

    "Refresh App and Clear Data" hidden shortcut: sometimes it's useful to clear data that the Simulator has stored for an app, so the Simulator contains a hidden shortcut, Shift - Ctrl/Cmd - R, that will refresh the running app while clearing the following data:

    • localStorage / sessionStorage

    • cookies

    • indexedDB

    • appCache

    Attaching developer tools

    You can attach developer tools to the Simulator, to help debug your app. At the moment you can only attach the JavaScript Debugger, the Web Console, the Style Editor, the Profiler and the Network Monitor, but we're working on adding support for more developer tools.

    Some of these tools are only available in Beta, Aurora, or Nightly builds of Firefox.

    To attach developer tools to the Simulator, click the "Connect" button for an app:

    The Dashboard will then open a developer toolbox pane at the bottom of the Dashboard tab and connect it to the app:

    Web Console

    The app can log to this console using the global console object, and it displays various other messages generated by the app: network requests, CSS and JS warnings/errors, and security errors. (Learn more about the Web Console.)

    Debugger

    Using the Debugger, you can step through JavaScript code that is running in the connected app, manage breakpoints, and watch expressions to track down errors and problems faster. (Learn more about the Debugger.)

    Style Editor

    You can view and edit CSS files referenced in the app using the connected Style Editor. Your changes will be applied to the app in real time, without needing to refresh the app. (Learn more about the Style Editor.)

    Profiler

    Using the Profiler tool connected to the app, you can to find out where your JavaScript code is spending too much time. The Profiler periodically samples the current JavaScript call stack and compiles statistics about the samples. (Learn more about the Profiler.)

    Network Monitor

    Thanks to the new Network Monitor, you can analyze the status, headers, content and timing of all the network requests initiated by the app through a friendly interface. (Learn more about the Network Monitor.)

    Receipts

    If you are developing a paid app, you should test your receipt validation code (e.g. the code that verifies that a user has already purchased the app or has been issued a refund and then informs the user and locks or unlocks app features accordingly) on a valid (cryptographically signed) receipt.

    Thanks to the "Receipts" menu in each app entry on the Simulator Dashboard, you can install an app with a "Valid", "Invalid", or "Refunded" test receipt. Simply select the type of receipt you wish to test, and the Dashboard will retrieve a test receipt of that type from the Marketplace receipt service and reinstall the app with that receipt in the Simulator:

    Push to device

    If you have a Firefox OS device you can connect it to the Simulator, and can then push apps from the Dashboard to the device.

    Connecting a device

    To connect the device, follow the instructions in the guide to connecting a Firefox OS device to the desktop. Note that you don't have to install ADB, as the Simulator add-on includes it already.

    Pushing apps to the device

    Once you've set up the device and desktop, and connected the device to your desktop via USB, you'll see the note "Device connected" appear on the left of the Dashboard, and a new command appear in the entry for each app labeled "Push":

    Click "Push", and the app will be installed on the Firefox OS device.

    Manual Steps:

    • Once you’ve pushed the app to the device, you need to manually close and restart it again, to get updated content

    • If you update anything in the manifest (e.g. app name, orientation, type, permissions), you need to reboot the operating system for those changes to have effect 

    Firefox OS Device Connection Confirmation

    On every device reboot, the first "Push" request needs to be confirmed on the device:

    Troubleshooting on Linux

    If you are unable to connect your device after creating udev rules, please see this bug.

    Limitations of the Simulator

    Note that the Firefox OS Simulator isn't a perfect simulation.

    Hardware limitations

    Apart from screen size, the Simulator does not simulate the hardware limitations of a Firefox OS device such as available memory or CPU speed.

    Audio/video codecs

    The following codecs depend on hardware-accelerated decoding and are therefore not yet supported:

    • MP3
    • AAC
    • H.264 (MP4)
    • WebM

    This means it isn't possible to use the Simulator to test video playback in apps and on websites like Youtube that rely on these codecs.

    Unsupported APIs

    Certain APIs that work on the device won't work on the Simulator, generally because the supporting hardware is not available on the desktop. We've implemented simulations for some APIs such as geolocation, and expect to add more in future releases. However, at the moment the following APIs are not supported. Using them might throw errors or just return incorrect results:

    Getting help

    The Firefox OS Simulator is still at an early stage of development, and isn't yet as reliable and complete as we'd like it to be.

    If you find any bugs, please file them on GitHub. If you have a question, try asking us on the dev-developer-tools mailing list or on #devtools on irc.mozilla.org.

    How to enable verbose logging

    Use about:config to create the preference extensions.r2d2b2g@mozilla.org.sdk.console.logLevel, set it to the integer value 0, and disable/reenable the addon. Additional messages about the Simulator's operation will appear in the Error Console (or Browser Console in newer versions of Firefox).

    How to get the latest preview build

    As the section on installing the Simulator explains, you can get the latest release of the Simulator add-on from addons.mozilla.org.

    Sometimes you might want to try out the very latest features before they're officially released. If so, you can download preview builds from the following URLs:

    Be aware that preview builds are less stable and thoroughly tested than release builds.

    Attachments

    Soubor Size Date Attached by
    simulator-open-windows-7
    65305 bytes 2013-04-22 15:19:05 wbamberg
    FirefoxOS Simulator 4.0 Dashboard
    55027 bytes 2013-07-05 09:26:53 Luca.greco
    FirefoxOS Simulator 4.0 List Apps
    67870 bytes 2013-07-05 09:34:38 Luca.greco
    FirefoxOS Simulator 4.0 Missing Name in manifest.webapp
    101821 bytes 2013-07-05 10:05:06 Luca.greco
    FirefoxOS Simulator 4.0 Connect To App
    82148 bytes 2013-07-05 10:26:20 Luca.greco
    FirefoxOS Simulator 4.0 Developer Tools Connected
    195372 bytes 2013-07-05 11:09:05 Luca.greco
    FirefoxOS Simulator 4.0 Toolbar and Menubar
    102315 bytes 2013-07-06 03:51:26 Luca.greco
    FirefoxOs Simulator 4.0 Geolocation
    268611 bytes 2013-07-06 04:17:19 Luca.greco
    FirefoxOS Simulator 4.0 Overview
    449416 bytes 2013-07-06 04:28:40 Luca.greco
    FirefoxOS Simulator 4.0 Homescreen
    328126 bytes 2013-07-06 07:26:18 Luca.greco
    FirefoxOS Simulator 4.0 Push to device
    94216 bytes 2013-07-06 08:00:26 Luca.greco
    FirefoxOS Simulator 4.0 Receipts Selector
    140233 bytes 2013-07-06 08:59:39 Luca.greco
    FirefoxOS Simulator 4.0 Menubar
    64282 bytes 2013-07-07 07:54:54 Luca.greco
    FirefoxOS Device Connection Confirmation
    106051 bytes 2013-07-07 08:31:17 Luca.greco

    Document Tags and Contributors

    Contributors to this page: Mikk
    Last updated by: Mikk,