On Mon, Aug 26, 2019 at 9:02 AM Henri Sivonen <hsivo...@mozilla.com> wrote:
> In what type of test does > SpecialPowers.Cu.getJSTestingFunctions().newRope() actually return a > rope within the calling compartment such that passing the rope to a > WebIDL API really makes the rope enter the WebIDL bindings instead of > getting intercepted by a cross-compartment wrapper first? > An xpcshell test or mochitest-chrome is probably easiest.. Or a system Sandbox/evalInSandbox but that becomes more complicated. Strings are copied across zone boundaries so any global in the system zone should work. You can use the isSameCompartment JS testing function to test/assert the following is true in your test: testingFunctions.isSameCompartment(testingFunctions.newRope, this) (same-compartment is a stronger invariant than same-zone but for system compartments it should be fine). > Alternatively: What kind of string lengths should I use with normal JS > string concatenation to be sure that I get a rope instead of the right > operand getting copied into an extensible left operand? > js::ConcatStrings creates a rope if both sides have length > 0 and the result doesn't fit in a JSFatInlineString (limits there are 11 and 23 for Latin1 vs TwoByte chars). The extensible-string optimization applies to rope flattening (we still create a rope first in that case). Hope this helps, Jan > > -- > Henri Sivonen > hsivo...@mozilla.com > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform