servo / servo/mozjs

Road to safe wrappers

Open
#641 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
359
Forks
153
Avg merge
2d 10h
Merged PRs (30d)
8

Description

As part of #638 I am investigating what do we need to safe wrappers.

Ex: JS_StringEqualsAscii(cx: *mut JSContext, str_: *mut JSString, asciiBytes: *const ::std::os::raw::c_char, match_: *mut bool) -> bool
and safe and rusty version would be JS_StringEqualsAscii(cx: &JSContext, str_: JSStringWrapper, asciiBytes: &'static CStr, match_: &mut bool) -> Result<(), ()>.
While doing this could be somehow automated, we should still manually check if all assumptions are upheld in SM, so maybe it make sense to make this fully manual rather than trying to automate this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with issue #638 and compare the raw JS_StringEqualsAscii signature with the proposed safe Rust version. Identify the SpiderMonkey assumptions that must be checked manually, and consider the work complete when the required wrapper scope and safety checks are explicitly defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.