mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #9244 - paulrouget:securitychange, r=jdm
mozbrowsersecuritychange event Fixes #8544 No test yet. Is there a way to mock a https connection? Also, I wish I could use the `HTTPSState` enum instead of a `String` when calling `trigger_mozbrowser_event` (https://github.com/servo/servo/compare/master...paulrouget:securitychange?expand=1#diff-30a18e04d7e0b66aafdf192e416cad44R306) but that would require `constellation_msg.rs` to know about `HTTPSState`, which is defined in `document.rs`, which would add a dependency to `components/msg`. I could define `HTTPSState` somewhere else maybe? Or maybe it's fine to use a `String`. But then, should I use the HTTPSState strings (`"modern/deprecated/none"`) or the mozbrowser strings (`"secure/insecure/broken"`) (as it is now) <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9244) <!-- Reviewable:end -->
This commit is contained in:
commit
3d63f09361
13 changed files with 135 additions and 4 deletions
|
@ -84,6 +84,7 @@ use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState};
|
|||
use msg::constellation_msg::{PipelineId, SubpageId};
|
||||
use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
|
||||
use net_traits::CookieSource::NonHTTP;
|
||||
use net_traits::response::HttpsState;
|
||||
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
|
||||
use num::ToPrimitive;
|
||||
use script_thread::{MainThreadScriptMsg, Runnable};
|
||||
|
@ -204,6 +205,8 @@ pub struct Document {
|
|||
dom_complete: Cell<u64>,
|
||||
/// Vector to store CSS errors
|
||||
css_errors_store: DOMRefCell<Vec<CSSError>>,
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-document-https-state
|
||||
https_state: Cell<HttpsState>,
|
||||
}
|
||||
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
|
@ -289,6 +292,11 @@ impl Document {
|
|||
self.is_html_document
|
||||
}
|
||||
|
||||
pub fn set_https_state(&self, https_state: HttpsState) {
|
||||
self.https_state.set(https_state);
|
||||
self.trigger_mozbrowser_event(MozBrowserEvent::SecurityChange(https_state));
|
||||
}
|
||||
|
||||
pub fn report_css_error(&self, css_error: CSSError) {
|
||||
self.css_errors_store.borrow_mut().push(css_error);
|
||||
}
|
||||
|
@ -1523,6 +1531,7 @@ impl Document {
|
|||
dom_content_loaded_event_end: Cell::new(Default::default()),
|
||||
dom_complete: Cell::new(Default::default()),
|
||||
css_errors_store: DOMRefCell::new(vec![]),
|
||||
https_state: Cell::new(HttpsState::None),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue