Beispiel #1
0
static GfxDeviceFamily*
BlacklistDevicesToDeviceFamily(nsIDOMHTMLCollection* aDevices)
{
  uint32_t length;
  if (NS_FAILED(aDevices->GetLength(&length)))
    return nullptr;

  // For each <device>, get its device ID, and return a freshly-allocated
  // GfxDeviceFamily with the contents of that array.
  GfxDeviceFamily* deviceIds = new GfxDeviceFamily;

  for (uint32_t i = 0; i < length; ++i) {
    nsCOMPtr<nsIDOMNode> node;
    if (NS_FAILED(aDevices->Item(i, getter_AddRefs(node))) || !node)
      continue;

    nsAutoString deviceValue;
    if (!BlacklistNodeToTextValue(node, deviceValue))
      continue;

    deviceIds->AppendElement(deviceValue);
  }

  return deviceIds;
}
Beispiel #2
0
static GfxDeviceFamily*
BlacklistDevicesToDeviceFamily(nsTArray<nsCString>& devices)
{
    if (devices.Length() == 0)
        return nullptr;

    // For each device, get its device ID, and return a freshly-allocated
    // GfxDeviceFamily with the contents of that array.
    GfxDeviceFamily* deviceIds = new GfxDeviceFamily;

    for (uint32_t i = 0; i < devices.Length(); ++i) {
        // We make sure we don't add any "empty" device entries to the array, so
        // we don't need to check if devices[i] is empty.
        deviceIds->AppendElement(NS_ConvertUTF8toUTF16(devices[i]));
    }

    return deviceIds;
}