@Override public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { String stack = args[0].toString(); return new NativeArray(resultParser.decodeStack(stack)); } };
/** * Retrieves a collection of rectangles that describes the layout of the contents of an object * or range within the client. Each rectangle describes a single line. * @return a collection of rectangles that describes the layout of the contents */ public Object jsxFunction_getClientRects() { return new NativeArray(0); }
/** * Retrieves a collection of rectangles that describes the layout of the contents of an object * or range within the client. Each rectangle describes a single line. * @return a collection of rectangles that describes the layout of the contents */ public Object jsxFunction_getClientRects() { return new NativeArray(0); }
/** * Retrieves a collection of rectangles that describes the layout of the contents of an object * or range within the client. Each rectangle describes a single line. * @return a collection of rectangles that describes the layout of the contents */ public Object jsxFunction_getClientRects() { return new NativeArray(0); }
/** * Empties the MutationObserver instance's record queue and returns what was in there. * @return an Array of {@link MutationRecord}s */ @JsxFunction public NativeArray takeRecords() { return new NativeArray(0); }
static void init(Scriptable scope, boolean sealed) { NativeArray obj = new NativeArray(0); obj.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed); }
/** * Empties the MutationObserver instance's record queue and returns what was in there. * @return an Array of {@link MutationRecord}s */ @JsxFunction public NativeArray takeRecords() { return new NativeArray(0); }
/** * Create an array with a specified initial length. * <p> * @param scope the scope to create the object in * @param length the initial length (JavaScript arrays may have * additional properties added dynamically). * @return the new array object */ public final Scriptable newArray(Scriptable scope, int length) { NativeArray result = new NativeArray(length); ScriptRuntime.setObjectProtoAndParent(result, scope); return result; }
/** * See ECMA 15.4.1,2 */ private static Object jsConstructor(Context cx, Scriptable scope, Object[] args) { if (args.length == 0) return new NativeArray(0); // Only use 1 arg as first element for version 1.2; for // any other version (including 1.3) follow ECMA and use it as // a length. if (cx.getLanguageVersion() == Context.VERSION_1_2) { return new NativeArray(args); } else { Object arg0 = args[0]; if (args.length > 1 || !(arg0 instanceof Number)) { return new NativeArray(args); } else { long len = ScriptRuntime.toUint32(arg0); if (len != ((Number)arg0).doubleValue()) throw Context.reportRuntimeError0("msg.arraylength.bad"); return new NativeArray(len); } } }
/** * Create an array with a set of initial elements. * * @param scope the scope to create the object in. * @param elements the initial elements. Each object in this array * must be an acceptable JavaScript type and type * of array should be exactly Object[], not * SomeObjectSubclass[]. * @return the new array object. */ public final Scriptable newArray(Scriptable scope, Object[] elements) { if (elements.getClass().getComponentType() != ScriptRuntime.ObjectClass) throw new IllegalArgumentException(); NativeArray result = new NativeArray(elements); ScriptRuntime.setObjectProtoAndParent(result, scope); return result; }
@Override public void execute() throws Exception { final NativeArray array = new NativeArray(new Object[] {mutationRecord}); ScriptRuntime.setBuiltinProtoAndParent(array, scope, TopLevel.Builtins.Array); jsEngine.callFunction(owningPage, function_, scope, MutationObserver.this, new Object[] {array}); } });
@Override public void execute() throws Exception { final NativeArray array = new NativeArray(new Object[] {mutationRecord}); ScriptRuntime.setBuiltinProtoAndParent(array, scope, TopLevel.Builtins.Array); jsEngine.callFunction(owningPage, function_, scope, MutationObserver.this, new Object[] {array}); } });
/** * The getAll() method of the URLSearchParams interface returns all the values * associated with a given search parameter as an array. * * @param name The name of the parameter to return. * @return An array of USVStrings. */ @JsxFunction public NativeArray getAll(final String name) { final List<String> result = new LinkedList<>(); for (Entry<String, String> param : params_) { if (param.getKey().equals(name)) { result.add(param.getValue()); } } final NativeArray jsValues = new NativeArray(result.toArray()); ScriptRuntime.setBuiltinProtoAndParent(jsValues, getWindow(this), TopLevel.Builtins.Array); return jsValues; }
/** * The getAll() method of the URLSearchParams interface returns all the values * associated with a given search parameter as an array. * * @param name The name of the parameter to return. * @return An array of USVStrings. */ @JsxFunction public NativeArray getAll(final String name) { final List<String> result = new LinkedList<>(); for (Entry<String, String> param : params_) { if (param.getKey().equals(name)) { result.add(param.getValue()); } } final NativeArray jsValues = new NativeArray(result.toArray()); ScriptRuntime.setBuiltinProtoAndParent(jsValues, getWindow(this), TopLevel.Builtins.Array); return jsValues; }
@Override public void execute() throws Exception { final NativeArray array = new NativeArray(new Object[] {mutationRecord}); ScriptRuntime.setBuiltinProtoAndParent(array, scope, TopLevel.Builtins.Array); jsEngine.callFunction(owningPage, function_, scope, MutationObserver.this, new Object[] {array}); } });
@Override public void execute() throws Exception { final NativeArray array = new NativeArray(new Object[] {mutationRecord}); ScriptRuntime.setBuiltinProtoAndParent(array, scope, TopLevel.Builtins.Array); jsEngine.callFunction(owningPage, function_, scope, MutationObserver.this, new Object[] {array}); } });
private void settleAll(final Window window) { if (race_) { for (Promise promise : all_) { if (promise.state_ == PromiseState.REJECTED) { settleThis(false, promise.value_, window); return; } else if (promise.state_ == PromiseState.FULFILLED) { settleThis(true, promise.value_, window); return; } } return; } final ArrayList<Object> values = new ArrayList<>(all_.length); for (Promise promise : all_) { if (promise.state_ == PromiseState.REJECTED) { settleThis(false, promise.value_, window); return; } else if (promise.state_ == PromiseState.PENDING) { return; } values.add(promise.value_); } final NativeArray jsValues = new NativeArray(values.toArray()); ScriptRuntime.setBuiltinProtoAndParent(jsValues, window, TopLevel.Builtins.Array); settleThis(true, jsValues, window); }
private void settleAll(final Window window) { if (race_) { for (Promise promise : all_) { if (promise.state_ == PromiseState.REJECTED) { settleThis(false, promise.value_, window); return; } else if (promise.state_ == PromiseState.FULFILLED) { settleThis(true, promise.value_, window); return; } } return; } final ArrayList<Object> values = new ArrayList<>(all_.length); for (Promise promise : all_) { if (promise.state_ == PromiseState.REJECTED) { settleThis(false, promise.value_, window); return; } else if (promise.state_ == PromiseState.PENDING) { return; } values.add(promise.value_); } final NativeArray jsValues = new NativeArray(values.toArray()); ScriptRuntime.setBuiltinProtoAndParent(jsValues, window, TopLevel.Builtins.Array); settleThis(true, jsValues, window); }
/** * {@inheritDoc} */ @Override public void characterDataChanged(final CharacterDataChangeEvent event) { final ScriptableObject target = event.getCharacterData().getScriptableObject(); if (subtree_ || target == node_) { final MutationRecord mutationRecord = new MutationRecord(); final Scriptable scope = getParentScope(); mutationRecord.setParentScope(scope); mutationRecord.setPrototype(getPrototype(mutationRecord.getClass())); mutationRecord.setType("characterData"); mutationRecord.setTarget(target); if (characterDataOldValue_) { mutationRecord.setOldValue(event.getOldValue()); } final Window window = getWindow(); final HtmlPage owningPage = (HtmlPage) window.getDocument().getPage(); final JavaScriptEngine jsEngine = (JavaScriptEngine) window.getWebWindow().getWebClient().getJavaScriptEngine(); jsEngine.addPostponedAction(new PostponedAction(owningPage) { @Override public void execute() throws Exception { final NativeArray array = new NativeArray(new Object[] {mutationRecord}); ScriptRuntime.setBuiltinProtoAndParent(array, scope, TopLevel.Builtins.Array); jsEngine.callFunction(owningPage, function_, scope, MutationObserver.this, new Object[] {array}); } }); } }
@Override public void execute() throws Exception { final NativeArray array = new NativeArray(new Object[] {mutationRecord}); ScriptRuntime.setBuiltinProtoAndParent(array, scope, TopLevel.Builtins.Array); jsEngine.callFunction(owningPage, function_, scope,