| 1072 | } |
| 1073 | |
| 1074 | fn parse_page_listing(args: &Dictionary) -> Vec<WebKitPage> { |
| 1075 | let Some(app_id) = string_value(args, "WIRApplicationIdentifierKey") else { |
| 1076 | return Vec::new(); |
| 1077 | }; |
| 1078 | let Some(listing) = args.get("WIRListingKey").and_then(Value::as_dictionary) else { |
| 1079 | return Vec::new(); |
| 1080 | }; |
| 1081 | |
| 1082 | listing |
| 1083 | .iter() |
| 1084 | .filter_map(|(page_key, value)| { |
| 1085 | let page = value.as_dictionary()?; |
| 1086 | let page_id = integer_value(page, "WIRPageIdentifierKey") |
| 1087 | .or_else(|| page_key.parse::<u64>().ok())?; |
| 1088 | Some(WebKitPage { |
| 1089 | app_id: app_id.clone(), |
| 1090 | page_id, |
| 1091 | title: string_value(page, "WIRTitleKey"), |
| 1092 | url: string_value(page, "WIRURLKey"), |
| 1093 | connection_id: string_value(page, "WIRConnectionIdentifierKey"), |
| 1094 | }) |
| 1095 | }) |
| 1096 | .collect() |
| 1097 | } |
| 1098 | |
| 1099 | fn apply_page_listing(pages: &mut BTreeMap<(String, u64), WebKitPage>, listing_args: &Dictionary) { |
| 1100 | if let Some(app_id) = string_value(listing_args, "WIRApplicationIdentifierKey") { |