mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 967468 - Webconsole - autocompletion: Consider underscore and dollar as alphanumeric when determining a prefix filter to use. r=robcee
This commit is contained in:
parent
3fb7520283
commit
7cd640146c
@ -270,6 +270,7 @@ run-if = os == "mac"
|
||||
[browser_webconsole_expandable_timestamps.js]
|
||||
[browser_webconsole_autocomplete_in_debugger_stackframe.js]
|
||||
[browser_webconsole_autocomplete_popup_close_on_tab_switch.js]
|
||||
[browser_webconsole_autocomplete-properties-with-non-alphanumeric-names.js]
|
||||
[browser_console_hide_jsterm_when_devtools_chrome_enabled_false.js]
|
||||
[browser_webconsole_output_01.js]
|
||||
[browser_webconsole_output_02.js]
|
||||
|
@ -0,0 +1,42 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that properties starting with underscores or dollars can be
|
||||
// autocompleted (bug 967468).
|
||||
|
||||
function test() {
|
||||
const TEST_URI = "data:text/html;charset=utf8,test autocompletion with $ or _";
|
||||
Task.spawn(runner).then(finishTest);
|
||||
|
||||
function* runner() {
|
||||
function autocomplete(term) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
jsterm.setInputValue(term);
|
||||
jsterm.complete(jsterm.COMPLETE_HINT_ONLY, deferred.resolve);
|
||||
|
||||
yield deferred.promise;
|
||||
|
||||
ok(popup.itemCount > 0, "There's suggestions for '" + term + "'");
|
||||
}
|
||||
|
||||
yield addTab(TEST_URI);
|
||||
let { jsterm } = yield openConsole(tab);
|
||||
let popup = jsterm.autocompletePopup;
|
||||
|
||||
jsterm.execute("let testObject = {$$aaab: '', $$aaac: ''}");
|
||||
|
||||
// Should work with bug 967468.
|
||||
yield autocomplete("Object.__d");
|
||||
yield autocomplete("testObject.$$a");
|
||||
|
||||
// Here's when things go wrong in bug 967468.
|
||||
yield autocomplete("Object.__de");
|
||||
yield autocomplete("testObject.$$aa");
|
||||
}
|
||||
}
|
@ -4292,8 +4292,8 @@ JSTerm.prototype = {
|
||||
|
||||
if (this._autocompleteQuery && input.startsWith(this._autocompleteQuery)) {
|
||||
let filterBy = input;
|
||||
// Find the last non-alphanumeric if exists.
|
||||
let lastNonAlpha = input.match(/[^a-zA-Z0-9][a-zA-Z0-9]*$/);
|
||||
// Find the last non-alphanumeric other than _ or $ if it exists.
|
||||
let lastNonAlpha = input.match(/[^a-zA-Z0-9_$][a-zA-Z0-9_$]*$/);
|
||||
// If input contains non-alphanumerics, use the part after the last one
|
||||
// to filter the cache
|
||||
if (lastNonAlpha) {
|
||||
|
Loading…
Reference in New Issue
Block a user