mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Refactor:Refactors report_cross_origin_denial method to use unsafe block (#36365)
The method report_cross_origin_denial was marked as unsafe, have instead moved the unsafe code within the method into an unsafe block within the method and removed the unsafe marking for the method. Testing: No testing needed Fixes: This PR resolves #36356. Signed-off-by : Ashok Kaushik kaushikashok45@gmail.com --------- Signed-off-by: ashok.kaushik <ashok.kaushik@zohocorp.com> Co-authored-by: ashok.kaushik <ashok.kaushik@zohocorp.com>
This commit is contained in:
parent
b87bf0b806
commit
a67409fb25
1 changed files with 7 additions and 5 deletions
|
@ -509,7 +509,7 @@ fn ensure_cross_origin_property_holder(
|
|||
/// What this function does corresponds to the operations in
|
||||
/// <https://html.spec.whatwg.org/multipage/#the-location-interface> denoted as
|
||||
/// "Throw a `SecurityError` DOMException".
|
||||
pub(crate) unsafe fn report_cross_origin_denial<D: DomTypes>(
|
||||
pub(crate) fn report_cross_origin_denial<D: DomTypes>(
|
||||
cx: SafeJSContext,
|
||||
id: RawHandleId,
|
||||
access: &str,
|
||||
|
@ -520,10 +520,12 @@ pub(crate) unsafe fn report_cross_origin_denial<D: DomTypes>(
|
|||
id_to_source(cx, id).as_deref().unwrap_or("< error >"),
|
||||
);
|
||||
let in_realm_proof = AlreadyInRealm::assert_for_cx(cx);
|
||||
if !JS_IsExceptionPending(*cx) {
|
||||
let global = D::GlobalScope::from_context(*cx, InRealm::Already(&in_realm_proof));
|
||||
// TODO: include `id` and `access` in the exception message
|
||||
<D as DomHelpers<D>>::throw_dom_exception(cx, &global, Error::Security, CanGc::note());
|
||||
unsafe {
|
||||
if !JS_IsExceptionPending(*cx) {
|
||||
let global = D::GlobalScope::from_context(*cx, InRealm::Already(&in_realm_proof));
|
||||
// TODO: include `id` and `access` in the exception message
|
||||
<D as DomHelpers<D>>::throw_dom_exception(cx, &global, Error::Security, CanGc::note());
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue