Commit message: None
CVE: CVE-2015-1223
Vulnerability description: Multiple use-after-free vulnerabilities in core/html/HTMLInputElement.cpp in the DOM implementation in Blink, as used in Google Chrome before 41.0.2272.76, allow remote attackers to cause a denial of service or possibly have unspecified other impact via vectors that trigger extraneous change events, as demonstrated by events for invalid input or input to read-only fields, related to the initializeTypeInParsing and updateType functions.

Project: Chrome

std::string PermissionUtil::ConvertContentSettingsTypeToSafeBrowsingName(
    ContentSettingsType permission_type) {
  switch (permission_type) {
    case CONTENT_SETTINGS_TYPE_GEOLOCATION:
      return "GEOLOCATION";
    case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
      return "NOTIFICATIONS";
    case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
      return "MIDI_SYSEX";
    case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
      return "PUSH_MESSAGING";
    case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE:
      return "DURABLE_STORAGE";
    case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
      return "PROTECTED_MEDIA_IDENTIFIER";
    case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
      return "AUDIO_CAPTURE";
    case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
      return "VIDEO_CAPTURE";
    case CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC:
      return "BACKGROUND_SYNC";
    case CONTENT_SETTINGS_TYPE_PLUGINS:
      return "FLASH";
    default:
      break;
  }
  NOTREACHED();
  return std::string();
}

Project: Chrome

PermissionRequestGestureType PermissionUtil::GetGestureType(bool user_gesture) {
  return user_gesture ? PermissionRequestGestureType::GESTURE
                      : PermissionRequestGestureType::NO_GESTURE;
}

Project: Chrome

std::string PermissionUtil::GetPermissionString(
    ContentSettingsType content_type) {
  switch (content_type) {
    case CONTENT_SETTINGS_TYPE_GEOLOCATION:
      return "Geolocation";
    case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
      return "Notifications";
    case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
      return "MidiSysEx";
    case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
      return "PushMessaging";
    case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE:
      return "DurableStorage";
    case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
      return "ProtectedMediaIdentifier";
    case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
      return "AudioCapture";
    case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
      return "VideoCapture";
    case CONTENT_SETTINGS_TYPE_MIDI:
      return "Midi";
    case CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC:
      return "BackgroundSync";
    case CONTENT_SETTINGS_TYPE_PLUGINS:
      return "Flash";
    default:
      break;
  }
  NOTREACHED();
  return std::string();
}

Project: Chrome

PermissionRequestType PermissionUtil::GetRequestType(ContentSettingsType type) {
  switch (type) {
    case CONTENT_SETTINGS_TYPE_GEOLOCATION:
      return PermissionRequestType::PERMISSION_GEOLOCATION;
    case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
      return PermissionRequestType::PERMISSION_NOTIFICATIONS;
    case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
      return PermissionRequestType::PERMISSION_MIDI_SYSEX;
    case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
      return PermissionRequestType::PERMISSION_PUSH_MESSAGING;
    case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
      return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER;
    case CONTENT_SETTINGS_TYPE_PLUGINS:
      return PermissionRequestType::PERMISSION_FLASH;
    default:
      NOTREACHED();
      return PermissionRequestType::UNKNOWN;
  }
}

Project: Chrome

PermissionUtil::ScopedRevocationReporter::ScopedRevocationReporter(
    Profile* profile,
    const GURL& primary_url,
    const GURL& secondary_url,
    ContentSettingsType content_type,
    PermissionSourceUI source_ui)
    : profile_(profile),
      primary_url_(primary_url),
      secondary_url_(secondary_url),
      content_type_(content_type),
      source_ui_(source_ui) {
  if (!primary_url_.is_valid() ||
      (!secondary_url_.is_valid() && !secondary_url_.is_empty())) {
    is_initially_allowed_ = false;
    return;
  }
  HostContentSettingsMap* settings_map =
      HostContentSettingsMapFactory::GetForProfile(profile_);
  ContentSetting initial_content_setting = settings_map->GetContentSetting(
      primary_url_, secondary_url_, content_type_, std::string());
  is_initially_allowed_ = initial_content_setting == CONTENT_SETTING_ALLOW;
}

Project: Chrome

bool PermissionUtil::ShouldShowPersistenceToggle() {
  return base::FeatureList::IsEnabled(
      features::kDisplayPersistenceToggleInPermissionPrompts);
}

Project: Chrome

PermissionUtil::ScopedRevocationReporter::~ScopedRevocationReporter() {
  if (!is_initially_allowed_)
    return;
  HostContentSettingsMap* settings_map =
      HostContentSettingsMapFactory::GetForProfile(profile_);
  ContentSetting final_content_setting = settings_map->GetContentSetting(
      primary_url_, secondary_url_, content_type_, std::string());
  if (final_content_setting != CONTENT_SETTING_ALLOW) {
    PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_,
                                         primary_url_, profile_);
  }
}