mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #14096 - fflorent:11485-make-dom-methods-taking-mut-JSContent-unsafe, r=nox
11485 make dom methods taking mut js content unsafe This is a rebased version of PR #11595 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11485 <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because: no code logic was changed <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14096) <!-- Reviewable:end -->
This commit is contained in:
commit
f70fc6644d
28 changed files with 274 additions and 226 deletions
|
@ -2803,7 +2803,7 @@ impl DocumentMethods for Document {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||
fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonZero<*mut JSObject>> {
|
||||
unsafe fn NamedGetter(&self, _cx: *mut JSContext, name: DOMString) -> Option<NonZero<*mut JSObject>> {
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct NamedElementFilter {
|
||||
name: Atom,
|
||||
|
@ -2871,9 +2871,7 @@ impl DocumentMethods for Document {
|
|||
if elements.peek().is_none() {
|
||||
// TODO: Step 2.
|
||||
// Step 3.
|
||||
return unsafe {
|
||||
Some(NonZero::new(first.reflector().get_jsobject().get()))
|
||||
};
|
||||
return Some(NonZero::new(first.reflector().get_jsobject().get()));
|
||||
}
|
||||
} else {
|
||||
return None;
|
||||
|
@ -2884,9 +2882,7 @@ impl DocumentMethods for Document {
|
|||
name: name,
|
||||
};
|
||||
let collection = HTMLCollection::create(self.window(), root, box filter);
|
||||
unsafe {
|
||||
Some(NonZero::new(collection.reflector().get_jsobject().get()))
|
||||
}
|
||||
Some(NonZero::new(collection.reflector().get_jsobject().get()))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue