Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Firefox OS Симулятор

Перевод не завершен. Пожалуйста, помогите перевести эту статью с английского.

Страница с описанием Симулятора Firefox OS для разработчиков, ориентирующихся на Firefox OS 1.2 или новее. Если вы разрабатываете приложения для Firefox OS 1.1, то см. документацию для Симулятора Firefox OS 1.1.

Firefox OS Simulator — это версия ПО высшего уровня Firefox OS (уровня пользователя), которая имитирует устройство Firefox OS, но работает на настольном компьютере. Это означает, что во многих случаях вам не нужно реального устройства для тестирования и отладки приложения. Он работает в окне того же размера, что и устройство на Firefox OS и включает в себя пользовательский интерфейс Firefox OS и встроенные приложения, а также имитирует многие из API устройств Firefox OS.

Симулятор упаковывается и распространяется как дополнение к Firefox. После того как вы скачали и установили его в Firefox, вы можете запускать его, push apps to it, и подсоединять к нему инструменты разработки с помощью App Manager или WebIDE.

Установка

Для установки симулятора используйте панель «Управление дополнительными компонентами» WebIDE (встроена в Firefox 34 с версии 34). Multiple versions are available, and you are advised to install them all, for maximum flexibility.

Для запуска симулятора, выберите его из списка сред выполнения WebIDE. Для получения более подробной информации см. инструкции в документации WebIDE. После первого запуска симулятора вы можете загружать в него приложения и отлаживать их в WebIDE точно так же, как на реальном устройстве.

Если вы используете App Manager (более старую утилиту, которая была доступна до WebIDE), то вы можете установить симулятор воспользовавшись следующей кнопкой:

Установить Симулятор

Интерфейс пользователя Симулятора

The Simulator appears as a separate window, sized so the simulated screen area is 320x480 pixels. 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:

The Simulator has two buttons in a toolbar at the bottom:

  • the button on the left takes you to the Home screen, or switches the Simulator off if you hold it down
  • the button on the right switches the Simulator between portrait and landscape orientation. This will generate the orientationchange event.

SD card emulation

In the Simulator the device SD card is mapped to the "fake-sdcard" directory in the Simulator's profile, which is itself located inside the "extensions" directory under the Firefox profile in which the Simulator is installed. For example:

/path/to/Firefox/Profiles/Firefox-profile-name/extensions/[email protected]/profile/fake-sdcard

Files read or written using the getDeviceStorage API will appear here.

Before version 2.2 of the Simulator, you had to create the "fake-sdcard" directory manually for this to work. From 2.2 onwards, the "fake-sdcard" directory is created for you automatically.

Also from version 2.2 onwards, if you're running the Simulator from the command line you can define a different directory by passing the --storage-path option.

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.

Аудио/видео кодеки 

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

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

You can see messages logged from your app in the Web Console, which you can attach to your app using the WebIDE. If you want to catch early messages happening during app startup, before the console gets connected and working, you can enable verbose logging in the Simulator.

Visit about:config and create a new preference. The preference name is different for each version of the Simulator:

Set it to the string value "all", and disable, then reenable, the add-on in the Add-on Manager. Now extra messages about the Simulator's operation will appear in the Browser Console.

Building the Simulator

If you'd like to test patches to the Gecko or Gaia code that the Simulator contains, you may be interested in modifying the simulator to use a custom Gecko build or Gaia profile. Alternatively, you can build a new Simulator from your Gecko checkout.

Метки документа и участники

 Внесли вклад в эту страницу: mrDSide, Aleksej, KrishnaKevalam, vm10111957r, hakster
 Обновлялась последний раз: mrDSide,