зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to inbound. a=merge CLOSED TREE
This commit is contained in:
Коммит
011ea038cb
|
@ -641,8 +641,7 @@ NS_IMPL_NSIDOCUMENTOBSERVER_LOAD_STUB(DocAccessible)
|
|||
|
||||
void DocAccessible::AttributeWillChange(dom::Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aNewValue) {
|
||||
nsAtom* aAttribute, int32_t aModType) {
|
||||
Accessible* accessible = GetAccessible(aElement);
|
||||
if (!accessible) {
|
||||
if (aElement != mContent) return;
|
||||
|
|
|
@ -234,7 +234,7 @@ add_task(async function() {
|
|||
const expectedEventsAddon1 = [
|
||||
{
|
||||
...baseEventAddon1, method: "sideload_prompt",
|
||||
extra: {...expectedExtra, num_perms: "1", num_origins: "1"},
|
||||
extra: {...expectedExtra, num_strings: "2"},
|
||||
},
|
||||
{...baseEventAddon1, method: "uninstall"},
|
||||
];
|
||||
|
@ -253,7 +253,7 @@ add_task(async function() {
|
|||
const expectedEventsAddon2 = [
|
||||
{
|
||||
...baseEventAddon2, method: "sideload_prompt",
|
||||
extra: {...expectedExtra, num_perms: "0", num_origins: "1"},
|
||||
extra: {...expectedExtra, num_strings: "1"},
|
||||
},
|
||||
{...baseEventAddon2, method: "enable"},
|
||||
{...baseEventAddon2, method: "uninstall"},
|
||||
|
|
|
@ -151,6 +151,7 @@ async function backgroundUpdateTest(url, id, checkIconFn) {
|
|||
// Click the menu item
|
||||
tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:addons");
|
||||
popupPromise = promisePopupNotificationShown("addon-webext-permissions");
|
||||
|
||||
addons.children[0].click();
|
||||
|
||||
// Wait for about:addons to load
|
||||
|
@ -204,9 +205,11 @@ async function backgroundUpdateTest(url, id, checkIconFn) {
|
|||
updated_from: "app",
|
||||
};
|
||||
|
||||
// Expect the telemetry events to have num_strings set to 1, as only the origin permissions is going
|
||||
// to be listed in the permission prompt.
|
||||
Assert.deepEqual(updateEvents.filter(evt => evt.extra && evt.extra.step === "permissions_prompt"), [
|
||||
{method, object, extra: {...baseExtra, num_perms: "1", num_origins: "1"}},
|
||||
{method, object, extra: {...baseExtra, num_perms: "1", num_origins: "1"}},
|
||||
{method, object, extra: {...baseExtra, num_strings: "1"}},
|
||||
{method, object, extra: {...baseExtra, num_strings: "1"}},
|
||||
], "Got the expected permission_prompts events");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm", {});
|
||||
|
||||
AddonTestUtils.initMochitest(this);
|
||||
|
||||
hookExtensionsTelemetry();
|
||||
AddonTestUtils.hookAMTelemetryEvents();
|
||||
|
||||
const ID_PERMS = "update_perms@tests.mozilla.org";
|
||||
const ID_ORIGINS = "update_origins@tests.mozilla.org";
|
||||
|
||||
|
@ -30,8 +37,6 @@ add_task(async function setup() {
|
|||
});
|
||||
});
|
||||
|
||||
hookExtensionsTelemetry();
|
||||
|
||||
// Helper function to test an upgrade that should not show a prompt
|
||||
async function testNoPrompt(origUrl, id) {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
|
@ -72,6 +77,20 @@ async function testNoPrompt(origUrl, id) {
|
|||
|
||||
await addon.uninstall();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
// Test that the expected telemetry events have been recorded (and that they do not
|
||||
// include the permission_prompt event).
|
||||
const amEvents = AddonTestUtils.getAMTelemetryEvents();
|
||||
const updateEventsSteps = amEvents.filter(evt => {
|
||||
return evt.method === "update" && evt.extra && evt.extra.addon_id == id;
|
||||
}).map(evt => {
|
||||
return evt.extra.step;
|
||||
});
|
||||
|
||||
// Expect telemetry events related to a completed update with no permissions_prompt event.
|
||||
Assert.deepEqual(updateEventsSteps, [
|
||||
"started", "download_started", "download_completed", "completed",
|
||||
], "Got the steps from the collected telemetry events");
|
||||
}
|
||||
|
||||
// Test that an update that adds new non-promptable permissions is just
|
||||
|
|
|
@ -500,7 +500,9 @@ async function interactiveUpdateTest(autoUpdate, checkFn) {
|
|||
|
||||
let hasPermissionsExtras = collectedUpdateEvents.filter(evt => {
|
||||
return evt.extra.step === "permissions_prompt";
|
||||
}).every(evt => !!evt.extra.num_perms && !!evt.extra.num_origins);
|
||||
}).every(evt => {
|
||||
return Number.isInteger(parseInt(evt.extra.num_strings, 10));
|
||||
});
|
||||
|
||||
ok(hasPermissionsExtras,
|
||||
"Every 'permissions_prompt' update telemetry event should have the permissions extra vars");
|
||||
|
|
|
@ -9,6 +9,9 @@ const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.j
|
|||
const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const S100NS_FROM1601TO1970 = 0x19DB1DED53E8000;
|
||||
const S100NS_PER_MS = 10;
|
||||
|
||||
var ChromeMigrationUtils = {
|
||||
_extensionVersionDirectoryNames: {},
|
||||
|
||||
|
@ -270,4 +273,29 @@ var ChromeMigrationUtils = {
|
|||
this._extensionVersionDirectoryNames[path] = entries;
|
||||
return entries;
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert Chrome time format to Date object
|
||||
*
|
||||
* @param aTime
|
||||
* Chrome time
|
||||
* @return converted Date object
|
||||
* @note Google Chrome uses FILETIME / 10 as time.
|
||||
* FILETIME is based on same structure of Windows.
|
||||
*/
|
||||
chromeTimeToDate(aTime) {
|
||||
return new Date((aTime * S100NS_PER_MS - S100NS_FROM1601TO1970) / 10000);
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert Date object to Chrome time format
|
||||
*
|
||||
* @param aDate
|
||||
* Date object or integer equivalent
|
||||
* @return Chrome time
|
||||
* @note For details on Chrome time, see chromeTimeToDate.
|
||||
*/
|
||||
dateToChromeTime(aDate) {
|
||||
return (aDate * 10000 + S100NS_FROM1601TO1970) / S100NS_PER_MS;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const S100NS_FROM1601TO1970 = 0x19DB1DED53E8000;
|
||||
const S100NS_PER_MS = 10;
|
||||
|
||||
const AUTH_TYPE = {
|
||||
SCHEME_HTML: 0,
|
||||
SCHEME_BASIC: 1,
|
||||
|
@ -28,31 +25,6 @@ ChromeUtils.defineModuleGetter(this, "PlacesUtils",
|
|||
ChromeUtils.defineModuleGetter(this, "OSCrypto",
|
||||
"resource://gre/modules/OSCrypto.jsm");
|
||||
|
||||
/**
|
||||
* Convert Chrome time format to Date object
|
||||
*
|
||||
* @param aTime
|
||||
* Chrome time
|
||||
* @return converted Date object
|
||||
* @note Google Chrome uses FILETIME / 10 as time.
|
||||
* FILETIME is based on same structure of Windows.
|
||||
*/
|
||||
function chromeTimeToDate(aTime) {
|
||||
return new Date((aTime * S100NS_PER_MS - S100NS_FROM1601TO1970) / 10000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Date object to Chrome time format
|
||||
*
|
||||
* @param aDate
|
||||
* Date object or integer equivalent
|
||||
* @return Chrome time
|
||||
* @note For details on Chrome time, see chromeTimeToDate.
|
||||
*/
|
||||
function dateToChromeTime(aDate) {
|
||||
return (aDate * 10000 + S100NS_FROM1601TO1970) / S100NS_PER_MS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of chrome bookmark objects into one our own places code
|
||||
* understands.
|
||||
|
@ -264,7 +236,8 @@ async function GetHistoryResource(aProfileFolder) {
|
|||
|
||||
let query = "SELECT url, title, last_visit_time, typed_count FROM urls WHERE hidden = 0";
|
||||
if (MAX_AGE_IN_DAYS) {
|
||||
let maxAge = dateToChromeTime(Date.now() - MAX_AGE_IN_DAYS * 24 * 60 * 60 * 1000);
|
||||
let maxAge = ChromeMigrationUtils.dateToChromeTime(
|
||||
Date.now() - MAX_AGE_IN_DAYS * 24 * 60 * 60 * 1000);
|
||||
query += " AND last_visit_time > " + maxAge;
|
||||
}
|
||||
if (LIMIT) {
|
||||
|
@ -286,7 +259,8 @@ async function GetHistoryResource(aProfileFolder) {
|
|||
url: new URL(row.getResultByName("url")),
|
||||
visits: [{
|
||||
transition,
|
||||
date: chromeTimeToDate(row.getResultByName("last_visit_time")),
|
||||
date: ChromeMigrationUtils.chromeTimeToDate(
|
||||
row.getResultByName("last_visit_time")),
|
||||
}],
|
||||
});
|
||||
} catch (e) {
|
||||
|
@ -337,8 +311,8 @@ async function GetCookiesResource(aProfileFolder) {
|
|||
}
|
||||
|
||||
try {
|
||||
let expiresUtc =
|
||||
chromeTimeToDate(row.getResultByName("expires_utc")) / 1000;
|
||||
let expiresUtc = ChromeMigrationUtils.chromeTimeToDate(
|
||||
row.getResultByName("expires_utc")) / 1000;
|
||||
Services.cookies.add(host_key,
|
||||
row.getResultByName("path"),
|
||||
row.getResultByName("name"),
|
||||
|
@ -400,7 +374,8 @@ async function GetWindowsPasswordsResource(aProfileFolder) {
|
|||
httpRealm: null,
|
||||
usernameElement: row.getResultByName("username_element"),
|
||||
passwordElement: row.getResultByName("password_element"),
|
||||
timeCreated: chromeTimeToDate(row.getResultByName("date_created") + 0).getTime(),
|
||||
timeCreated: ChromeMigrationUtils.chromeTimeToDate(
|
||||
row.getResultByName("date_created") + 0).getTime(),
|
||||
timesUsed: row.getResultByName("times_used") + 0,
|
||||
};
|
||||
|
||||
|
|
|
@ -1023,6 +1023,17 @@ var MigrationUtils = Object.freeze({
|
|||
},
|
||||
|
||||
insertVisitsWrapper(pageInfos) {
|
||||
let now = new Date();
|
||||
// Ensure that none of the dates are in the future. If they are, rewrite
|
||||
// them to be now. This means we don't loose history entries, but they will
|
||||
// be valid for the history store.
|
||||
for (let pageInfo of pageInfos) {
|
||||
for (let visit of pageInfo.visits) {
|
||||
if (visit.date && visit.date > now) {
|
||||
visit.date = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._importQuantities.history += pageInfos.length;
|
||||
if (gKeepUndoData) {
|
||||
this._updateHistoryUndo(pageInfos);
|
||||
|
|
Двоичные данные
browser/components/migration/tests/unit/Library/Application Support/Google/Chrome/Default/HistoryMaster
Normal file
Двоичные данные
browser/components/migration/tests/unit/Library/Application Support/Google/Chrome/Default/HistoryMaster
Normal file
Двоичный файл не отображается.
|
@ -0,0 +1,156 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {ChromeMigrationUtils} =
|
||||
ChromeUtils.import("resource:///modules/ChromeMigrationUtils.jsm");
|
||||
|
||||
const SOURCE_PROFILE_DIR = "Library/Application Support/Google/Chrome/Default/";
|
||||
|
||||
const PROFILE = {
|
||||
id: "Default",
|
||||
name: "Person 1",
|
||||
};
|
||||
|
||||
/**
|
||||
* TEST_URLS reflects the data stored in '${SOURCE_PROFILE_DIR}HistoryMaster'.
|
||||
* The main object reflects the data in the 'urls' table. The visits property
|
||||
* reflects the associated data in the 'visits' table.
|
||||
*/
|
||||
const TEST_URLS = [{
|
||||
id: 1,
|
||||
url: "http://example.com/",
|
||||
title: "test",
|
||||
visit_count: 1,
|
||||
typed_count: 0,
|
||||
last_visit_time: 13193151310368000,
|
||||
hidden: 0,
|
||||
visits: [{
|
||||
id: 1,
|
||||
url: 1,
|
||||
visit_time: 13193151310368000,
|
||||
from_visit: 0,
|
||||
transition: 805306370,
|
||||
segment_id: 0,
|
||||
visit_duration: 10745006,
|
||||
incremented_omnibox_typed_score: 0,
|
||||
}],
|
||||
}, {
|
||||
id: 2,
|
||||
url: "http://invalid.com/",
|
||||
title: "test2",
|
||||
visit_count: 1,
|
||||
typed_count: 0,
|
||||
last_visit_time: 13193154948901000,
|
||||
hidden: 0,
|
||||
visits: [{
|
||||
id: 2,
|
||||
url: 2,
|
||||
visit_time: 13193154948901000,
|
||||
from_visit: 0,
|
||||
transition: 805306376,
|
||||
segment_id: 0,
|
||||
visit_duration: 6568270,
|
||||
incremented_omnibox_typed_score: 0,
|
||||
}],
|
||||
}];
|
||||
|
||||
async function setVisitTimes(time) {
|
||||
let loginDataFile = do_get_file(`${SOURCE_PROFILE_DIR}History`);
|
||||
let dbConn = await Sqlite.openConnection({ path: loginDataFile.path });
|
||||
|
||||
await dbConn.execute(`UPDATE urls SET last_visit_time = :last_visit_time`, {
|
||||
last_visit_time: time,
|
||||
});
|
||||
await dbConn.execute(`UPDATE visits SET visit_time = :visit_time`, {
|
||||
visit_time: time,
|
||||
});
|
||||
|
||||
await dbConn.close();
|
||||
}
|
||||
|
||||
function assertEntryMatches(entry, urlInfo, dateWasInFuture = false) {
|
||||
info(`Checking url: ${urlInfo.url}`);
|
||||
Assert.ok(entry, `Should have stored an entry`);
|
||||
|
||||
Assert.equal(entry.url, urlInfo.url, "Should have the correct URL");
|
||||
Assert.equal(entry.title, urlInfo.title, "Should have the correct title");
|
||||
Assert.equal(entry.visits.length, urlInfo.visits.length,
|
||||
"Should have the correct number of visits");
|
||||
|
||||
for (let index in urlInfo.visits) {
|
||||
Assert.equal(entry.visits[index].transition,
|
||||
PlacesUtils.history.TRANSITIONS.LINK,
|
||||
"Should have Link type transition");
|
||||
|
||||
if (dateWasInFuture) {
|
||||
Assert.lessOrEqual(entry.visits[index].date.getTime(), new Date().getTime(),
|
||||
"Should have moved the date to no later than the current date.");
|
||||
} else {
|
||||
Assert.equal(
|
||||
entry.visits[index].date.getTime(),
|
||||
ChromeMigrationUtils.chromeTimeToDate(urlInfo.visits[index].visit_time).getTime(),
|
||||
"Should have the correct date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupHistoryFile() {
|
||||
removeHistoryFile();
|
||||
let file = do_get_file(`${SOURCE_PROFILE_DIR}HistoryMaster`);
|
||||
file.copyTo(file.parent, "History");
|
||||
}
|
||||
|
||||
function removeHistoryFile() {
|
||||
let file = do_get_file(`${SOURCE_PROFILE_DIR}History`, true);
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {
|
||||
// It is ok if this doesn't exist.
|
||||
if (ex.result != Cr.NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
registerFakePath("ULibDir", do_get_file("Library/"));
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
await PlacesUtils.history.clear();
|
||||
removeHistoryFile();
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_import() {
|
||||
setupHistoryFile();
|
||||
await PlacesUtils.history.clear();
|
||||
|
||||
let migrator = await MigrationUtils.getMigrator("chrome");
|
||||
Assert.ok(await migrator.isSourceAvailable(), "Sanity check the source exists");
|
||||
|
||||
await promiseMigration(migrator, MigrationUtils.resourceTypes.HISTORY, PROFILE);
|
||||
|
||||
for (let urlInfo of TEST_URLS) {
|
||||
let entry = await PlacesUtils.history.fetch(urlInfo.url, {includeVisits: true});
|
||||
assertEntryMatches(entry, urlInfo);
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_import_future_date() {
|
||||
setupHistoryFile();
|
||||
await PlacesUtils.history.clear();
|
||||
const futureDate = new Date().getTime() + 6000 * 60 * 24;
|
||||
await setVisitTimes(ChromeMigrationUtils.dateToChromeTime(futureDate));
|
||||
|
||||
let migrator = await MigrationUtils.getMigrator("chrome");
|
||||
Assert.ok(await migrator.isSourceAvailable(), "Sanity check the source exists");
|
||||
|
||||
await promiseMigration(migrator, MigrationUtils.resourceTypes.HISTORY, PROFILE);
|
||||
|
||||
for (let urlInfo of TEST_URLS) {
|
||||
let entry = await PlacesUtils.history.fetch(urlInfo.url, {includeVisits: true});
|
||||
assertEntryMatches(entry, urlInfo, true);
|
||||
}
|
||||
});
|
|
@ -11,6 +11,8 @@ skip-if = os != "win"
|
|||
[test_Chrome_bookmarks.js]
|
||||
[test_Chrome_cookies.js]
|
||||
skip-if = os != "mac" # Relies on ULibDir
|
||||
[test_Chrome_history.js]
|
||||
skip-if = os != "mac" # Relies on ULibDir
|
||||
[test_Chrome_passwords.js]
|
||||
skip-if = os != "win"
|
||||
[test_ChromeMigrationUtils.js]
|
||||
|
|
|
@ -314,7 +314,7 @@ class UrlbarController {
|
|||
|
||||
const selectedResult = this.input.view.selectedResult;
|
||||
if (!selectedResult ||
|
||||
selectedResult.source != UrlbarUtils.MATCH_SOURCE.HISTORY) {
|
||||
selectedResult.source != UrlbarUtils.RESULT_SOURCE.HISTORY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,11 +96,11 @@ class ProviderOpenTabs extends UrlbarProvider {
|
|||
|
||||
/**
|
||||
* Returns the sources returned by this provider.
|
||||
* @returns {array} one or multiple types from UrlbarUtils.MATCH_SOURCE.*
|
||||
* @returns {array} one or multiple types from UrlbarUtils.RESULT_SOURCE.*
|
||||
*/
|
||||
get sources() {
|
||||
return [
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ class ProviderOpenTabs extends UrlbarProvider {
|
|||
return;
|
||||
}
|
||||
addCallback(this, new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS, {
|
||||
UrlbarUtils.RESULT_SOURCE.TABS, {
|
||||
url: row.getResultByName("url"),
|
||||
userContextId: row.getResultByName("userContextId"),
|
||||
}));
|
||||
|
|
|
@ -60,16 +60,16 @@ class ProviderUnifiedComplete extends UrlbarProvider {
|
|||
|
||||
/**
|
||||
* Returns the sources returned by this provider.
|
||||
* @returns {array} one or multiple types from UrlbarUtils.MATCH_SOURCE.*
|
||||
* @returns {array} one or multiple types from UrlbarUtils.RESULT_SOURCE.*
|
||||
*/
|
||||
get sources() {
|
||||
return [
|
||||
UrlbarUtils.MATCH_SOURCE.BOOKMARKS,
|
||||
UrlbarUtils.MATCH_SOURCE.HISTORY,
|
||||
UrlbarUtils.MATCH_SOURCE.SEARCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.MATCH_SOURCE.OTHER_LOCAL,
|
||||
UrlbarUtils.MATCH_SOURCE.OTHER_NETWORK,
|
||||
UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
|
||||
UrlbarUtils.RESULT_SOURCE.HISTORY,
|
||||
UrlbarUtils.RESULT_SOURCE.SEARCH,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL,
|
||||
UrlbarUtils.RESULT_SOURCE.OTHER_NETWORK,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
case "searchengine":
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.SEARCH,
|
||||
UrlbarUtils.MATCH_SOURCE.SEARCH,
|
||||
UrlbarUtils.RESULT_SOURCE.SEARCH,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
engine: [action.params.engineName, true],
|
||||
suggestion: [action.params.searchSuggestion, true],
|
||||
|
@ -237,7 +237,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
case "keyword":
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.KEYWORD,
|
||||
UrlbarUtils.MATCH_SOURCE.BOOKMARKS,
|
||||
UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
url: [action.params.url, true],
|
||||
keyword: [info.firstToken, true],
|
||||
|
@ -248,7 +248,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
case "extension":
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.OMNIBOX,
|
||||
UrlbarUtils.MATCH_SOURCE.OTHER_NETWORK,
|
||||
UrlbarUtils.RESULT_SOURCE.OTHER_NETWORK,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
title: [info.comment, true],
|
||||
content: [action.params.content, true],
|
||||
|
@ -259,7 +259,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
case "remotetab":
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.REMOTE_TAB,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
url: [action.params.url, true],
|
||||
title: [info.comment, true],
|
||||
|
@ -270,7 +270,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
case "switchtab":
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
url: [action.params.url, true],
|
||||
title: [info.comment, true],
|
||||
|
@ -281,7 +281,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
case "visiturl":
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.URL,
|
||||
UrlbarUtils.MATCH_SOURCE.OTHER_LOCAL,
|
||||
UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
title: [info.comment, true],
|
||||
url: [action.params.url, true],
|
||||
|
@ -297,7 +297,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
if (info.style.includes("priority-search")) {
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.SEARCH,
|
||||
UrlbarUtils.MATCH_SOURCE.SEARCH,
|
||||
UrlbarUtils.RESULT_SOURCE.SEARCH,
|
||||
...UrlbarResult.payloadAndSimpleHighlights(tokens, {
|
||||
engine: [info.comment, true],
|
||||
icon: [info.icon, false],
|
||||
|
@ -311,7 +311,7 @@ function makeUrlbarResult(tokens, info) {
|
|||
let comment = info.comment;
|
||||
let hasTags = info.style.includes("tag");
|
||||
if (info.style.includes("bookmark") || hasTags) {
|
||||
source = UrlbarUtils.MATCH_SOURCE.BOOKMARKS;
|
||||
source = UrlbarUtils.RESULT_SOURCE.BOOKMARKS;
|
||||
if (hasTags) {
|
||||
// Split title and tags.
|
||||
[comment, tags] = info.comment.split(TITLE_TAGS_SEPARATOR);
|
||||
|
@ -322,9 +322,9 @@ function makeUrlbarResult(tokens, info) {
|
|||
}).sort();
|
||||
}
|
||||
} else if (info.style.includes("preloaded-top-sites")) {
|
||||
source = UrlbarUtils.MATCH_SOURCE.OTHER_LOCAL;
|
||||
source = UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL;
|
||||
} else {
|
||||
source = UrlbarUtils.MATCH_SOURCE.HISTORY;
|
||||
source = UrlbarUtils.RESULT_SOURCE.HISTORY;
|
||||
}
|
||||
return new UrlbarResult(
|
||||
UrlbarUtils.RESULT_TYPE.URL,
|
||||
|
|
|
@ -200,7 +200,7 @@ class Query {
|
|||
* @param {object} controller
|
||||
* The controller to be notified
|
||||
* @param {object} muxer
|
||||
* The muxer to sort matches
|
||||
* The muxer to sort results
|
||||
* @param {object} providers
|
||||
* Map of all the providers by type and name
|
||||
*/
|
||||
|
@ -213,8 +213,8 @@ class Query {
|
|||
this.started = false;
|
||||
this.canceled = false;
|
||||
this.complete = false;
|
||||
// Array of acceptable MATCH_SOURCE values for this query. Providers not
|
||||
// returning any of these will be skipped, as well as matches not part of
|
||||
// Array of acceptable RESULT_SOURCE values for this query. Providers not
|
||||
// returning any of these will be skipped, as well as results not part of
|
||||
// this subset (Note we still expect the provider to do its own internal
|
||||
// filtering, our additional filtering will be for sanity).
|
||||
this.acceptableSources = [];
|
||||
|
@ -432,14 +432,14 @@ function getAcceptableMatchSources(context) {
|
|||
UrlbarTokenizer.TYPE.RESTRICT_SEARCH,
|
||||
].includes(t.type));
|
||||
let restrictTokenType = restrictToken ? restrictToken.type : undefined;
|
||||
for (let source of Object.values(UrlbarUtils.MATCH_SOURCE)) {
|
||||
for (let source of Object.values(UrlbarUtils.RESULT_SOURCE)) {
|
||||
// Skip sources that the context doesn't care about.
|
||||
if (context.sources && !context.sources.includes(source)) {
|
||||
continue;
|
||||
}
|
||||
// Check prefs and restriction tokens.
|
||||
switch (source) {
|
||||
case UrlbarUtils.MATCH_SOURCE.BOOKMARKS:
|
||||
case UrlbarUtils.RESULT_SOURCE.BOOKMARKS:
|
||||
if (UrlbarPrefs.get("suggest.bookmark") &&
|
||||
(!restrictTokenType ||
|
||||
restrictTokenType === UrlbarTokenizer.TYPE.RESTRICT_BOOKMARK ||
|
||||
|
@ -447,33 +447,33 @@ function getAcceptableMatchSources(context) {
|
|||
acceptedSources.push(source);
|
||||
}
|
||||
break;
|
||||
case UrlbarUtils.MATCH_SOURCE.HISTORY:
|
||||
case UrlbarUtils.RESULT_SOURCE.HISTORY:
|
||||
if (UrlbarPrefs.get("suggest.history") &&
|
||||
(!restrictTokenType ||
|
||||
restrictTokenType === UrlbarTokenizer.TYPE.RESTRICT_HISTORY)) {
|
||||
acceptedSources.push(source);
|
||||
}
|
||||
break;
|
||||
case UrlbarUtils.MATCH_SOURCE.SEARCH:
|
||||
case UrlbarUtils.RESULT_SOURCE.SEARCH:
|
||||
if (UrlbarPrefs.get("suggest.searches") &&
|
||||
(!restrictTokenType ||
|
||||
restrictTokenType === UrlbarTokenizer.TYPE.RESTRICT_SEARCH)) {
|
||||
acceptedSources.push(source);
|
||||
}
|
||||
break;
|
||||
case UrlbarUtils.MATCH_SOURCE.TABS:
|
||||
case UrlbarUtils.RESULT_SOURCE.TABS:
|
||||
if (UrlbarPrefs.get("suggest.openpage") &&
|
||||
(!restrictTokenType ||
|
||||
restrictTokenType === UrlbarTokenizer.TYPE.RESTRICT_OPENPAGE)) {
|
||||
acceptedSources.push(source);
|
||||
}
|
||||
break;
|
||||
case UrlbarUtils.MATCH_SOURCE.OTHER_NETWORK:
|
||||
case UrlbarUtils.RESULT_SOURCE.OTHER_NETWORK:
|
||||
if (!context.isPrivate && !restrictTokenType) {
|
||||
acceptedSources.push(source);
|
||||
}
|
||||
break;
|
||||
case UrlbarUtils.MATCH_SOURCE.OTHER_LOCAL:
|
||||
case UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL:
|
||||
default:
|
||||
if (!restrictTokenType) {
|
||||
acceptedSources.push(source);
|
||||
|
|
|
@ -26,7 +26,7 @@ class UrlbarResult {
|
|||
/**
|
||||
* Creates a result.
|
||||
* @param {integer} resultType one of UrlbarUtils.RESULT_TYPE.* values
|
||||
* @param {integer} matchSource one of UrlbarUtils.MATCH_SOURCE.* values
|
||||
* @param {integer} resultSource one of UrlbarUtils.RESULT_SOURCE.* values
|
||||
* @param {object} payload data for this result. A payload should always
|
||||
* contain a way to extract a final url to visit. The url getter
|
||||
* should have a case for each of the types.
|
||||
|
@ -36,7 +36,7 @@ class UrlbarResult {
|
|||
* length] tuples. Each tuple indicates a substring in the correspoding
|
||||
* payload property.
|
||||
*/
|
||||
constructor(resultType, matchSource, payload, payloadHighlights = {}) {
|
||||
constructor(resultType, resultSource, payload, payloadHighlights = {}) {
|
||||
// Type describes the payload and visualization that should be used for
|
||||
// this result.
|
||||
if (!Object.values(UrlbarUtils.RESULT_TYPE).includes(resultType)) {
|
||||
|
@ -44,12 +44,12 @@ class UrlbarResult {
|
|||
}
|
||||
this.type = resultType;
|
||||
|
||||
// Source describes which data has been used to derive this match. In case
|
||||
// Source describes which data has been used to derive this result. In case
|
||||
// multiple sources are involved, use the more privacy restricted.
|
||||
if (!Object.values(UrlbarUtils.MATCH_SOURCE).includes(matchSource)) {
|
||||
throw new Error("Invalid match source");
|
||||
if (!Object.values(UrlbarUtils.RESULT_SOURCE).includes(resultSource)) {
|
||||
throw new Error("Invalid result source");
|
||||
}
|
||||
this.source = matchSource;
|
||||
this.source = resultSource;
|
||||
|
||||
// May be used to indicate an heuristic result. Heuristic results can bypass
|
||||
// source filters in the ProvidersManager, that otherwise may skip them.
|
||||
|
|
|
@ -88,11 +88,11 @@ var UrlbarUtils = {
|
|||
REMOTE_TAB: 6,
|
||||
},
|
||||
|
||||
// This defines the source of matches returned by a provider. Each provider
|
||||
// can return matches from more than one source. This is used by the
|
||||
// This defines the source of results returned by a provider. Each provider
|
||||
// can return results from more than one source. This is used by the
|
||||
// ProvidersManager to decide which providers must be queried and which
|
||||
// matches can be returned.
|
||||
MATCH_SOURCE: {
|
||||
// results can be returned.
|
||||
RESULT_SOURCE: {
|
||||
BOOKMARKS: 1,
|
||||
HISTORY: 2,
|
||||
SEARCH: 3,
|
||||
|
@ -417,7 +417,7 @@ class UrlbarProvider {
|
|||
throw new Error("Trying to access the base class, must be overridden");
|
||||
}
|
||||
/**
|
||||
* List of UrlbarUtils.MATCH_SOURCE, representing the data sources used by
|
||||
* List of UrlbarUtils.RESULT_SOURCE, representing the data sources used by
|
||||
* the provider.
|
||||
* @abstract
|
||||
*/
|
||||
|
|
|
@ -260,9 +260,9 @@ class UrlbarView {
|
|||
item.className = "urlbarView-row";
|
||||
item.setAttribute("resultIndex", resultIndex);
|
||||
|
||||
if (result.source == UrlbarUtils.MATCH_SOURCE.TABS) {
|
||||
if (result.source == UrlbarUtils.RESULT_SOURCE.TABS) {
|
||||
item.setAttribute("type", "tab");
|
||||
} else if (result.source == UrlbarUtils.MATCH_SOURCE.BOOKMARKS) {
|
||||
} else if (result.source == UrlbarUtils.RESULT_SOURCE.BOOKMARKS) {
|
||||
item.setAttribute("type", "bookmark");
|
||||
}
|
||||
|
||||
|
|
|
@ -10,16 +10,12 @@ support-files =
|
|||
head.js
|
||||
head-common.js
|
||||
|
||||
[browser_bug562649.js]
|
||||
support-files = file_bug562649.html
|
||||
[browser_bug623155.js]
|
||||
support-files =
|
||||
redirect_bug623155.sjs
|
||||
[browser_bug783614.js]
|
||||
[browser_bug1025195_switchToTabHavingURI_aOpenParams.js]
|
||||
[browser_locationBarExternalLoad.js]
|
||||
[browser_moz_action_link.js]
|
||||
[browser_populateAfterPushState.js]
|
||||
[browser_redirect_error.js]
|
||||
support-files = redirect_error.sjs
|
||||
[browser_switchToTabHavingURI_aOpenParams.js]
|
||||
[browser_urlbar_blanking.js]
|
||||
support-files =
|
||||
file_blank_but_not_blank.html
|
||||
|
@ -40,6 +36,7 @@ support-files =
|
|||
subsuite = clipboard
|
||||
support-files =
|
||||
authenticate.sjs
|
||||
[browser_urlbarCutting.js]
|
||||
[browser_urlbarEnter.js]
|
||||
[browser_urlbarFocusedCmdK.js]
|
||||
[browser_urlbarHashChangeProxyState.js]
|
||||
|
@ -61,6 +58,8 @@ support-files =
|
|||
[browser_URLBarSetURI.js]
|
||||
skip-if = (os == "linux" || os == "mac") && debug # bug 970052, bug 970053
|
||||
[browser_urlbarUpdateForDomainCompletion.js]
|
||||
[browser_userTypedValue.js]
|
||||
support-files = file_userTypedValue.html
|
||||
[browser_wyciwyg_urlbarCopying.js]
|
||||
subsuite = clipboard
|
||||
support-files =
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
const TEST_PATH = getRootDirectory(gTestPath)
|
||||
.replace("chrome://mochitests/content", "http://example.com");
|
||||
const REDIRECT_FROM = `${TEST_PATH}redirect_bug623155.sjs`;
|
||||
const REDIRECT_FROM = `${TEST_PATH}redirect_error.sjs`;
|
||||
|
||||
const REDIRECT_TO = "https://www.bank1.com/"; // Bad-cert host.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
function test() {
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
|
||||
const URI = TEST_PATH + "file_bug562649.html";
|
||||
const URI = TEST_PATH + "file_userTypedValue.html";
|
||||
window.browserDOMWindow.openURI(makeURI(URI),
|
||||
null,
|
||||
Ci.nsIBrowserDOMWindow.OPEN_NEWTAB,
|
|
@ -30,25 +30,23 @@ skip-if = verify
|
|||
[browser_autocomplete_readline_navigation.js]
|
||||
skip-if = os != "mac" # Mac only feature
|
||||
[browser_autocomplete_tag_star_visibility.js]
|
||||
[browser_bug1104165-switchtab-decodeuri.js]
|
||||
[browser_bug1003461-switchtab-override.js]
|
||||
skip-if = (verify && debug && (os == 'win'))
|
||||
[browser_bug1024133-switchtab-override-keynav.js]
|
||||
[browser_bug1070778.js]
|
||||
[browser_bug1225194-remotetab.js]
|
||||
[browser_bug304198.js]
|
||||
[browser_bug556061.js]
|
||||
subsuite = clipboard
|
||||
[browser_canonizeURL.js]
|
||||
[browser_dragdropURL.js]
|
||||
[browser_keyword_select_and_type.js]
|
||||
[browser_locationBarCommand.js]
|
||||
[browser_new_tab_urlbar_reset.js]
|
||||
[browser_pasteAndGo.js]
|
||||
subsuite = clipboard
|
||||
[../browser/browser_populateAfterPushState.js]
|
||||
[browser_remotetab.js]
|
||||
[browser_removeUnsafeProtocolsFromURLBarPaste.js]
|
||||
subsuite = clipboard
|
||||
[browser_search_favicon.js]
|
||||
[browser_switchtab_copy.js]
|
||||
subsuite = clipboard
|
||||
[browser_switchtab_decodeuri.js]
|
||||
[browser_switchtab_override_keynav.js]
|
||||
[browser_switchtab_override.js]
|
||||
skip-if = (verify && debug && (os == 'win'))
|
||||
[browser_tabMatchesInAwesomebar.js]
|
||||
support-files =
|
||||
../browser/moz.png
|
||||
|
@ -108,6 +106,8 @@ support-files =
|
|||
support-files =
|
||||
../browser/searchSuggestionEngineSlow.xml
|
||||
../browser/searchSuggestionEngine.sjs
|
||||
[browser_urlbarValueOnTabSwitch.js]
|
||||
|
||||
|
||||
# These are tests that are already running with QuantumBar, but we want to run them
|
||||
# against both the legacy urlbar and the new QuantumBar. The references in this
|
||||
|
@ -115,19 +115,17 @@ support-files =
|
|||
|
||||
[../browser/browser_URLBarSetURI.js]
|
||||
skip-if = (os == "linux" || os == "mac") && debug # bug 970052, bug 970053
|
||||
[../browser/browser_bug1025195_switchToTabHavingURI_aOpenParams.js]
|
||||
[../browser/browser_bug562649.js]
|
||||
support-files = ../browser/file_bug562649.html
|
||||
[../browser/browser_bug623155.js]
|
||||
support-files =
|
||||
../browser/redirect_bug623155.sjs
|
||||
[../browser/browser_bug783614.js]
|
||||
[../browser/browser_locationBarExternalLoad.js]
|
||||
[../browser/browser_moz_action_link.js]
|
||||
[../browser/browser_populateAfterPushState.js]
|
||||
[../browser/browser_redirect_error.js]
|
||||
support-files = ../browser/redirect_error.sjs
|
||||
[../browser/browser_switchToTabHavingURI_aOpenParams.js]
|
||||
[../browser/browser_urlbarCopying.js]
|
||||
subsuite = clipboard
|
||||
support-files =
|
||||
../browser/authenticate.sjs
|
||||
[../browser/browser_urlbarCutting.js]
|
||||
[../browser/browser_urlbar_blanking.js]
|
||||
support-files =
|
||||
../browser/file_blank_but_not_blank.html
|
||||
|
@ -154,6 +152,8 @@ support-files =
|
|||
[../browser/browser_urlbar_speculative_connect_not_with_client_cert.js]
|
||||
[../browser/browser_urlbar_remoteness_switch.js]
|
||||
run-if = e10s
|
||||
[../browser/browser_userTypedValue.js]
|
||||
support-files = ../browser/file_userTypedValue.html
|
||||
[../browser/browser_wyciwyg_urlbarCopying.js]
|
||||
subsuite = clipboard
|
||||
support-files =
|
||||
|
|
|
@ -34,7 +34,7 @@ add_task(function losslessDecode() {
|
|||
let url = "http://" + urlNoScheme;
|
||||
if (Services.prefs.getBoolPref("browser.urlbar.quantumbar", true)) {
|
||||
const result = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url });
|
||||
gURLBar.setValueFromResult(result);
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,7 @@ const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.j
|
|||
|
||||
const TEST_URL = "http://example.com";
|
||||
const match = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: TEST_URL });
|
||||
let controller;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
const TEST_URL = "http://example.com";
|
||||
const MATCH = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: TEST_URL });
|
||||
const TELEMETRY_1ST_RESULT = "PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS";
|
||||
const TELEMETRY_6_FIRST_RESULTS = "PLACES_AUTOCOMPLETE_6_FIRST_RESULTS_TIME_MS";
|
||||
|
@ -34,7 +34,7 @@ class DelayedProvider extends UrlbarProvider {
|
|||
return UrlbarUtils.PROVIDER_TYPE.PROFILE;
|
||||
}
|
||||
get sources() {
|
||||
return [UrlbarUtils.MATCH_SOURCE.TABS];
|
||||
return [UrlbarUtils.RESULT_SOURCE.TABS];
|
||||
}
|
||||
async startQuery(context, add) {
|
||||
Assert.ok(context, "context is passed-in");
|
||||
|
@ -157,7 +157,7 @@ add_task(async function test_n_autocomplete_results() {
|
|||
resultsPromise = promiseControllerNotification(controller, "onQueryResults");
|
||||
provider.addResults([
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: TEST_URL + "/i" }),
|
||||
]);
|
||||
await resultsPromise;
|
||||
|
@ -179,7 +179,7 @@ add_task(async function test_n_autocomplete_results() {
|
|||
resultsPromise = promiseControllerNotification(controller, "onQueryResults");
|
||||
provider.addResults([
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: TEST_URL + "/6" }),
|
||||
]);
|
||||
await resultsPromise;
|
||||
|
|
|
@ -24,13 +24,13 @@ add_task(async function test_muxer() {
|
|||
|
||||
let matches = [
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: "http://mozilla.org/tab/" }),
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.URL,
|
||||
UrlbarUtils.MATCH_SOURCE.BOOKMARKS,
|
||||
UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
|
||||
{ url: "http://mozilla.org/bookmark/" }),
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.URL,
|
||||
UrlbarUtils.MATCH_SOURCE.HISTORY,
|
||||
UrlbarUtils.RESULT_SOURCE.HISTORY,
|
||||
{ url: "http://mozilla.org/history/" }),
|
||||
];
|
||||
|
||||
|
@ -52,13 +52,13 @@ add_task(async function test_muxer() {
|
|||
}
|
||||
sort(queryContext) {
|
||||
queryContext.results.sort((a, b) => {
|
||||
if (b.source == UrlbarUtils.MATCH_SOURCE.TABS) {
|
||||
if (b.source == UrlbarUtils.RESULT_SOURCE.TABS) {
|
||||
return -1;
|
||||
}
|
||||
if (b.source == UrlbarUtils.MATCH_SOURCE.BOOKMARKS) {
|
||||
if (b.source == UrlbarUtils.RESULT_SOURCE.BOOKMARKS) {
|
||||
return 1;
|
||||
}
|
||||
return a.source == UrlbarUtils.MATCH_SOURCE.BOOKMARKS ? -1 : 1;
|
||||
return a.source == UrlbarUtils.RESULT_SOURCE.BOOKMARKS ? -1 : 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ add_task(async function test_providers() {
|
|||
"Should throw with invalid cancelQuery");
|
||||
|
||||
let match = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: "http://mozilla.org/foo/" });
|
||||
|
||||
let providerName = registerBasicTestProvider([match]);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
add_task(async function test_filtering() {
|
||||
let match = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: "http://mozilla.org/foo/" });
|
||||
let providerName = registerBasicTestProvider([match]);
|
||||
let context = createContext(undefined, {providers: [providerName]});
|
||||
|
@ -30,7 +30,7 @@ add_task(async function test_filtering() {
|
|||
let matches = [
|
||||
match,
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.HISTORY,
|
||||
UrlbarUtils.RESULT_SOURCE.HISTORY,
|
||||
{ url: "http://mozilla.org/foo/" }),
|
||||
];
|
||||
providerName = registerBasicTestProvider(matches);
|
||||
|
@ -68,10 +68,10 @@ add_task(async function test_filter_javascript() {
|
|||
},
|
||||
});
|
||||
let match = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: "http://mozilla.org/foo/" });
|
||||
let jsMatch = new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.HISTORY,
|
||||
UrlbarUtils.RESULT_SOURCE.HISTORY,
|
||||
{ url: "javascript:foo" });
|
||||
let providerName = registerBasicTestProvider([match, jsMatch]);
|
||||
let context = createContext(undefined, {providers: [providerName]});
|
||||
|
@ -111,10 +111,10 @@ add_task(async function test_filter_sources() {
|
|||
|
||||
let goodMatches = [
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: "http://mozilla.org/foo/" }),
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.URL,
|
||||
UrlbarUtils.MATCH_SOURCE.HISTORY,
|
||||
UrlbarUtils.RESULT_SOURCE.HISTORY,
|
||||
{ url: "http://mozilla.org/foo/" }),
|
||||
];
|
||||
/**
|
||||
|
@ -129,8 +129,8 @@ add_task(async function test_filter_sources() {
|
|||
}
|
||||
get sources() {
|
||||
return [
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.MATCH_SOURCE.HISTORY,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.HISTORY,
|
||||
];
|
||||
}
|
||||
async startQuery(context, add) {
|
||||
|
@ -145,7 +145,7 @@ add_task(async function test_filter_sources() {
|
|||
|
||||
let badMatches = [
|
||||
new UrlbarResult(UrlbarUtils.RESULT_TYPE.URL,
|
||||
UrlbarUtils.MATCH_SOURCE.BOOKMARKS,
|
||||
UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
|
||||
{ url: "http://mozilla.org/foo/" }),
|
||||
];
|
||||
|
||||
|
@ -160,7 +160,7 @@ add_task(async function test_filter_sources() {
|
|||
return UrlbarUtils.PROVIDER_TYPE.PROFILE;
|
||||
}
|
||||
get sources() {
|
||||
return [UrlbarUtils.MATCH_SOURCE.BOOKMARKS];
|
||||
return [UrlbarUtils.RESULT_SOURCE.BOOKMARKS];
|
||||
}
|
||||
async startQuery(context, add) {
|
||||
Assert.ok(false, "Provider should no be invoked");
|
||||
|
@ -174,7 +174,7 @@ add_task(async function test_filter_sources() {
|
|||
UrlbarProvidersManager.registerProvider(new NoInvokeProvider());
|
||||
|
||||
let context = createContext(undefined, {
|
||||
sources: [UrlbarUtils.MATCH_SOURCE.TABS],
|
||||
sources: [UrlbarUtils.RESULT_SOURCE.TABS],
|
||||
providers: ["GoodProvider", "BadProvider"],
|
||||
});
|
||||
|
||||
|
@ -183,6 +183,6 @@ add_task(async function test_filter_sources() {
|
|||
await controller.startQuery(context, controller);
|
||||
await promise;
|
||||
Assert.deepEqual(context.results.length, 1, "Should find only one match");
|
||||
Assert.deepEqual(context.results[0].source, UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
Assert.deepEqual(context.results[0].source, UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
"Should find only a tab match");
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ add_task(async function test_maxResults() {
|
|||
let matches = [];
|
||||
for (let i = 0; i < MATCHES_LENGTH; i++) {
|
||||
matches.push(new UrlbarResult(UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
|
||||
UrlbarUtils.MATCH_SOURCE.TABS,
|
||||
UrlbarUtils.RESULT_SOURCE.TABS,
|
||||
{ url: `http://mozilla.org/foo/${i}` }));
|
||||
}
|
||||
let providerName = registerBasicTestProvider(matches);
|
||||
|
|
|
@ -72,7 +72,7 @@ It is augmented as it progresses through the system, with various information:
|
|||
providers; // {array} List of registered provider names. Providers can be
|
||||
// registered through the UrlbarProvidersManager.
|
||||
sources; // {array} If provided is the list of sources, as defined by
|
||||
// MATCH_SOURCE.*, that can be returned by the model.
|
||||
// RESULT_SOURCE.*, that can be returned by the model.
|
||||
|
||||
// Properties added by the Model.
|
||||
autofillValue; // {string} the text value that should be autofilled in the
|
||||
|
@ -173,7 +173,7 @@ class UrlbarProvider {
|
|||
throw new Error("Trying to access the base class, must be overridden");
|
||||
}
|
||||
/**
|
||||
* List of UrlbarUtils.MATCH_SOURCE, representing the data sources used by
|
||||
* List of UrlbarUtils.RESULT_SOURCE, representing the data sources used by
|
||||
* the provider.
|
||||
* @abstract
|
||||
*/
|
||||
|
@ -371,7 +371,7 @@ properties, supported by all of the results.
|
|||
constructor(resultType, payload);
|
||||
|
||||
type: {integer} One of UrlbarUtils.RESULT_TYPE.
|
||||
source: {integer} One of UrlbarUtils.MATCH_SOURCE.
|
||||
source: {integer} One of UrlbarUtils.RESULT_SOURCE.
|
||||
title: {string} A title that may be used as a label for this result.
|
||||
icon: {string} Url of an icon for this result.
|
||||
payload: {object} Object containing properties for the specific RESULT_TYPE.
|
||||
|
|
|
@ -129,10 +129,7 @@ var ExtensionsUI = {
|
|||
});
|
||||
|
||||
AMTelemetry.recordManageEvent(addon, "sideload_prompt", {
|
||||
num_perms: addon.userPermissions && addon.userPermissions.permissions ?
|
||||
addon.userPermissions.permissions.length : 0,
|
||||
num_origins: addon.userPermissions && addon.userPermissions.origins ?
|
||||
addon.userPermissions.origins.length : 0,
|
||||
num_strings: strings.msgs.length,
|
||||
});
|
||||
|
||||
this.showAddonsManager(browser, strings, addon.iconURL, "sideload")
|
||||
|
@ -145,6 +142,11 @@ var ExtensionsUI = {
|
|||
},
|
||||
|
||||
showUpdate(browser, info) {
|
||||
AMTelemetry.recordInstallEvent(info.install, {
|
||||
step: "permissions_prompt",
|
||||
num_strings: info.strings.msgs.length,
|
||||
});
|
||||
|
||||
this.showAddonsManager(browser, info.strings, info.addon.iconURL, "update")
|
||||
.then(answer => {
|
||||
if (answer) {
|
||||
|
@ -202,6 +204,17 @@ var ExtensionsUI = {
|
|||
histkey = "installWeb";
|
||||
}
|
||||
|
||||
if (info.type == "sideload") {
|
||||
AMTelemetry.recordManageEvent(info.addon, "sideload_prompt", {
|
||||
num_strings: strings.msgs.length,
|
||||
});
|
||||
} else {
|
||||
AMTelemetry.recordInstallEvent(info.install, {
|
||||
step: "permissions_prompt",
|
||||
num_strings: strings.msgs.length,
|
||||
});
|
||||
}
|
||||
|
||||
this.showPermissionsPrompt(browser, strings, icon, histkey)
|
||||
.then(answer => {
|
||||
if (answer) {
|
||||
|
@ -223,6 +236,8 @@ var ExtensionsUI = {
|
|||
|
||||
let update = {
|
||||
strings,
|
||||
permissions: info.permissions,
|
||||
install: info.install,
|
||||
addon: info.addon,
|
||||
resolve: info.resolve,
|
||||
reject: info.reject,
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
|
||||
/* Override theme colors since the picker uses extra colors that
|
||||
themes cannot set */
|
||||
#DateTimePickerPanel[active="true"] {
|
||||
#DateTimePickerPanel {
|
||||
--arrowpanel-background: var(--default-arrowpanel-background);
|
||||
--arrowpanel-color: var(--default-arrowpanel-color);
|
||||
--arrowpanel-border-color: var(--default-arrowpanel-border-color);
|
||||
|
|
|
@ -611,7 +611,6 @@ toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton
|
|||
}
|
||||
|
||||
#appMenu-tp-category {
|
||||
color: var(--panel-disabled-color);
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ def llvm_config_paths(host):
|
|||
if host.kernel == 'Darwin':
|
||||
brew = find_program('brew')
|
||||
if brew:
|
||||
brew_config = check_cmd_output([brew, 'config']).strip()
|
||||
brew_config = check_cmd_output(brew, 'config').strip()
|
||||
|
||||
for line in brew_config.splitlines():
|
||||
if line.startswith('HOMEBREW_PREFIX'):
|
||||
|
|
|
@ -280,18 +280,18 @@ option(env='DIA_SDK_PATH', nargs=1,
|
|||
@depends(vc_path, 'DIA_SDK_PATH')
|
||||
@checking('for the Debug Interface Access SDK', lambda x: x or 'not found')
|
||||
@imports('os')
|
||||
@imports(_from='os.path', _import='isdir')
|
||||
def dia_sdk_dir(vc_path, dia_sdk_path):
|
||||
if dia_sdk_path:
|
||||
return os.path.normpath(dia_sdk_path[0])
|
||||
path = os.path.normpath(dia_sdk_path[0])
|
||||
|
||||
if vc_path:
|
||||
elif vc_path:
|
||||
# This would be easier if we had the installationPath that
|
||||
# get_vc_paths works with, since 'DIA SDK' is relative to that.
|
||||
path = os.path.normpath(os.path.join(
|
||||
vc_path, r'..\..\..\..\DIA SDK'))
|
||||
if isdir(path):
|
||||
return path
|
||||
|
||||
if os.path.exists(os.path.join(path, 'include', 'dia2.h')):
|
||||
return path
|
||||
|
||||
|
||||
@depends(vc_path, valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir)
|
||||
|
@ -333,20 +333,13 @@ set_config('INCLUDE', include_path)
|
|||
|
||||
|
||||
@template
|
||||
def lib_path_for(host_or_target):
|
||||
@depends(host_or_target, dependable(host_or_target is host), vc_path,
|
||||
valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir)
|
||||
@imports('os')
|
||||
def lib_path(target, is_host, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir):
|
||||
if not vc_path:
|
||||
def dia_sdk_subdir(host_or_target, subdir):
|
||||
@depends(dia_sdk_dir, host_or_target, dependable(subdir))
|
||||
def dia_sdk_subdir(dia_sdk_dir, target, subdir):
|
||||
if not dia_sdk_dir:
|
||||
return
|
||||
sdk_target = {
|
||||
'x86': 'x86',
|
||||
'x86_64': 'x64',
|
||||
'arm': 'arm',
|
||||
'aarch64': 'arm64',
|
||||
}.get(target.cpu)
|
||||
|
||||
# For some reason the DIA SDK still uses the old-style targets
|
||||
# even in a newer MSVC.
|
||||
old_target = {
|
||||
'x86': '',
|
||||
'x86_64': 'amd64',
|
||||
|
@ -360,6 +353,42 @@ def lib_path_for(host_or_target):
|
|||
# interpret as a "string continues on next line" indicator, use variable
|
||||
# args.
|
||||
old_target = (old_target,) if old_target else ()
|
||||
return os.path.join(dia_sdk_dir, subdir, *old_target)
|
||||
|
||||
return dia_sdk_subdir
|
||||
|
||||
|
||||
# XXX: remove after bug 1523201
|
||||
js_option(env='WIN_DIA_SDK_BIN_DIR', nargs=1, help='Path to the DIA DLLs')
|
||||
|
||||
|
||||
@depends('WIN_DIA_SDK_BIN_DIR', dia_sdk_subdir(host, 'bin'))
|
||||
@imports('os')
|
||||
def dia_sdk_bin_dir(from_env, guessed):
|
||||
if from_env:
|
||||
if not os.path.isdir(from_env[0]):
|
||||
die('Invalid Windows DIA SDK directory: {}'.format(from_env))
|
||||
return from_env[0]
|
||||
return guessed
|
||||
|
||||
|
||||
set_config('WIN_DIA_SDK_BIN_DIR', dia_sdk_bin_dir)
|
||||
|
||||
|
||||
@template
|
||||
def lib_path_for(host_or_target):
|
||||
@depends(host_or_target, dependable(host_or_target is host), vc_path,
|
||||
valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_subdir(host_or_target, 'lib'))
|
||||
@imports('os')
|
||||
def lib_path(target, is_host, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_lib_dir):
|
||||
if not vc_path:
|
||||
return
|
||||
sdk_target = {
|
||||
'x86': 'x86',
|
||||
'x86_64': 'x64',
|
||||
'arm': 'arm',
|
||||
'aarch64': 'arm64',
|
||||
}.get(target.cpu)
|
||||
|
||||
# MSVC2017 switched to use the same target naming as the sdk.
|
||||
atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', sdk_target)
|
||||
|
@ -377,10 +406,8 @@ def lib_path_for(host_or_target):
|
|||
os.path.join(windows_sdk_dir.lib, 'um', sdk_target),
|
||||
os.path.join(ucrt_sdk_dir.lib, 'ucrt', sdk_target),
|
||||
))
|
||||
if dia_sdk_dir:
|
||||
# For some reason the DIA SDK still uses the old-style targets
|
||||
# even in a newer MSVC.
|
||||
libs.append(os.path.join(dia_sdk_dir, 'lib', *old_target))
|
||||
if dia_sdk_lib_dir:
|
||||
libs.append(dia_sdk_lib_dir)
|
||||
return libs
|
||||
|
||||
return lib_path
|
||||
|
|
|
@ -10,13 +10,10 @@ if [ -d "${VSPATH}" ]; then
|
|||
export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT"
|
||||
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
|
||||
export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
|
||||
export DIA_SDK_PATH="${VSPATH}/DIA SDK"
|
||||
export VC_PATH="${VSPATH}/VC"
|
||||
|
||||
win_sdk_version="10.0.17134.0"
|
||||
export PATH="${VSPATH}/VC/bin/Hostx86/x86:${VSPATH}/VC/bin/Hostx64/x86:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/SDK/bin/${win_sdk_version}/x64:${WIN_DIA_SDK_BIN_DIR}:${PATH}"
|
||||
export PATH="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${PATH}"
|
||||
|
||||
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/${win_sdk_version}/ucrt:${VSPATH}/SDK/Include/${win_sdk_version}/shared:${VSPATH}/SDK/Include/${win_sdk_version}/um:${VSPATH}/SDK/Include/${win_sdk_version}/winrt:${VSPATH}/DIA SDK/include"
|
||||
export LIB="${VSPATH}/VC/lib/x86:${VSPATH}/VC/atlmfc/lib/x86:${VSPATH}/SDK/Lib/${win_sdk_version}/ucrt/x86:${VSPATH}/SDK/Lib/${win_sdk_version}/um/x86:${VSPATH}/DIA SDK/lib"
|
||||
|
||||
export WIN64_LINK="${VSPATH}/VC/bin/Hostx64/x64/link.exe"
|
||||
export WIN64_LIB="${VSPATH}/VC/lib/x64:${VSPATH}/VC/atlmfc/lib/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/ucrt/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/um/x64:${VSPATH}/DIA SDK/lib/amd64"
|
||||
|
|
|
@ -9,29 +9,11 @@ if [ -d "${VSPATH}" ]; then
|
|||
export WINDOWSSDKDIR="${VSWINPATH}/SDK"
|
||||
export WIN32_REDIST_DIR=${VSPATH}/VC/redist/arm64/Microsoft.VC141.CRT
|
||||
export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
|
||||
export DIA_SDK_PATH="${VSPATH}/DIA SDK"
|
||||
export VC_PATH="${VSPATH}/VC"
|
||||
|
||||
win_sdk_version="10.0.17134.0"
|
||||
|
||||
# Need to run x86-64 host binaries.
|
||||
export PATH="${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/SDK/bin/${win_sdk_version}/x64:${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${WIN_DIA_SDK_BIN_DIR}:${PATH}"
|
||||
|
||||
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/${win_sdk_version}/ucrt:${VSPATH}/SDK/Include/${win_sdk_version}/shared:${VSPATH}/SDK/Include/${win_sdk_version}/um:${VSPATH}/SDK/Include/${win_sdk_version}/winrt:${VSPATH}/DIA SDK/include"
|
||||
export LIB="${VSPATH}/VC/lib/arm64:${VSPATH}/VC/atlmfc/lib/arm64:${VSPATH}/SDK/Lib/${win_sdk_version}/ucrt/arm64:${VSPATH}/SDK/Lib/${win_sdk_version}/um/arm64:${VSPATH}/DIA SDK/lib/amd64"
|
||||
|
||||
# We need to declare host and target tools separately.
|
||||
arm_bin="${VSPATH}/VC/bin/Hostx64/arm64"
|
||||
export AS="${arm_bin}/armasm64.exe"
|
||||
|
||||
# We provided LIB, above, but we also need to provide HOST_LDFLAGS so host
|
||||
# links are not completely confused. LIBPATH wants its argument with
|
||||
# Windows-style drives.
|
||||
libs=""
|
||||
libs="${libs} -LIBPATH:${VSWINPATH}/VC/lib/x64"
|
||||
libs="${libs} -LIBPATH:${VSWINPATH}/VC/atlmfc/lib/x64"
|
||||
libs="${libs} -LIBPATH:${VSWINPATH}/SDK/Lib/${win_sdk_version}/um/x64"
|
||||
libs="${libs} -LIBPATH:${VSWINPATH}/SDK/Lib/${win_sdk_version}/ucrt/x64"
|
||||
export HOST_LDFLAGS="${libs}"
|
||||
|
||||
export WIN64_LINK="${VSPATH}/VC/bin/Hostx64/x64/link.exe"
|
||||
export WIN64_LIB="${VSPATH}/VC/lib/x64:${VSPATH}/VC/atlmfc/lib/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/ucrt/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/um/x64:${VSPATH}/DIA SDK/lib/amd64"
|
||||
fi
|
||||
|
|
|
@ -10,10 +10,6 @@ if [ -d "${VSPATH}" ]; then
|
|||
export WIN32_REDIST_DIR=${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT
|
||||
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x64"
|
||||
export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
|
||||
|
||||
win_sdk_version="10.0.17134.0"
|
||||
export PATH="${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/SDK/bin/${win_sdk_version}/x64:${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${WIN_DIA_SDK_BIN_DIR}:${PATH}"
|
||||
|
||||
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/${win_sdk_version}/ucrt:${VSPATH}/SDK/Include/${win_sdk_version}/shared:${VSPATH}/SDK/Include/${win_sdk_version}/um:${VSPATH}/SDK/Include/${win_sdk_version}/winrt:${VSPATH}/DIA SDK/include"
|
||||
export LIB="${VSPATH}/VC/lib/x64:${VSPATH}/VC/atlmfc/lib/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/ucrt/x64:${VSPATH}/SDK/Lib/${win_sdk_version}/um/x64:${VSPATH}/DIA SDK/lib/amd64"
|
||||
export DIA_SDK_PATH="${VSPATH}/DIA SDK"
|
||||
export VC_PATH="${VSPATH}/VC"
|
||||
fi
|
||||
|
|
|
@ -932,6 +932,19 @@ nsresult nsScriptSecurityManager::CheckLoadURIFlags(
|
|||
return rv;
|
||||
}
|
||||
|
||||
// Used by ExtensionProtocolHandler to prevent loading extension resources
|
||||
// in private contexts if the extension does not have permission.
|
||||
if (aFromPrivateWindow) {
|
||||
rv = DenyAccessIfURIHasFlags(
|
||||
aTargetURI, nsIProtocolHandler::URI_DISALLOW_IN_PRIVATE_CONTEXT);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (reportErrors) {
|
||||
ReportError(errorTag, aSourceURI, aTargetURI, aFromPrivateWindow);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for chrome target URI
|
||||
bool hasFlags = false;
|
||||
rv = NS_URIChainHasFlags(aTargetURI, nsIProtocolHandler::URI_IS_UI_RESOURCE,
|
||||
|
|
|
@ -201,13 +201,6 @@ HOST_CFLAGS = $(COMPUTED_HOST_CFLAGS) $(_DEPEND_CFLAGS)
|
|||
HOST_CXXFLAGS = $(COMPUTED_HOST_CXXFLAGS) $(_DEPEND_CFLAGS)
|
||||
HOST_C_LDFLAGS = $(COMPUTED_HOST_C_LDFLAGS)
|
||||
HOST_CXX_LDFLAGS = $(COMPUTED_HOST_CXX_LDFLAGS)
|
||||
# Win32 Cross-builds on win64 need to override LIB when invoking the linker,
|
||||
# which we do for rust through cargo-linker.bat, so we abuse it here.
|
||||
# Ideally, we'd empty LIB and pass -LIBPATH options to the linker somehow but
|
||||
# we don't have this in place for rust, so...
|
||||
ifdef WIN64_CARGO_LINKER
|
||||
HOST_LINKER = $(topobjdir)/build/win64/cargo-linker.bat
|
||||
endif
|
||||
|
||||
ifdef MOZ_LTO
|
||||
ifeq (Darwin,$(OS_TARGET))
|
||||
|
|
|
@ -55,6 +55,9 @@ const AboutDebugging = {
|
|||
this.store = configureStore();
|
||||
this.actions = bindActionCreators(actions, this.store.dispatch);
|
||||
|
||||
const width = this.getRoundedViewportWidth();
|
||||
this.actions.recordTelemetryEvent("open_adbg", { width });
|
||||
|
||||
await l10n.init();
|
||||
|
||||
this.actions.createThisFirefoxRuntime();
|
||||
|
@ -104,10 +107,11 @@ const AboutDebugging = {
|
|||
},
|
||||
|
||||
async destroy() {
|
||||
const state = this.store.getState();
|
||||
|
||||
const width = this.getRoundedViewportWidth();
|
||||
this.actions.recordTelemetryEvent("close_adbg", { width });
|
||||
l10n.destroy();
|
||||
|
||||
const state = this.store.getState();
|
||||
const currentRuntimeId = state.runtimes.selectedRuntimeId;
|
||||
if (currentRuntimeId) {
|
||||
await this.actions.unwatchRuntime(currentRuntimeId);
|
||||
|
@ -126,6 +130,13 @@ const AboutDebugging = {
|
|||
get mount() {
|
||||
return document.getElementById("mount");
|
||||
},
|
||||
|
||||
/**
|
||||
* Computed viewport width, rounded at 50px. Used for telemetry events.
|
||||
*/
|
||||
getRoundedViewportWidth() {
|
||||
return Math.ceil(window.outerWidth / 50) * 50;
|
||||
},
|
||||
};
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
|
|
|
@ -40,8 +40,10 @@ const {
|
|||
RUNTIMES,
|
||||
} = require("../constants");
|
||||
|
||||
const Actions = require("./index");
|
||||
|
||||
function inspectDebugTarget(type, id) {
|
||||
return async (_, getState) => {
|
||||
return async (dispatch, getState) => {
|
||||
const runtime = getCurrentRuntime(getState().runtimes);
|
||||
const { runtimeDetails, type: runtimeType } = runtime;
|
||||
|
||||
|
@ -74,12 +76,16 @@ function inspectDebugTarget(type, id) {
|
|||
gDevToolsBrowser.openWorkerToolbox(front);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
console.error("Failed to inspect the debug target of " +
|
||||
`type: ${ type } id: ${ id }`);
|
||||
}
|
||||
}
|
||||
|
||||
dispatch(Actions.recordTelemetryEvent("inspect", {
|
||||
"target_type": type,
|
||||
"runtime_type": runtimeType,
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
const debugTargets = require("./debug-targets");
|
||||
const runtimes = require("./runtimes");
|
||||
const telemetry = require("./telemetry");
|
||||
const ui = require("./ui");
|
||||
|
||||
Object.assign(exports, ui, runtimes, debugTargets);
|
||||
Object.assign(exports, ui, runtimes, telemetry, debugTargets);
|
||||
|
|
|
@ -6,5 +6,6 @@ DevToolsModules(
|
|||
'debug-targets.js',
|
||||
'index.js',
|
||||
'runtimes.js',
|
||||
'telemetry.js',
|
||||
'ui.js',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
TELEMETRY_RECORD,
|
||||
} = require("../constants");
|
||||
|
||||
/**
|
||||
* If a given event cannot be mapped to an existing action, use this action that will only
|
||||
* be processed by the event recording middleware.
|
||||
*/
|
||||
function recordTelemetryEvent(method, details) {
|
||||
return (dispatch, getState) => {
|
||||
dispatch({ type: TELEMETRY_RECORD, method, details });
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
recordTelemetryEvent,
|
||||
};
|
|
@ -37,6 +37,7 @@ const actionTypes = {
|
|||
SELECT_PAGE_START: "SELECT_PAGE_START",
|
||||
SELECT_PAGE_SUCCESS: "SELECT_PAGE_SUCCESS",
|
||||
SELECTED_RUNTIME_ID_UPDATED: "SELECTED_RUNTIME_ID_UPDATED",
|
||||
TELEMETRY_RECORD: "TELEMETRY_RECORD",
|
||||
TEMPORARY_EXTENSION_INSTALL_FAILURE: "TEMPORARY_EXTENSION_INSTALL_FAILURE",
|
||||
TEMPORARY_EXTENSION_INSTALL_START: "TEMPORARY_EXTENSION_INSTALL_START",
|
||||
TEMPORARY_EXTENSION_INSTALL_SUCCESS: "TEMPORARY_EXTENSION_INSTALL_SUCCESS",
|
||||
|
|
|
@ -16,6 +16,7 @@ const { RuntimesState } = require("./reducers/runtimes-state");
|
|||
const { UiState } = require("./reducers/ui-state");
|
||||
const debugTargetListenerMiddleware = require("./middleware/debug-target-listener");
|
||||
const errorLoggingMiddleware = require("./middleware/error-logging");
|
||||
const eventRecordingMiddleware = require("./middleware/event-recording");
|
||||
const extensionComponentDataMiddleware = require("./middleware/extension-component-data");
|
||||
const tabComponentDataMiddleware = require("./middleware/tab-component-data");
|
||||
const workerComponentDataMiddleware = require("./middleware/worker-component-data");
|
||||
|
@ -34,6 +35,7 @@ function configureStore() {
|
|||
const middleware = applyMiddleware(thunk,
|
||||
debugTargetListenerMiddleware,
|
||||
errorLoggingMiddleware,
|
||||
eventRecordingMiddleware,
|
||||
extensionComponentDataMiddleware,
|
||||
tabComponentDataMiddleware,
|
||||
workerComponentDataMiddleware,
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Telemetry = require("devtools/client/shared/telemetry");
|
||||
loader.lazyGetter(this, "telemetry", () => new Telemetry());
|
||||
// This is a unique id that should be submitted with all about:debugging events.
|
||||
loader.lazyGetter(this, "sessionId", () => parseInt(telemetry.msSinceProcessStart(), 10));
|
||||
|
||||
const {
|
||||
SELECT_PAGE_SUCCESS,
|
||||
TELEMETRY_RECORD,
|
||||
} = require("../constants");
|
||||
|
||||
function recordEvent(method, details) {
|
||||
// Add the session id to the event details.
|
||||
const eventDetails = Object.assign({}, details, { "session_id": sessionId });
|
||||
telemetry.recordEvent(method, "aboutdebugging", null, eventDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* This middleware will record events to telemetry for some specific actions.
|
||||
*/
|
||||
function eventRecordingMiddleware() {
|
||||
return next => action => {
|
||||
switch (action.type) {
|
||||
case SELECT_PAGE_SUCCESS:
|
||||
recordEvent("select_page", { "page_type": action.page });
|
||||
break;
|
||||
case TELEMETRY_RECORD:
|
||||
const { method, details } = action;
|
||||
if (method) {
|
||||
recordEvent(method, details);
|
||||
} else {
|
||||
console.error(`[RECORD EVENT FAILED] ${action.type}: no "method" property`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return next(action);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = eventRecordingMiddleware;
|
|
@ -5,6 +5,7 @@
|
|||
DevToolsModules(
|
||||
'debug-target-listener.js',
|
||||
'error-logging.js',
|
||||
'event-recording.js',
|
||||
'extension-component-data.js',
|
||||
'tab-component-data.js',
|
||||
'worker-component-data.js',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
|
@ -12,6 +12,7 @@ support-files =
|
|||
helper-collapsibilities.js
|
||||
helper-mocks.js
|
||||
helper-serviceworker.js
|
||||
helper-telemetry.js
|
||||
mocks/*
|
||||
resources/bad-extension/*
|
||||
resources/packaged-extension/*
|
||||
|
@ -23,11 +24,17 @@ support-files =
|
|||
!/devtools/client/shared/test/shared-redux-head.js
|
||||
!/devtools/client/shared/test/telemetry-test-helpers.js
|
||||
|
||||
[browser_aboutdebugging_addons_debug_console.js]
|
||||
tags = webextensions
|
||||
[browser_aboutdebugging_addons_debug_inspector.js]
|
||||
tags = webextensions
|
||||
[browser_aboutdebugging_addons_debug_nobg.js]
|
||||
tags = webextensions
|
||||
[browser_aboutdebugging_addons_manifest_url.js]
|
||||
skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug 1499638
|
||||
[browser_aboutdebugging_addons_remote_runtime.js]
|
||||
[browser_aboutdebugging_addons_temporary_addon_buttons.js]
|
||||
skip-if = (os == 'win') # On windows the AddonManager locks the XPI file loaded as a temporary extension and we can not test the reload of the extension.
|
||||
[browser_aboutdebugging_addons_temporary_id_message.js]
|
||||
[browser_aboutdebugging_addons_temporary_install_error.js]
|
||||
[browser_aboutdebugging_addons_warnings.js]
|
||||
|
@ -73,6 +80,9 @@ skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug
|
|||
skip-if = (os == 'linux' && bits == 32) # ADB start() fails on linux 32, see Bug 1499638
|
||||
[browser_aboutdebugging_system_addons.js]
|
||||
[browser_aboutdebugging_tab_favicons.js]
|
||||
[browser_aboutdebugging_telemetry_basic.js]
|
||||
[browser_aboutdebugging_telemetry_inspect.js]
|
||||
[browser_aboutdebugging_telemetry_navigate.js]
|
||||
[browser_aboutdebugging_thisfirefox.js]
|
||||
[browser_aboutdebugging_thisfirefox_runtime_info.js]
|
||||
[browser_aboutdebugging_thisfirefox_worker_inspection.js]
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from helper-addons.js */
|
||||
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this);
|
||||
|
||||
// There are shutdown issues for which multiple rejections are left uncaught.
|
||||
// See bug 1018184 for resolving these issues.
|
||||
const { PromiseTestUtils } = scopedCuImport("resource://testing-common/PromiseTestUtils.jsm");
|
||||
PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
|
||||
|
||||
// Avoid test timeouts that can occur while waiting for the "addon-console-works" message.
|
||||
requestLongerTimeout(2);
|
||||
|
||||
const ADDON_ID = "test-devtools-webextension@mozilla.org";
|
||||
const ADDON_NAME = "test-devtools-webextension";
|
||||
|
||||
const {
|
||||
BrowserToolboxProcess,
|
||||
} = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
|
||||
|
||||
// This is a migration from:
|
||||
// https://searchfox.org/mozilla-central/source/devtools/client/aboutdebugging/test/browser_addons_debug_webextension.js
|
||||
|
||||
/**
|
||||
* This test file ensures that the webextension addon developer toolbox:
|
||||
* - when the debug button is clicked on a webextension, the opened toolbox
|
||||
* has a working webconsole with the background page as default target;
|
||||
*/
|
||||
add_task(async function testWebExtensionsToolboxWebConsole() {
|
||||
await enableExtensionDebugging();
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
await installTemporaryExtensionFromXPI({
|
||||
background: function() {
|
||||
window.myWebExtensionAddonFunction = function() {
|
||||
console.log("Background page function called",
|
||||
this.browser.runtime.getManifest());
|
||||
};
|
||||
},
|
||||
id: ADDON_ID,
|
||||
name: ADDON_NAME,
|
||||
}, document);
|
||||
const target = findDebugTargetByText(ADDON_NAME, document);
|
||||
|
||||
info("Setup the toolbox test function as environment variable");
|
||||
const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "new " + toolboxTestScript);
|
||||
registerCleanupFunction(() => env.set("MOZ_TOOLBOX_TEST_SCRIPT", ""));
|
||||
|
||||
info("Click inspect to open the addon toolbox, wait for toolbox close event");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const inspectButton = target.querySelector(".js-debug-target-inspect-button");
|
||||
inspectButton.click();
|
||||
await onToolboxClose;
|
||||
|
||||
// The test script will not close the toolbox and will timeout if it fails, so reaching
|
||||
// this point in the test is enough to assume the test was successful.
|
||||
ok(true, "Addon toolbox closed");
|
||||
|
||||
await removeTemporaryExtension(ADDON_NAME, document);
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
function toolboxTestScript() {
|
||||
/* eslint-disable no-undef */
|
||||
function findMessages(hud, text, selector = ".message") {
|
||||
const messages = hud.ui.outputNode.querySelectorAll(selector);
|
||||
const elements = Array.prototype.filter.call(
|
||||
messages,
|
||||
(el) => el.textContent.includes(text)
|
||||
);
|
||||
return elements;
|
||||
}
|
||||
|
||||
async function waitFor(condition) {
|
||||
while (!condition()) {
|
||||
await new Promise(done => toolbox.win.setTimeout(done, 1000));
|
||||
}
|
||||
}
|
||||
|
||||
toolbox.selectTool("webconsole")
|
||||
.then(async console => {
|
||||
const { hud } = console;
|
||||
const { jsterm } = hud;
|
||||
const onMessage = waitFor(() => {
|
||||
return findMessages(hud, "Background page function called").length > 0;
|
||||
});
|
||||
await jsterm.execute("myWebExtensionAddonFunction()");
|
||||
await onMessage;
|
||||
await toolbox.destroy();
|
||||
})
|
||||
.catch(e => dump("Exception from browser toolbox process: " + e + "\n"));
|
||||
/* eslint-enable no-undef */
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from helper-addons.js */
|
||||
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this);
|
||||
|
||||
// There are shutdown issues for which multiple rejections are left uncaught.
|
||||
// See bug 1018184 for resolving these issues.
|
||||
const { PromiseTestUtils } = scopedCuImport("resource://testing-common/PromiseTestUtils.jsm");
|
||||
PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
|
||||
|
||||
// Avoid test timeouts that can occur while waiting for the "addon-console-works" message.
|
||||
requestLongerTimeout(2);
|
||||
|
||||
const ADDON_ID = "test-devtools-webextension@mozilla.org";
|
||||
const ADDON_NAME = "test-devtools-webextension";
|
||||
|
||||
const {
|
||||
BrowserToolboxProcess,
|
||||
} = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
|
||||
|
||||
// This is a migration from:
|
||||
// https://searchfox.org/mozilla-central/source/devtools/client/aboutdebugging/test/browser_addons_debug_webextension_inspector.js
|
||||
|
||||
/**
|
||||
* This test file ensures that the webextension addon developer toolbox:
|
||||
* - the webextension developer toolbox has a working Inspector panel, with the
|
||||
* background page as default target;
|
||||
*/
|
||||
add_task(async function testWebExtensionsToolboxWebConsole() {
|
||||
await enableExtensionDebugging();
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
await installTemporaryExtensionFromXPI({
|
||||
background: function() {
|
||||
document.body.innerText = "Background Page Body Test Content";
|
||||
},
|
||||
id: ADDON_ID,
|
||||
name: ADDON_NAME,
|
||||
}, document);
|
||||
const target = findDebugTargetByText(ADDON_NAME, document);
|
||||
|
||||
info("Setup the toolbox test function as environment variable");
|
||||
const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
env.set("MOZ_TOOLBOX_TEST_SCRIPT", "new " + toolboxTestScript);
|
||||
registerCleanupFunction(() => env.set("MOZ_TOOLBOX_TEST_SCRIPT", ""));
|
||||
|
||||
info("Click inspect to open the addon toolbox, wait for toolbox close event");
|
||||
const onToolboxClose = BrowserToolboxProcess.once("close");
|
||||
const inspectButton = target.querySelector(".js-debug-target-inspect-button");
|
||||
inspectButton.click();
|
||||
await onToolboxClose;
|
||||
|
||||
// The test script will not close the toolbox and will timeout if it fails, so reaching
|
||||
// this point in the test is enough to assume the test was successful.
|
||||
ok(true, "Addon toolbox closed");
|
||||
|
||||
await removeTemporaryExtension(ADDON_NAME, document);
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
||||
// Be careful, this JS function is going to be executed in the addon toolbox,
|
||||
// which lives in another process. So do not try to use any scope variable!
|
||||
function toolboxTestScript() {
|
||||
/* eslint-disable no-undef */
|
||||
toolbox.selectTool("inspector")
|
||||
.then(inspector => {
|
||||
return inspector.walker.querySelector(inspector.walker.rootNode, "body");
|
||||
})
|
||||
.then((nodeActor) => {
|
||||
if (!nodeActor) {
|
||||
throw new Error("nodeActor not found");
|
||||
}
|
||||
|
||||
dump("Got a nodeActor\n");
|
||||
|
||||
if (!(nodeActor.inlineTextChild)) {
|
||||
throw new Error("inlineTextChild not found");
|
||||
}
|
||||
|
||||
dump("Got a nodeActor with an inline text child\n");
|
||||
|
||||
const expectedValue = "Background Page Body Test Content";
|
||||
const actualValue = nodeActor.inlineTextChild._form.nodeValue;
|
||||
|
||||
if (String(actualValue).trim() !== String(expectedValue).trim()) {
|
||||
throw new Error(
|
||||
`mismatched inlineTextchild value: "${actualValue}" !== "${expectedValue}"`
|
||||
);
|
||||
}
|
||||
|
||||
dump("Got the expected inline text content in the selected node\n");
|
||||
return Promise.resolve();
|
||||
})
|
||||
.then(() => toolbox.destroy())
|
||||
.catch((error) => {
|
||||
dump("Error while running code in the browser toolbox process:\n");
|
||||
dump(error + "\n");
|
||||
dump("stack:\n" + error.stack + "\n");
|
||||
});
|
||||
/* eslint-enable no-undef */
|
||||
}
|
|
@ -28,18 +28,11 @@ add_task(async function testWebExtensionsToolboxNoBackgroundPage() {
|
|||
await enableExtensionDebugging();
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
const manifest = {
|
||||
manifest_version: 2,
|
||||
await installTemporaryExtensionFromXPI({
|
||||
// Do not pass any `background` script.
|
||||
id: ADDON_NOBG_ID,
|
||||
name: ADDON_NOBG_NAME,
|
||||
version: "1.0",
|
||||
applications: {
|
||||
gecko: {
|
||||
id: ADDON_NOBG_ID,
|
||||
},
|
||||
},
|
||||
};
|
||||
await installTemporaryExtensionFromManifest(manifest, document);
|
||||
|
||||
}, document);
|
||||
const target = findDebugTargetByText(ADDON_NOBG_NAME, document);
|
||||
|
||||
info("Setup the toolbox test function as environment variable");
|
||||
|
|
|
@ -13,23 +13,16 @@ add_task(async function() {
|
|||
const UPDATED_EXTENSION_NAME = "Temporary web extension (updated)";
|
||||
const EXTENSION_ID = "test-devtools@mozilla.org";
|
||||
|
||||
const manifestBase = {
|
||||
"manifest_version": 2,
|
||||
"name": ORIGINAL_EXTENSION_NAME,
|
||||
"version": "1.0",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": EXTENSION_ID,
|
||||
},
|
||||
},
|
||||
};
|
||||
const tempExt = await installTemporaryExtensionFromManifest(manifestBase, document);
|
||||
const addonFile = await installTemporaryExtensionFromXPI({
|
||||
id: EXTENSION_ID,
|
||||
name: ORIGINAL_EXTENSION_NAME,
|
||||
}, document);
|
||||
|
||||
const originalTarget = findDebugTargetByText(ORIGINAL_EXTENSION_NAME, document);
|
||||
ok(!!originalTarget, "The temporary extension isinstalled with the expected name");
|
||||
|
||||
info("Update the name of the temporary extension in the manifest");
|
||||
tempExt.writeManifest(Object.assign({}, manifestBase, {name: UPDATED_EXTENSION_NAME}));
|
||||
updateTemporaryXPI({ id: EXTENSION_ID, name: UPDATED_EXTENSION_NAME }, addonFile);
|
||||
|
||||
info("Click on the reload button for the temporary extension");
|
||||
const reloadButton =
|
||||
|
@ -62,7 +55,7 @@ add_task(async function() {
|
|||
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
await installRegularAddon("resources/packaged-extension/packaged-extension.xpi");
|
||||
await installRegularExtension("resources/packaged-extension/packaged-extension.xpi");
|
||||
|
||||
info("Wait until extension appears in about:debugging");
|
||||
await waitUntil(() => findDebugTargetByText(PACKAGED_EXTENSION_NAME, document));
|
||||
|
|
|
@ -13,22 +13,10 @@ add_task(async function() {
|
|||
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
const manifest = {
|
||||
"manifest_version": 2,
|
||||
"name": EXTENSION_NAME,
|
||||
"version": "1.0",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": EXTENSION_ID,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const tempExt = new TemporaryExtension(EXTENSION_ID);
|
||||
tempExt.writeManifest(manifest);
|
||||
|
||||
info("Install a temporary extension");
|
||||
await AddonManager.installTemporaryAddon(tempExt.sourceDir);
|
||||
await installTemporaryExtensionFromXPI({
|
||||
id: EXTENSION_ID,
|
||||
name: EXTENSION_NAME,
|
||||
}, document);
|
||||
|
||||
info("Wait until a debug target item appears");
|
||||
await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document));
|
||||
|
@ -42,10 +30,6 @@ add_task(async function() {
|
|||
ok(!!link, "Temporary id link is displayed for temporary extensions");
|
||||
|
||||
await removeTemporaryExtension(EXTENSION_NAME, document);
|
||||
|
||||
info("Remove the temporary web extension");
|
||||
tempExt.remove();
|
||||
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
||||
|
@ -56,7 +40,7 @@ add_task(async function() {
|
|||
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
await installRegularAddon("resources/packaged-extension/packaged-extension.xpi");
|
||||
await installRegularExtension("resources/packaged-extension/packaged-extension.xpi");
|
||||
|
||||
info("Wait until extension appears in about:debugging");
|
||||
await waitUntil(() => findDebugTargetByText(PACKAGED_EXTENSION_NAME, document));
|
||||
|
|
|
@ -13,25 +13,14 @@ add_task(async function() {
|
|||
|
||||
const { document, tab } = await openAboutDebugging();
|
||||
|
||||
const manifest = {
|
||||
"manifest_version": 2,
|
||||
"name": EXTENSION_NAME,
|
||||
"version": "1.0",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": EXTENSION_ID,
|
||||
},
|
||||
await installTemporaryExtensionFromXPI({
|
||||
id: EXTENSION_ID,
|
||||
name: EXTENSION_NAME,
|
||||
extraProperties: {
|
||||
// This property is not expected in the manifest and should trigger a warning!
|
||||
"wrongProperty": {},
|
||||
},
|
||||
// This property is not expected in the manifest and should trigger a warning!
|
||||
"wrongProperty": {},
|
||||
};
|
||||
|
||||
const tempExt = new TemporaryExtension(EXTENSION_ID);
|
||||
tempExt.writeManifest(manifest);
|
||||
registerCleanupFunction(() => tempExt.remove());
|
||||
|
||||
info("Install a temporary extension");
|
||||
await AddonManager.installTemporaryAddon(tempExt.sourceDir);
|
||||
}, document);
|
||||
|
||||
info("Wait until a debug target item appears");
|
||||
await waitUntil(() => findDebugTargetByText(EXTENSION_NAME, document));
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from helper-telemetry.js */
|
||||
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this);
|
||||
|
||||
/**
|
||||
* Check that telemetry events are recorded when opening and closing about debugging.
|
||||
*/
|
||||
add_task(async function() {
|
||||
setupTelemetryTest();
|
||||
|
||||
const { tab } = await openAboutDebugging();
|
||||
|
||||
const openEvents = readAboutDebuggingEvents().filter(e => e.method === "open_adbg");
|
||||
is(openEvents.length, 1, "Exactly one open event was logged for about:debugging");
|
||||
const sessionId = openEvents[0].extras.session_id;
|
||||
ok(!isNaN(sessionId), "Open event has a valid session id");
|
||||
|
||||
await removeTab(tab);
|
||||
|
||||
const closeEvents = readAboutDebuggingEvents().filter(e => e.method === "close_adbg");
|
||||
is(closeEvents.length, 1, "Exactly one close event was logged for about:debugging");
|
||||
is(closeEvents[0].extras.session_id, sessionId,
|
||||
"Close event has the same session id as the open event");
|
||||
});
|
|
@ -0,0 +1,56 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from helper-telemetry.js */
|
||||
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this);
|
||||
|
||||
const TAB_URL = "data:text/html,<title>TEST_TAB</title>";
|
||||
|
||||
/**
|
||||
* Check that telemetry events are recorded when inspecting a target.
|
||||
*/
|
||||
add_task(async function() {
|
||||
setupTelemetryTest();
|
||||
|
||||
const { document, tab, window } = await openAboutDebugging();
|
||||
|
||||
const sessionId = getOpenEventSessionId();
|
||||
ok(!isNaN(sessionId), "Open event has a valid session id");
|
||||
|
||||
info("Open a new background tab TEST_TAB");
|
||||
const backgroundTab1 = await addTab(TAB_URL, { background: true });
|
||||
|
||||
info("Wait for the tab to appear in the debug targets with the correct name");
|
||||
await waitUntil(() => findDebugTargetByText("TEST_TAB", document));
|
||||
|
||||
const tabTarget = findDebugTargetByText("TEST_TAB", document);
|
||||
const inspectButton = tabTarget.querySelector(".js-debug-target-inspect-button");
|
||||
ok(inspectButton, "Inspect button for the tab is available");
|
||||
|
||||
info("Click on the inspect button for the test tab");
|
||||
inspectButton.click();
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
const newTabUrl = gBrowser.selectedBrowser.currentURI.spec;
|
||||
ok(newTabUrl.startsWith("about:devtools-toolbox"),
|
||||
"about:devtools-toolbox opened in a new tab");
|
||||
|
||||
const evts = readAboutDebuggingEvents().filter(e => e.method === "inspect");
|
||||
is(evts.length, 1, "Exactly one Inspect event found");
|
||||
is(evts[0].extras.target_type, "TAB", "Inspect event has the expected target type");
|
||||
is(evts[0].extras.runtime_type, "this-firefox",
|
||||
"Inspect event has the expected runtime type");
|
||||
is(evts[0].extras.session_id, sessionId, "Inspect event has the expected session");
|
||||
|
||||
info("Close the about:devtools-toolbox tab");
|
||||
await removeTab(gBrowser.selectedTab);
|
||||
await waitForRequestsToSettle(window.AboutDebugging.store);
|
||||
|
||||
info("Remove first background tab");
|
||||
await removeTab(backgroundTab1);
|
||||
await waitUntil(() => !findDebugTargetByText("TEST_TAB", document));
|
||||
await waitForRequestsToSettle(window.AboutDebugging.store);
|
||||
|
||||
await removeTab(tab);
|
||||
});
|
|
@ -0,0 +1,56 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from helper-mocks.js */
|
||||
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-mocks.js", this);
|
||||
/* import-globals-from helper-telemetry.js */
|
||||
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-telemetry.js", this);
|
||||
|
||||
/**
|
||||
* Check that telemetry events are recorded when navigating between different
|
||||
* about:debugging pages.
|
||||
*/
|
||||
add_task(async function() {
|
||||
// enable USB devices mocks
|
||||
const mocks = new Mocks();
|
||||
|
||||
setupTelemetryTest();
|
||||
|
||||
const { tab, document } = await openAboutDebugging();
|
||||
|
||||
const sessionId = getOpenEventSessionId();
|
||||
ok(!isNaN(sessionId), "Open event has a valid session id");
|
||||
|
||||
info("Navigate to 'Connect' page");
|
||||
document.location.hash = "#/connect";
|
||||
await waitUntil(() => document.querySelector(".js-connect-page"));
|
||||
checkSelectPageEvent("connect", sessionId);
|
||||
|
||||
info("Navigate to 'USB device runtime' page");
|
||||
await navigateToUSBRuntime(mocks, document);
|
||||
checkSelectPageEvent("runtime", sessionId);
|
||||
|
||||
await removeTab(tab);
|
||||
});
|
||||
|
||||
function checkSelectPageEvent(expectedType, expectedSessionId) {
|
||||
const evts = readAboutDebuggingEvents().filter(e => e.method === "select_page");
|
||||
is(evts.length, 1, "Exactly one select_page event recorded");
|
||||
is(evts[0].extras.page_type, expectedType, "Select page event has the expected type");
|
||||
is(evts[0].extras.session_id, expectedSessionId,
|
||||
"Select page event has the expected session");
|
||||
}
|
||||
|
||||
async function navigateToUSBRuntime(mocks, doc) {
|
||||
mocks.createUSBRuntime("1337id", {
|
||||
deviceName: "Fancy Phone",
|
||||
name: "Lorem ipsum",
|
||||
});
|
||||
mocks.emitUSBUpdate();
|
||||
await connectToRuntime("Fancy Phone", doc);
|
||||
// navigate to it via URL
|
||||
doc.location.hash = "#/runtime/1337id";
|
||||
await waitUntil(() => doc.querySelector(".js-runtime-page"));
|
||||
}
|
|
@ -26,13 +26,37 @@ async function enableExtensionDebugging() {
|
|||
}
|
||||
/* exported enableExtensionDebugging */
|
||||
|
||||
/**
|
||||
* Install an extension using the AddonManager so it does not show up as temporary.
|
||||
*/
|
||||
function installRegularExtension(pathOrFile) {
|
||||
const isFile = typeof pathOrFile.isFile === "function" && pathOrFile.isFile();
|
||||
const file = isFile ? pathOrFile : _getSupportsFile(pathOrFile).file;
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const install = await AddonManager.getInstallForFile(file);
|
||||
if (!install) {
|
||||
throw new Error(`An install was not created for ${file.path}`);
|
||||
}
|
||||
install.addListener({
|
||||
onDownloadFailed: reject,
|
||||
onDownloadCancelled: reject,
|
||||
onInstallFailed: reject,
|
||||
onInstallCancelled: reject,
|
||||
onInstallEnded: resolve,
|
||||
});
|
||||
install.install();
|
||||
});
|
||||
}
|
||||
/* exported installRegularExtension */
|
||||
|
||||
/**
|
||||
* Install a temporary extension at the provided path, with the provided name.
|
||||
* Will use a mock file picker to select the file.
|
||||
*/
|
||||
async function installTemporaryExtension(path, name, document) {
|
||||
async function installTemporaryExtension(pathOrFile, name, document) {
|
||||
info("Install temporary extension named " + name);
|
||||
// Mock the file picker to select a test addon
|
||||
prepareMockFilePicker(path);
|
||||
prepareMockFilePicker(pathOrFile);
|
||||
|
||||
const onAddonInstalled = new Promise(done => {
|
||||
Management.on("startup", function listener(event, extension) {
|
||||
|
@ -53,25 +77,61 @@ async function installTemporaryExtension(path, name, document) {
|
|||
}
|
||||
/* exported installTemporaryExtension */
|
||||
|
||||
/**
|
||||
* Install a fake temporary extension just using the manifest information.
|
||||
* @return {TemporaryExtension} the temporary extension instance created
|
||||
*/
|
||||
async function installTemporaryExtensionFromManifest(manifest, document) {
|
||||
const addonId = manifest.applications.gecko.id;
|
||||
const temporaryExtension = new TemporaryExtension(addonId);
|
||||
temporaryExtension.writeManifest(manifest);
|
||||
registerCleanupFunction(() => temporaryExtension.remove(false));
|
||||
function createTemporaryXPI(xpiData) {
|
||||
const { ExtensionTestCommon } =
|
||||
ChromeUtils.import("resource://testing-common/ExtensionTestCommon.jsm", {});
|
||||
|
||||
info("Install a temporary extension");
|
||||
await AddonManager.installTemporaryAddon(temporaryExtension.sourceDir);
|
||||
const { background, id, name, extraProperties } = xpiData;
|
||||
info("Generate XPI file for " + id);
|
||||
|
||||
info("Wait until the corresponding debug target item appears");
|
||||
await waitUntil(() => findDebugTargetByText(manifest.name, document));
|
||||
const manifest = Object.assign({}, {
|
||||
applications: { gecko: { id }},
|
||||
manifest_version: 2,
|
||||
name,
|
||||
version: "1.0",
|
||||
}, extraProperties);
|
||||
|
||||
return temporaryExtension;
|
||||
const xpiFile = ExtensionTestCommon.generateXPI({ background, manifest });
|
||||
registerCleanupFunction(() => xpiFile.exists() && xpiFile.remove(false));
|
||||
return xpiFile;
|
||||
}
|
||||
/* exported installTemporaryExtensionFromManifest */
|
||||
/* exported createTemporaryXPI */
|
||||
|
||||
/**
|
||||
* Remove the existing temporary XPI file generated by ExtensionTestCommon and create a
|
||||
* new one at the same location.
|
||||
* @return {File} the temporary extension XPI file created
|
||||
*/
|
||||
function updateTemporaryXPI(xpiData, existingXPI) {
|
||||
info("Delete and regenerate XPI for " + xpiData.id);
|
||||
|
||||
// Store the current name to check the xpi is correctly replaced.
|
||||
const existingName = existingXPI.leafName;
|
||||
info("Delete existing XPI named: " + existingName);
|
||||
existingXPI.exists() && existingXPI.remove(false);
|
||||
|
||||
const xpiFile = createTemporaryXPI(xpiData);
|
||||
// Check that the name of the new file is correct
|
||||
if (xpiFile.leafName !== existingName) {
|
||||
throw new Error("New XPI created with unexpected name: " + xpiFile.leafName);
|
||||
}
|
||||
return xpiFile;
|
||||
}
|
||||
/* exported updateTemporaryXPI */
|
||||
|
||||
/**
|
||||
* Install a fake temporary extension by creating a temporary in-memory XPI file.
|
||||
* @return {File} the temporary extension XPI file created
|
||||
*/
|
||||
async function installTemporaryExtensionFromXPI(xpiData, document) {
|
||||
const xpiFile = createTemporaryXPI(xpiData);
|
||||
await installTemporaryExtension(xpiFile, xpiData.name, document);
|
||||
|
||||
info("Wait until the addon debug target appears");
|
||||
await waitUntil(() => findDebugTargetByText(xpiData.name, document));
|
||||
return xpiFile;
|
||||
}
|
||||
/* exported installTemporaryExtensionFromXPI */
|
||||
|
||||
async function removeTemporaryExtension(name, document) {
|
||||
info(`Remove the temporary extension with name: '${name}'`);
|
||||
|
@ -93,75 +153,13 @@ async function removeExtension(id, name, document) {
|
|||
}
|
||||
/* exported removeExtension */
|
||||
|
||||
function prepareMockFilePicker(path) {
|
||||
function prepareMockFilePicker(pathOrFile) {
|
||||
const isFile = typeof pathOrFile.isFile === "function" && pathOrFile.isFile();
|
||||
const file = isFile ? pathOrFile : _getSupportsFile(pathOrFile).file;
|
||||
|
||||
// Mock the file picker to select a test addon
|
||||
const MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
MockFilePicker.init(window);
|
||||
MockFilePicker.setFiles([_getSupportsFile(path).file]);
|
||||
MockFilePicker.setFiles([file]);
|
||||
}
|
||||
/* exported prepareMockFilePicker */
|
||||
|
||||
/**
|
||||
* Creates a web extension from scratch in a temporary location.
|
||||
* The object must be removed when you're finished working with it.
|
||||
*/
|
||||
class TemporaryExtension {
|
||||
constructor(addonId) {
|
||||
this.addonId = addonId;
|
||||
this.tmpDir = FileUtils.getDir("TmpD", ["browser_addons_reload"]);
|
||||
if (!this.tmpDir.exists()) {
|
||||
this.tmpDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
|
||||
}
|
||||
this.sourceDir = this.tmpDir.clone();
|
||||
this.sourceDir.append(this.addonId);
|
||||
if (!this.sourceDir.exists()) {
|
||||
this.sourceDir.create(Ci.nsIFile.DIRECTORY_TYPE,
|
||||
FileUtils.PERMS_DIRECTORY);
|
||||
}
|
||||
}
|
||||
|
||||
writeManifest(manifestData) {
|
||||
const manifest = this.sourceDir.clone();
|
||||
manifest.append("manifest.json");
|
||||
if (manifest.exists()) {
|
||||
manifest.remove(true);
|
||||
}
|
||||
const fos = Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Ci.nsIFileOutputStream);
|
||||
fos.init(manifest,
|
||||
FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE |
|
||||
FileUtils.MODE_TRUNCATE,
|
||||
FileUtils.PERMS_FILE, 0);
|
||||
|
||||
const manifestString = JSON.stringify(manifestData);
|
||||
fos.write(manifestString, manifestString.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
remove() {
|
||||
return this.tmpDir.remove(true);
|
||||
}
|
||||
}
|
||||
/* exported TemporaryExtension */
|
||||
|
||||
/**
|
||||
* Install an add-on using the AddonManager so it does not show up as temporary.
|
||||
*/
|
||||
function installRegularAddon(filePath) {
|
||||
const file = _getSupportsFile(filePath).file;
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const install = await AddonManager.getInstallForFile(file);
|
||||
if (!install) {
|
||||
throw new Error(`An install was not created for ${filePath}`);
|
||||
}
|
||||
install.addListener({
|
||||
onDownloadFailed: reject,
|
||||
onDownloadCancelled: reject,
|
||||
onInstallFailed: reject,
|
||||
onInstallCancelled: reject,
|
||||
onInstallEnded: resolve,
|
||||
});
|
||||
install.install();
|
||||
});
|
||||
}
|
||||
/* exported installRegularAddon */
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from head.js */
|
||||
|
||||
/**
|
||||
* Reset all telemetry events.
|
||||
*/
|
||||
function setupTelemetryTest() {
|
||||
// Let's reset the counts.
|
||||
Services.telemetry.clearEvents();
|
||||
|
||||
// Ensure no events have been logged
|
||||
const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
|
||||
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
|
||||
ok(!snapshot.parent, "No events have been logged for the main process");
|
||||
}
|
||||
/* exported setupTelemetryTest */
|
||||
|
||||
/**
|
||||
* Retrieve the session id from an "open" event.
|
||||
* Note that calling this will "clear" all the events.
|
||||
*/
|
||||
function getOpenEventSessionId() {
|
||||
const openEvents = readAboutDebuggingEvents().filter(e => e.method === "open_adbg");
|
||||
ok(!!openEvents[0], "Found an about:debugging open event");
|
||||
return openEvents[0].extras.session_id;
|
||||
}
|
||||
/* exported getOpenEventSessionId */
|
||||
|
||||
/**
|
||||
* Read all the pending events that have "aboutdebugging" as their object property.
|
||||
* WARNING: Calling this method also flushes/clears the events.
|
||||
*/
|
||||
function readAboutDebuggingEvents() {
|
||||
const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
|
||||
// Retrieve and clear telemetry events.
|
||||
const snapshot = Services.telemetry.snapshotEvents(OPTOUT, true);
|
||||
// about:debugging events are logged in the parent process
|
||||
const parentEvents = snapshot.parent || [];
|
||||
|
||||
return parentEvents
|
||||
.map(_toEventObject)
|
||||
.filter(e => e.object === "aboutdebugging");
|
||||
}
|
||||
/* exported getLoggedEvents */
|
||||
|
||||
/**
|
||||
* The telemetry event data structure is simply an array. This helper remaps the array to
|
||||
* an object with more user friendly properties.
|
||||
*/
|
||||
function _toEventObject(rawEvent) {
|
||||
return {
|
||||
// Category is typically devtools.main for us.
|
||||
category: rawEvent[1],
|
||||
// Method is the event's name (eg open, select_page etc...)
|
||||
method: rawEvent[2],
|
||||
// Object will usually be aboutdebugging for our tests
|
||||
object: rawEvent[3],
|
||||
// Value is usually empty for devtools events
|
||||
value: rawEvent[4],
|
||||
// Extras contain all the details of the event, including the session_id.
|
||||
extras: rawEvent[5],
|
||||
};
|
||||
}
|
|
@ -159,6 +159,7 @@ export default class Group extends Component<Props, State> {
|
|||
<FrameLocation frame={frame} expanded={expanded} />
|
||||
{selectable && <span className="clipboard-only"> </span>}
|
||||
<Badge>{this.props.group.length}</Badge>
|
||||
{selectable && <br className="clipboard-only"/>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -476,10 +476,15 @@ Toolbox.prototype = {
|
|||
Services.prefs.addObserver("devtools.serviceWorkers.testing.enabled",
|
||||
this._applyServiceWorkersTestingSettings);
|
||||
|
||||
// Register listener for handling context menus in standard
|
||||
// input elements: <input> and <textarea>.
|
||||
// There is also support for custom input elements using
|
||||
// .devtools-input class (e.g. CodeMirror instances).
|
||||
this.doc.addEventListener("contextmenu", (e) => {
|
||||
if (e.originalTarget.closest("input[type=text]") ||
|
||||
e.originalTarget.closest("input[type=search]") ||
|
||||
e.originalTarget.closest("input:not([type])") ||
|
||||
e.originalTarget.closest(".devtools-input") ||
|
||||
e.originalTarget.closest("textarea")) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
|
|
@ -86,6 +86,7 @@ class ChangesContextMenu {
|
|||
_onCopy() {
|
||||
const text = this.window.getSelection().toString();
|
||||
clipboardHelper.copyString(text);
|
||||
this.view.onContextMenuCopy();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
|
|
@ -13,6 +13,12 @@ loader.lazyRequireGetter(this, "ChangesContextMenu", "devtools/client/inspector/
|
|||
|
||||
const ChangesApp = createFactory(require("./components/ChangesApp"));
|
||||
|
||||
const {
|
||||
TELEMETRY_SCALAR_CONTEXTMENU,
|
||||
TELEMETRY_SCALAR_CONTEXTMENU_COPY,
|
||||
TELEMETRY_SCALAR_COPY,
|
||||
} = require("./constants");
|
||||
|
||||
const {
|
||||
resetChanges,
|
||||
trackChange,
|
||||
|
@ -23,11 +29,13 @@ class ChangesView {
|
|||
this.document = window.document;
|
||||
this.inspector = inspector;
|
||||
this.store = this.inspector.store;
|
||||
this.telemetry = this.inspector.telemetry;
|
||||
|
||||
this.onAddChange = this.onAddChange.bind(this);
|
||||
this.onClearChanges = this.onClearChanges.bind(this);
|
||||
this.onChangesFront = this.onChangesFront.bind(this);
|
||||
this.onContextMenu = this.onContextMenu.bind(this);
|
||||
this.onCopy = this.onCopy.bind(this);
|
||||
this.destroy = this.destroy.bind(this);
|
||||
|
||||
this.init();
|
||||
|
@ -44,6 +52,7 @@ class ChangesView {
|
|||
init() {
|
||||
const changesApp = ChangesApp({
|
||||
onContextMenu: this.onContextMenu,
|
||||
onCopy: this.onCopy,
|
||||
});
|
||||
|
||||
// listen to the front for initialization, add listeners
|
||||
|
@ -100,8 +109,29 @@ class ChangesView {
|
|||
this.store.dispatch(resetChanges());
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler for the "contextmenu" event fired when the context menu is requested.
|
||||
* @param {Event} e
|
||||
*/
|
||||
onContextMenu(e) {
|
||||
this.contextMenu.show(e);
|
||||
this.telemetry.scalarAdd(TELEMETRY_SCALAR_CONTEXTMENU, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function ran after the "Copy" option from the context menu is used.
|
||||
* This is not an event handler. The copy event cannot be prevented from this method.
|
||||
*/
|
||||
onContextMenuCopy() {
|
||||
this.telemetry.scalarAdd(TELEMETRY_SCALAR_CONTEXTMENU_COPY, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler for the "copy" event fired when content is copied to the clipboard.
|
||||
* We don't change the default behavior. We only log the increment count of this action.
|
||||
*/
|
||||
onCopy() {
|
||||
this.telemetry.scalarAdd(TELEMETRY_SCALAR_COPY, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,6 +21,8 @@ class ChangesApp extends PureComponent {
|
|||
changesTree: PropTypes.object.isRequired,
|
||||
// Event handler for "contextmenu" event
|
||||
onContextMenu: PropTypes.func.isRequired,
|
||||
// Event handler for "copy" event
|
||||
onCopy: PropTypes.func.isRequired,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -149,6 +151,7 @@ class ChangesApp extends PureComponent {
|
|||
className: "theme-sidebar inspector-tabpanel",
|
||||
id: "sidebar-panel-changes",
|
||||
onContextMenu: this.props.onContextMenu,
|
||||
onCopy: this.props.onCopy,
|
||||
},
|
||||
!hasChanges && this.renderEmptyState(),
|
||||
hasChanges && this.renderDiff(this.props.changesTree)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
TELEMETRY_SCALAR_CONTEXTMENU: "devtools.changesview.contextmenu",
|
||||
TELEMETRY_SCALAR_CONTEXTMENU_COPY: "devtools.changesview.contextmenu_copy",
|
||||
TELEMETRY_SCALAR_COPY: "devtools.changesview.copy",
|
||||
};
|
|
@ -15,6 +15,7 @@ DIRS += [
|
|||
DevToolsModules(
|
||||
'ChangesContextMenu.js',
|
||||
'ChangesView.js',
|
||||
'constants.js',
|
||||
)
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
||||
|
|
|
@ -18,7 +18,6 @@ loader.lazyRequireGetter(this, "parseURL", "devtools/client/shared/source-utils"
|
|||
loader.lazyRequireGetter(this, "asyncStorage", "devtools/shared/async-storage");
|
||||
|
||||
const FLEXBOX_COLOR = "#9400FF";
|
||||
const TELEMETRY_ELEMENT_TYPE_DISPLAYED = "DEVTOOLS_FLEXINSPECTOR_ELEMENT_TYPE_DISPLAYED";
|
||||
|
||||
class FlexboxInspector {
|
||||
constructor(inspector, window) {
|
||||
|
@ -426,28 +425,6 @@ class FlexboxInspector {
|
|||
this.update(null, null, reason === "treepanel");
|
||||
}
|
||||
|
||||
/**
|
||||
* Track usage of the tool via telemetry.
|
||||
*
|
||||
* @param {Boolean} isContainerInfoShown
|
||||
* Whether the flex container accordion is displayed.
|
||||
* @param {Boolean} isItemInfoShown
|
||||
* Whether the flex item accordion is displayed.
|
||||
*/
|
||||
sendTelemetryProbes(isContainerInfoShown, isItemInfoShown) {
|
||||
const { telemetry } = this.inspector;
|
||||
|
||||
// Log the type of element being shown now (it can either be a container, or an item
|
||||
// or both at the same time, but can never be none of these since this function is
|
||||
// only ever called when something is being displayed).
|
||||
let elementType = isContainerInfoShown ? "container" : "item";
|
||||
if (isContainerInfoShown && isItemInfoShown) {
|
||||
elementType = "both";
|
||||
}
|
||||
|
||||
telemetry.getHistogramById(TELEMETRY_ELEMENT_TYPE_DISPLAYED).add(elementType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the flexbox panel by dispatching the new flexbox data. This is called when
|
||||
* the layout view becomes visible or a new node is selected and needs to be update
|
||||
|
@ -505,10 +482,6 @@ class FlexboxInspector {
|
|||
highlighted,
|
||||
initiatedByMarkupViewSelection,
|
||||
}));
|
||||
|
||||
const isContainerInfoShown = !flexContainer.flexItemShown || !!flexItemContainer;
|
||||
const isItemInfoShown = !!flexContainer.flexItemShown || !!flexItemContainer;
|
||||
this.sendTelemetryProbes(isContainerInfoShown, isItemInfoShown);
|
||||
} catch (e) {
|
||||
// This call might fail if called asynchrously after the toolbox is finished
|
||||
// closing.
|
||||
|
|
|
@ -24,47 +24,24 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" // Make sure that the DOM is not already loaded\n" +
|
||||
" if (!jQuery.isReady) {\n" +
|
||||
" // Remember that the DOM is ready\n" +
|
||||
" jQuery.isReady = true;\n" +
|
||||
"\n" +
|
||||
" // If there are functions bound, to execute\n" +
|
||||
" if (jQuery.readyList) {\n" +
|
||||
" // Execute all of them\n" +
|
||||
" for (var i = 0; i < jQuery.readyList.length; i++)\n" +
|
||||
" jQuery.readyList[i].apply(document);\n" +
|
||||
"\n" +
|
||||
" // Reset the list of functions\n" +
|
||||
" jQuery.readyList = null;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
filename: URL_ROOT + TEST_LIB + ":1117",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" // Make sure that the DOM is not already loaded\n" +
|
||||
" if (!jQuery.isReady) {\n" +
|
||||
" // Remember that the DOM is ready\n" +
|
||||
" jQuery.isReady = true;\n" +
|
||||
"\n" +
|
||||
" // If there are functions bound, to execute\n" +
|
||||
" if (jQuery.readyList) {\n" +
|
||||
" // Execute all of them\n" +
|
||||
" for (var i = 0; i < jQuery.readyList.length; i++)\n" +
|
||||
" jQuery.readyList[i].apply(document);\n" +
|
||||
"\n" +
|
||||
" // Reset the list of functions\n" +
|
||||
" jQuery.readyList = null;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
// Make sure that the DOM is not already loaded
|
||||
if (!jQuery.isReady) {
|
||||
// Remember that the DOM is ready
|
||||
jQuery.isReady = true;
|
||||
|
||||
// If there are functions bound, to execute
|
||||
if (jQuery.readyList) {
|
||||
// Execute all of them
|
||||
for (var i = 0; i < jQuery.readyList.length; i++)
|
||||
jQuery.readyList[i].apply(document);
|
||||
|
||||
// Reset the list of functions
|
||||
jQuery.readyList = null;
|
||||
}
|
||||
}
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -73,59 +50,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -134,28 +112,29 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return;\n" +
|
||||
"\n" +
|
||||
" event = event || jQuery.event.fix(window.event);\n" +
|
||||
"\n" +
|
||||
" // If no correct event was found, fail\n" +
|
||||
" if (!event) return;\n" +
|
||||
"\n" +
|
||||
" var returnValue = true;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" if (c[j].apply(this, [event]) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(event) {
|
||||
if (typeof jQuery == "undefined") return;
|
||||
|
||||
event = event || jQuery.event.fix(window.event);
|
||||
|
||||
// If no correct event was found, fail
|
||||
if (!event) return;
|
||||
|
||||
var returnValue = true;
|
||||
|
||||
var c = this.events[event.type];
|
||||
|
||||
for (var j in c) {
|
||||
if (c[j].apply(this, [event]) === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -168,9 +147,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -178,9 +158,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -189,28 +170,29 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return;\n" +
|
||||
"\n" +
|
||||
" event = event || jQuery.event.fix(window.event);\n" +
|
||||
"\n" +
|
||||
" // If no correct event was found, fail\n" +
|
||||
" if (!event) return;\n" +
|
||||
"\n" +
|
||||
" var returnValue = true;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" if (c[j].apply(this, [event]) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(event) {
|
||||
if (typeof jQuery == "undefined") return;
|
||||
|
||||
event = event || jQuery.event.fix(window.event);
|
||||
|
||||
// If no correct event was found, fail
|
||||
if (!event) return;
|
||||
|
||||
var returnValue = true;
|
||||
|
||||
var c = this.events[event.type];
|
||||
|
||||
for (var j in c) {
|
||||
if (c[j].apply(this, [event]) === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -218,9 +200,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -229,28 +212,29 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return;\n" +
|
||||
"\n" +
|
||||
" event = event || jQuery.event.fix(window.event);\n" +
|
||||
"\n" +
|
||||
" // If no correct event was found, fail\n" +
|
||||
" if (!event) return;\n" +
|
||||
"\n" +
|
||||
" var returnValue = true;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" if (c[j].apply(this, [event]) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(event) {
|
||||
if (typeof jQuery == "undefined") return;
|
||||
|
||||
event = event || jQuery.event.fix(window.event);
|
||||
|
||||
// If no correct event was found, fail
|
||||
if (!event) return;
|
||||
|
||||
var returnValue = true;
|
||||
|
||||
var c = this.events[event.type];
|
||||
|
||||
for (var j in c) {
|
||||
if (c[j].apply(this, [event]) === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -17,34 +17,6 @@ const TEST_DATA = [
|
|||
{
|
||||
selector: "html",
|
||||
expected: [
|
||||
{
|
||||
type: "load",
|
||||
filename: URL_ROOT + TEST_LIB + ":1387",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" // Make sure that the DOM is not already loaded\n" +
|
||||
" if (!jQuery.isReady) {\n" +
|
||||
" // Remember that the DOM is ready\n" +
|
||||
" jQuery.isReady = true;\n" +
|
||||
"\n" +
|
||||
" // If there are functions bound, to execute\n" +
|
||||
" if (jQuery.readyList) {\n" +
|
||||
" // Execute all of them\n" +
|
||||
" jQuery.each(jQuery.readyList, function() {\n" +
|
||||
" this.apply(document);\n" +
|
||||
" });\n" +
|
||||
"\n" +
|
||||
" // Reset the list of functions\n" +
|
||||
" jQuery.readyList = null;\n" +
|
||||
" }\n" +
|
||||
" // Remove event lisenter to avoid memory leak\n" +
|
||||
" if (jQuery.browser.mozilla || jQuery.browser.opera)\n" +
|
||||
" document.removeEventListener(\"DOMContentLoaded\", jQuery.ready, false);\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
filename: TEST_URL + ":27",
|
||||
|
@ -52,59 +24,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -113,38 +86,39 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return false;\n" +
|
||||
"\n" +
|
||||
" // Empty object is for triggered events with no data\n" +
|
||||
" event = jQuery.event.fix(event || window.event || {});\n" +
|
||||
"\n" +
|
||||
" // returned undefined or false\n" +
|
||||
" var returnValue;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" var args = [].slice.call(arguments, 1);\n" +
|
||||
" args.unshift(event);\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" // Pass in a reference to the handler function itself\n" +
|
||||
" // So that we can later remove it\n" +
|
||||
" args[0].handler = c[j];\n" +
|
||||
" args[0].data = c[j].data;\n" +
|
||||
"\n" +
|
||||
" if (c[j].apply(this, args) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" // Clean up added properties in IE to prevent memory leak\n" +
|
||||
" if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(event) {
|
||||
if (typeof jQuery == "undefined") return false;
|
||||
|
||||
// Empty object is for triggered events with no data
|
||||
event = jQuery.event.fix(event || window.event || {});
|
||||
|
||||
// returned undefined or false
|
||||
var returnValue;
|
||||
|
||||
var c = this.events[event.type];
|
||||
|
||||
var args = [].slice.call(arguments, 1);
|
||||
args.unshift(event);
|
||||
|
||||
for (var j in c) {
|
||||
// Pass in a reference to the handler function itself
|
||||
// So that we can later remove it
|
||||
args[0].handler = c[j];
|
||||
args[0].data = c[j].data;
|
||||
|
||||
if (c[j].apply(this, args) === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up added properties in IE to prevent memory leak
|
||||
if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;
|
||||
|
||||
return returnValue;
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -157,9 +131,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -167,9 +142,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -178,38 +154,39 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return false;\n" +
|
||||
"\n" +
|
||||
" // Empty object is for triggered events with no data\n" +
|
||||
" event = jQuery.event.fix(event || window.event || {});\n" +
|
||||
"\n" +
|
||||
" // returned undefined or false\n" +
|
||||
" var returnValue;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" var args = [].slice.call(arguments, 1);\n" +
|
||||
" args.unshift(event);\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" // Pass in a reference to the handler function itself\n" +
|
||||
" // So that we can later remove it\n" +
|
||||
" args[0].handler = c[j];\n" +
|
||||
" args[0].data = c[j].data;\n" +
|
||||
"\n" +
|
||||
" if (c[j].apply(this, args) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" // Clean up added properties in IE to prevent memory leak\n" +
|
||||
" if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(event) {
|
||||
if (typeof jQuery == "undefined") return false;
|
||||
|
||||
// Empty object is for triggered events with no data
|
||||
event = jQuery.event.fix(event || window.event || {});
|
||||
|
||||
// returned undefined or false
|
||||
var returnValue;
|
||||
|
||||
var c = this.events[event.type];
|
||||
|
||||
var args = [].slice.call(arguments, 1);
|
||||
args.unshift(event);
|
||||
|
||||
for (var j in c) {
|
||||
// Pass in a reference to the handler function itself
|
||||
// So that we can later remove it
|
||||
args[0].handler = c[j];
|
||||
args[0].data = c[j].data;
|
||||
|
||||
if (c[j].apply(this, args) === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up added properties in IE to prevent memory leak
|
||||
if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;
|
||||
|
||||
return returnValue;
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -217,9 +194,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -228,38 +206,39 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return false;\n" +
|
||||
"\n" +
|
||||
" // Empty object is for triggered events with no data\n" +
|
||||
" event = jQuery.event.fix(event || window.event || {});\n" +
|
||||
"\n" +
|
||||
" // returned undefined or false\n" +
|
||||
" var returnValue;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" var args = [].slice.call(arguments, 1);\n" +
|
||||
" args.unshift(event);\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" // Pass in a reference to the handler function itself\n" +
|
||||
" // So that we can later remove it\n" +
|
||||
" args[0].handler = c[j];\n" +
|
||||
" args[0].data = c[j].data;\n" +
|
||||
"\n" +
|
||||
" if (c[j].apply(this, args) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" // Clean up added properties in IE to prevent memory leak\n" +
|
||||
" if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(event) {
|
||||
if (typeof jQuery == "undefined") return false;
|
||||
|
||||
// Empty object is for triggered events with no data
|
||||
event = jQuery.event.fix(event || window.event || {});
|
||||
|
||||
// returned undefined or false
|
||||
var returnValue;
|
||||
|
||||
var c = this.events[event.type];
|
||||
|
||||
var args = [].slice.call(arguments, 1);
|
||||
args.unshift(event);
|
||||
|
||||
for (var j in c) {
|
||||
// Pass in a reference to the handler function itself
|
||||
// So that we can later remove it
|
||||
args[0].handler = c[j];
|
||||
args[0].data = c[j].data;
|
||||
|
||||
if (c[j].apply(this, args) === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up added properties in IE to prevent memory leak
|
||||
if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;
|
||||
|
||||
return returnValue;
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -24,59 +24,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -90,9 +91,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -100,9 +102,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -110,9 +113,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -127,9 +131,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragEnd() {
|
||||
alert(4);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragleave",
|
||||
|
@ -138,9 +143,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragLeave() {
|
||||
alert(3);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragover",
|
||||
|
@ -149,9 +155,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragOver() {
|
||||
alert(6);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "drop",
|
||||
|
@ -160,9 +167,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDrop() {
|
||||
alert(5);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -24,100 +24,61 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
filename: URL_ROOT + TEST_LIB,
|
||||
attributes: [
|
||||
"Bubbling",
|
||||
"DOM0"
|
||||
],
|
||||
handler: "function(event) {\n" +
|
||||
" if (typeof jQuery == \"undefined\") return false;\n" +
|
||||
"\n" +
|
||||
" // Empty object is for triggered events with no data\n" +
|
||||
" event = jQuery.event.fix(event || window.event || {});\n" +
|
||||
"\n" +
|
||||
" // returned undefined or false\n" +
|
||||
" var returnValue;\n" +
|
||||
"\n" +
|
||||
" var c = this.events[event.type];\n" +
|
||||
"\n" +
|
||||
" var args = [].slice.call(arguments, 1);\n" +
|
||||
" args.unshift(event);\n" +
|
||||
"\n" +
|
||||
" for (var j in c) {\n" +
|
||||
" // Pass in a reference to the handler function itself\n" +
|
||||
" // So that we can later remove it\n" +
|
||||
" args[0].handler = c[j];\n" +
|
||||
" args[0].data = c[j].data;\n" +
|
||||
"\n" +
|
||||
" if (c[j].apply(this, args) === false) {\n" +
|
||||
" event.preventDefault();\n" +
|
||||
" event.stopPropagation();\n" +
|
||||
" returnValue = false;\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" // Clean up added properties in IE to prevent memory leak\n" +
|
||||
" if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;\n" +
|
||||
"\n" +
|
||||
" return returnValue;\n" +
|
||||
"}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -129,9 +90,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -139,9 +101,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -150,12 +113,13 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" var val;\n" +
|
||||
" if (typeof jQuery == \"undefined\" || jQuery.event.triggered) return val;\n" +
|
||||
" val = jQuery.event.handle.apply(element, arguments);\n" +
|
||||
" return val;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
var val;
|
||||
if (typeof jQuery == "undefined" || jQuery.event.triggered) return val;
|
||||
val = jQuery.event.handle.apply(element, arguments);
|
||||
return val;
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -163,9 +127,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -174,12 +139,13 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" var val;\n" +
|
||||
" if (typeof jQuery == \"undefined\" || jQuery.event.triggered) return val;\n" +
|
||||
" val = jQuery.event.handle.apply(element, arguments);\n" +
|
||||
" return val;\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
var val;
|
||||
if (typeof jQuery == "undefined" || jQuery.event.triggered) return val;
|
||||
val = jQuery.event.handle.apply(element, arguments);
|
||||
return val;
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -17,35 +17,6 @@ const TEST_DATA = [
|
|||
{
|
||||
selector: "html",
|
||||
expected: [
|
||||
{
|
||||
type: "dblclick",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function c(G) {\n" +
|
||||
" var D = RegExp(\"(^|\\\\.)\" + G.type + \"(\\\\.|$)\"),\n" +
|
||||
" F = true,\n" +
|
||||
" E = [];\n" +
|
||||
" n.each(n.data(this, \"events\").live || [], function(H, I) {\n" +
|
||||
" if (D.test(I.type)) {\n" +
|
||||
" var J = n(G.target).closest(I.data)[0];\n" +
|
||||
" if (J) {\n" +
|
||||
" E.push({\n" +
|
||||
" elem: J,\n" +
|
||||
" fn: I\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" });\n" +
|
||||
" n.each(E, function() {\n" +
|
||||
" if (!G.isImmediatePropagationStopped() && " + "this.fn.call(this.elem, G, this.fn.data) === false) {\n" +
|
||||
" F = false\n" +
|
||||
" }\n" +
|
||||
" });\n" +
|
||||
" return F\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "DOMContentLoaded",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
|
@ -53,78 +24,11 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" document.removeEventListener(\"DOMContentLoaded\", arguments.callee, false);\n" +
|
||||
" n.ready()\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function c(G) {\n" +
|
||||
" var D = RegExp(\"(^|\\\\.)\" + G.type + \"(\\\\.|$)\"),\n" +
|
||||
" F = true,\n" +
|
||||
" E = [];\n" +
|
||||
" n.each(n.data(this, \"events\").live || [], function(H, I) {\n" +
|
||||
" if (D.test(I.type)) {\n" +
|
||||
" var J = n(G.target).closest(I.data)[0];\n" +
|
||||
" if (J) {\n" +
|
||||
" E.push({\n" +
|
||||
" elem: J,\n" +
|
||||
" fn: I\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" });\n" +
|
||||
" n.each(E, function() {\n" +
|
||||
" if (!G.isImmediatePropagationStopped() && " + "this.fn.call(this.elem, G, this.fn.data) === false) {\n" +
|
||||
" F = false\n" +
|
||||
" }\n" +
|
||||
" });\n" +
|
||||
" return F\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "live",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return E.apply(this, arguments)\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "live",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return E.apply(this, arguments)\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" if (!n.isReady) {\n" +
|
||||
" n.isReady = true;\n" +
|
||||
" if (n.readyList) {\n" +
|
||||
" n.each(n.readyList, function() {\n" +
|
||||
" this.call(document, n)\n" +
|
||||
" });\n" +
|
||||
" n.readyList = null\n" +
|
||||
" }\n" +
|
||||
" n(document).triggerHandler(\"ready\")\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
document.removeEventListener("DOMContentLoaded", arguments.callee, false);
|
||||
n.ready()
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -133,70 +37,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "unload",
|
||||
filename: URL_ROOT + TEST_LIB + ":19",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function(H) {\n" +
|
||||
" n(this).unbind(H, D);\n" +
|
||||
" return (E || G).apply(this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -209,9 +103,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -219,9 +114,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -229,9 +125,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -245,9 +142,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return E.apply(this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
return E.apply(this, arguments)
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
|
@ -256,9 +154,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return E.apply(this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
return E.apply(this, arguments)
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -17,16 +17,6 @@ const TEST_DATA = [
|
|||
{
|
||||
selector: "html",
|
||||
expected: [
|
||||
{
|
||||
type: "dblclick",
|
||||
filename: URL_ROOT + TEST_LIB + ":31",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return a.apply(d || this, arguments)\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "DOMContentLoaded",
|
||||
filename: URL_ROOT + TEST_LIB + ":32",
|
||||
|
@ -34,20 +24,11 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" s.removeEventListener(\"DOMContentLoaded\", M, false);\n" +
|
||||
" c.ready()\n" +
|
||||
"}"
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
filename: URL_ROOT + TEST_LIB + ":31",
|
||||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return a.apply(d || this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
s.removeEventListener(\"DOMContentLoaded\", M, false);
|
||||
c.ready()
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -56,59 +37,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -117,17 +99,18 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" if (!c.isReady) {\n" +
|
||||
" if (!s.body) return setTimeout(c.ready, 13);\n" +
|
||||
" c.isReady = true;\n" +
|
||||
" if (Q) {\n" +
|
||||
" for (var a, b = 0; a = Q[b++];) a.call(s, c);\n" +
|
||||
" Q = null\n" +
|
||||
" }\n" +
|
||||
" c.fn.triggerHandler && c(s).triggerHandler(\"ready\")\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
if (!c.isReady) {
|
||||
if (!s.body) return setTimeout(c.ready, 13);
|
||||
c.isReady = true;
|
||||
if (Q) {
|
||||
for (var a, b = 0; a = Q[b++];) a.call(s, c);
|
||||
Q = null
|
||||
}
|
||||
c.fn.triggerHandler && c(s).triggerHandler("ready")
|
||||
}
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -140,9 +123,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -150,9 +134,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -160,9 +145,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -176,9 +162,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return a.apply(d || this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
return a.apply(d || this, arguments)
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dblclick",
|
||||
|
@ -187,9 +174,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return a.apply(d || this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
return a.apply(d || this, arguments)
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
|
@ -198,9 +186,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return a.apply(d || this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
return a.apply(d || this, arguments)
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
|
@ -209,9 +198,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" return a.apply(d || this, arguments)\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
return a.apply(d || this, arguments)
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -26,9 +26,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" c.removeEventListener(\"DOMContentLoaded\", z, !1), e.ready()\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
c.removeEventListener("DOMContentLoaded", z, !1), e.ready()
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -37,59 +38,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -98,14 +100,15 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(a) {\n" +
|
||||
" if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) {\n" +
|
||||
" if (!c.body) return setTimeout(e.ready, 1);\n" +
|
||||
" e.isReady = !0;\n" +
|
||||
" if (a !== !0 && --e.readyWait > 0) return;\n" +
|
||||
" y.resolveWith(c, [e]), e.fn.trigger && e(c).trigger(\"ready\").unbind(\"ready\")\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(a) {
|
||||
if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) {
|
||||
if (!c.body) return setTimeout(e.ready, 1);
|
||||
e.isReady = !0;
|
||||
if (a !== !0 && --e.readyWait > 0) return;
|
||||
y.resolveWith(c, [e]), e.fn.trigger && e(c).trigger("ready").unbind("ready")
|
||||
}
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -118,9 +121,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -128,9 +132,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -138,9 +143,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -154,9 +160,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDblClick() {
|
||||
alert(1);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dblclick",
|
||||
|
@ -165,42 +172,43 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function M(a) {\n" +
|
||||
" var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],\n" +
|
||||
" q = [],\n" +
|
||||
" r = f._data(this, \"events\");\n" +
|
||||
" if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === \"click\")) {\n" +
|
||||
" a.namespace && (n = new RegExp(\"(^|\\\\.)\" + a.namespace.split(\".\").join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\")), a.liveFired = this;\n" +
|
||||
" var s = r.live.slice(0);\n" +
|
||||
" for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, \"\") === a.type ? q.push(g.selector) : s.splice(i--, 1);\n" +
|
||||
" e = f(a.target).closest(q, a.currentTarget);\n" +
|
||||
" for (j = 0, k = e.length; j < k; j++) {\n" +
|
||||
" m = e[j];\n" +
|
||||
" for (i = 0; i < s.length; i++) {\n" +
|
||||
" g = s[i];\n" +
|
||||
" if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {\n" +
|
||||
" h = m.elem, d = null;\n" +
|
||||
" if (g.preType === \"mouseenter\" || g.preType === \"mouseleave\") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);\n" +
|
||||
" (!d || d !== h) && p.push({\n" +
|
||||
" elem: h,\n" +
|
||||
" handleObj: g,\n" +
|
||||
" level: m.level\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" for (j = 0, k = p.length; j < k; j++) {\n" +
|
||||
" e = p[j];\n" +
|
||||
" if (c && e.level > c) break;\n" +
|
||||
" a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);\n" +
|
||||
" if (o === !1 || a.isPropagationStopped()) {\n" +
|
||||
" c = e.level, o === !1 && (b = !1);\n" +
|
||||
" if (a.isImmediatePropagationStopped()) break\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return b\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function M(a) {
|
||||
var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],
|
||||
q = [],
|
||||
r = f._data(this, "events");
|
||||
if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === "click")) {
|
||||
a.namespace && (n = new RegExp("(^|\\\\.)" + a.namespace.split(".").join("\\\\.(?:.*\\\\.)?") + "(\\\\.|$)")), a.liveFired = this;
|
||||
var s = r.live.slice(0);
|
||||
for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, "") === a.type ? q.push(g.selector) : s.splice(i--, 1);
|
||||
e = f(a.target).closest(q, a.currentTarget);
|
||||
for (j = 0, k = e.length; j < k; j++) {
|
||||
m = e[j];
|
||||
for (i = 0; i < s.length; i++) {
|
||||
g = s[i];
|
||||
if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {
|
||||
h = m.elem, d = null;
|
||||
if (g.preType === "mouseenter" || g.preType === "mouseleave") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);
|
||||
(!d || d !== h) && p.push({
|
||||
elem: h,
|
||||
handleObj: g,
|
||||
level: m.level
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = 0, k = p.length; j < k; j++) {
|
||||
e = p[j];
|
||||
if (c && e.level > c) break;
|
||||
a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);
|
||||
if (o === !1 || a.isPropagationStopped()) {
|
||||
c = e.level, o === !1 && (b = !1);
|
||||
if (a.isImmediatePropagationStopped()) break
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragend",
|
||||
|
@ -209,9 +217,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragEnd() {
|
||||
alert(4);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragend",
|
||||
|
@ -220,42 +229,43 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function M(a) {\n" +
|
||||
" var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],\n" +
|
||||
" q = [],\n" +
|
||||
" r = f._data(this, \"events\");\n" +
|
||||
" if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === \"click\")) {\n" +
|
||||
" a.namespace && (n = new RegExp(\"(^|\\\\.)\" + a.namespace.split(\".\").join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\")), a.liveFired = this;\n" +
|
||||
" var s = r.live.slice(0);\n" +
|
||||
" for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, \"\") === a.type ? q.push(g.selector) : s.splice(i--, 1);\n" +
|
||||
" e = f(a.target).closest(q, a.currentTarget);\n" +
|
||||
" for (j = 0, k = e.length; j < k; j++) {\n" +
|
||||
" m = e[j];\n" +
|
||||
" for (i = 0; i < s.length; i++) {\n" +
|
||||
" g = s[i];\n" +
|
||||
" if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {\n" +
|
||||
" h = m.elem, d = null;\n" +
|
||||
" if (g.preType === \"mouseenter\" || g.preType === \"mouseleave\") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);\n" +
|
||||
" (!d || d !== h) && p.push({\n" +
|
||||
" elem: h,\n" +
|
||||
" handleObj: g,\n" +
|
||||
" level: m.level\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" for (j = 0, k = p.length; j < k; j++) {\n" +
|
||||
" e = p[j];\n" +
|
||||
" if (c && e.level > c) break;\n" +
|
||||
" a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);\n" +
|
||||
" if (o === !1 || a.isPropagationStopped()) {\n" +
|
||||
" c = e.level, o === !1 && (b = !1);\n" +
|
||||
" if (a.isImmediatePropagationStopped()) break\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return b\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function M(a) {
|
||||
var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],
|
||||
q = [],
|
||||
r = f._data(this, "events");
|
||||
if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === "click")) {
|
||||
a.namespace && (n = new RegExp("(^|\\\\.)" + a.namespace.split(".").join("\\\\.(?:.*\\\\.)?") + "(\\\\.|$)")), a.liveFired = this;
|
||||
var s = r.live.slice(0);
|
||||
for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, "") === a.type ? q.push(g.selector) : s.splice(i--, 1);
|
||||
e = f(a.target).closest(q, a.currentTarget);
|
||||
for (j = 0, k = e.length; j < k; j++) {
|
||||
m = e[j];
|
||||
for (i = 0; i < s.length; i++) {
|
||||
g = s[i];
|
||||
if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {
|
||||
h = m.elem, d = null;
|
||||
if (g.preType === "mouseenter" || g.preType === "mouseleave") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);
|
||||
(!d || d !== h) && p.push({
|
||||
elem: h,
|
||||
handleObj: g,
|
||||
level: m.level
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = 0, k = p.length; j < k; j++) {
|
||||
e = p[j];
|
||||
if (c && e.level > c) break;
|
||||
a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);
|
||||
if (o === !1 || a.isPropagationStopped()) {
|
||||
c = e.level, o === !1 && (b = !1);
|
||||
if (a.isImmediatePropagationStopped()) break
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragleave",
|
||||
|
@ -264,9 +274,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragLeave() {
|
||||
alert(3);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragleave",
|
||||
|
@ -275,42 +286,43 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function M(a) {\n" +
|
||||
" var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],\n" +
|
||||
" q = [],\n" +
|
||||
" r = f._data(this, \"events\");\n" +
|
||||
" if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === \"click\")) {\n" +
|
||||
" a.namespace && (n = new RegExp(\"(^|\\\\.)\" + a.namespace.split(\".\").join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\")), a.liveFired = this;\n" +
|
||||
" var s = r.live.slice(0);\n" +
|
||||
" for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, \"\") === a.type ? q.push(g.selector) : s.splice(i--, 1);\n" +
|
||||
" e = f(a.target).closest(q, a.currentTarget);\n" +
|
||||
" for (j = 0, k = e.length; j < k; j++) {\n" +
|
||||
" m = e[j];\n" +
|
||||
" for (i = 0; i < s.length; i++) {\n" +
|
||||
" g = s[i];\n" +
|
||||
" if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {\n" +
|
||||
" h = m.elem, d = null;\n" +
|
||||
" if (g.preType === \"mouseenter\" || g.preType === \"mouseleave\") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);\n" +
|
||||
" (!d || d !== h) && p.push({\n" +
|
||||
" elem: h,\n" +
|
||||
" handleObj: g,\n" +
|
||||
" level: m.level\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" for (j = 0, k = p.length; j < k; j++) {\n" +
|
||||
" e = p[j];\n" +
|
||||
" if (c && e.level > c) break;\n" +
|
||||
" a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);\n" +
|
||||
" if (o === !1 || a.isPropagationStopped()) {\n" +
|
||||
" c = e.level, o === !1 && (b = !1);\n" +
|
||||
" if (a.isImmediatePropagationStopped()) break\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return b\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function M(a) {
|
||||
var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],
|
||||
q = [],
|
||||
r = f._data(this, "events");
|
||||
if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === "click")) {
|
||||
a.namespace && (n = new RegExp("(^|\\\\.)" + a.namespace.split(".").join("\\\\.(?:.*\\\\.)?") + "(\\\\.|$)")), a.liveFired = this;
|
||||
var s = r.live.slice(0);
|
||||
for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, "") === a.type ? q.push(g.selector) : s.splice(i--, 1);
|
||||
e = f(a.target).closest(q, a.currentTarget);
|
||||
for (j = 0, k = e.length; j < k; j++) {
|
||||
m = e[j];
|
||||
for (i = 0; i < s.length; i++) {
|
||||
g = s[i];
|
||||
if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {
|
||||
h = m.elem, d = null;
|
||||
if (g.preType === "mouseenter" || g.preType === "mouseleave") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);
|
||||
(!d || d !== h) && p.push({
|
||||
elem: h,
|
||||
handleObj: g,
|
||||
level: m.level
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = 0, k = p.length; j < k; j++) {
|
||||
e = p[j];
|
||||
if (c && e.level > c) break;
|
||||
a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);
|
||||
if (o === !1 || a.isPropagationStopped()) {
|
||||
c = e.level, o === !1 && (b = !1);
|
||||
if (a.isImmediatePropagationStopped()) break
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
|
@ -319,9 +331,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragStart() {
|
||||
alert(2);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
|
@ -330,42 +343,43 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function M(a) {\n" +
|
||||
" var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],\n" +
|
||||
" q = [],\n" +
|
||||
" r = f._data(this, \"events\");\n" +
|
||||
" if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === \"click\")) {\n" +
|
||||
" a.namespace && (n = new RegExp(\"(^|\\\\.)\" + a.namespace.split(\".\").join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\")), a.liveFired = this;\n" +
|
||||
" var s = r.live.slice(0);\n" +
|
||||
" for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, \"\") === a.type ? q.push(g.selector) : s.splice(i--, 1);\n" +
|
||||
" e = f(a.target).closest(q, a.currentTarget);\n" +
|
||||
" for (j = 0, k = e.length; j < k; j++) {\n" +
|
||||
" m = e[j];\n" +
|
||||
" for (i = 0; i < s.length; i++) {\n" +
|
||||
" g = s[i];\n" +
|
||||
" if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {\n" +
|
||||
" h = m.elem, d = null;\n" +
|
||||
" if (g.preType === \"mouseenter\" || g.preType === \"mouseleave\") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);\n" +
|
||||
" (!d || d !== h) && p.push({\n" +
|
||||
" elem: h,\n" +
|
||||
" handleObj: g,\n" +
|
||||
" level: m.level\n" +
|
||||
" })\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" for (j = 0, k = p.length; j < k; j++) {\n" +
|
||||
" e = p[j];\n" +
|
||||
" if (c && e.level > c) break;\n" +
|
||||
" a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);\n" +
|
||||
" if (o === !1 || a.isPropagationStopped()) {\n" +
|
||||
" c = e.level, o === !1 && (b = !1);\n" +
|
||||
" if (a.isImmediatePropagationStopped()) break\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" return b\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function M(a) {
|
||||
var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [],
|
||||
q = [],
|
||||
r = f._data(this, "events");
|
||||
if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === "click")) {
|
||||
a.namespace && (n = new RegExp("(^|\\\\.)" + a.namespace.split(".").join("\\\\.(?:.*\\\\.)?") + "(\\\\.|$)")), a.liveFired = this;
|
||||
var s = r.live.slice(0);
|
||||
for (i = 0; i < s.length; i++) g = s[i], g.origType.replace(x, "") === a.type ? q.push(g.selector) : s.splice(i--, 1);
|
||||
e = f(a.target).closest(q, a.currentTarget);
|
||||
for (j = 0, k = e.length; j < k; j++) {
|
||||
m = e[j];
|
||||
for (i = 0; i < s.length; i++) {
|
||||
g = s[i];
|
||||
if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled) {
|
||||
h = m.elem, d = null;
|
||||
if (g.preType === "mouseenter" || g.preType === "mouseleave") a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h);
|
||||
(!d || d !== h) && p.push({
|
||||
elem: h,
|
||||
handleObj: g,
|
||||
level: m.level
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
for (j = 0, k = p.length; j < k; j++) {
|
||||
e = p[j];
|
||||
if (c && e.level > c) break;
|
||||
a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments);
|
||||
if (o === !1 || a.isPropagationStopped()) {
|
||||
c = e.level, o === !1 && (b = !1);
|
||||
if (a.isImmediatePropagationStopped()) break
|
||||
}
|
||||
}
|
||||
return b
|
||||
}
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -26,9 +26,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {\n" +
|
||||
" c.removeEventListener(\"DOMContentLoaded\", C, !1), e.ready()\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function() {
|
||||
c.removeEventListener("DOMContentLoaded", C, !1), e.ready()
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -37,59 +38,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "load",
|
||||
|
@ -98,14 +100,15 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function(a) {\n" +
|
||||
" if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) {\n" +
|
||||
" if (!c.body) return setTimeout(e.ready, 1);\n" +
|
||||
" e.isReady = !0;\n" +
|
||||
" if (a !== !0 && --e.readyWait > 0) return;\n" +
|
||||
" B.fireWith(c, [e]), e.fn.trigger && e(c).trigger(\"ready\").unbind(\"ready\")\n" +
|
||||
" }\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function(a) {
|
||||
if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady) {
|
||||
if (!c.body) return setTimeout(e.ready, 1);
|
||||
e.isReady = !0;
|
||||
if (a !== !0 && --e.readyWait > 0) return;
|
||||
B.fireWith(c, [e]), e.fn.trigger && e(c).trigger("ready").unbind("ready")
|
||||
}
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -118,9 +121,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -128,9 +132,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -138,9 +143,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -154,9 +160,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDblClick() {
|
||||
alert(1);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragend",
|
||||
|
@ -165,9 +172,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragEnd() {
|
||||
alert(4);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragleave",
|
||||
|
@ -176,9 +184,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragLeave() {
|
||||
alert(3);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragover",
|
||||
|
@ -187,9 +196,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragOver() {
|
||||
alert(6);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragstart",
|
||||
|
@ -198,9 +208,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragStart() {
|
||||
alert(2);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "drop",
|
||||
|
@ -209,9 +220,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDrop() {
|
||||
alert(5);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -26,59 +26,60 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "() => {\n" +
|
||||
" var handler1 = function liveDivDblClick() {\n" +
|
||||
" alert(1);\n" +
|
||||
" };\n" +
|
||||
" var handler2 = function liveDivDragStart() {\n" +
|
||||
" alert(2);\n" +
|
||||
" };\n" +
|
||||
" var handler3 = function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
" };\n" +
|
||||
" var handler4 = function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
" };\n" +
|
||||
" var handler5 = function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
" };\n" +
|
||||
" var handler6 = function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
" };\n" +
|
||||
" var handler7 = function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
" };\n" +
|
||||
" var handler8 = function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
" };\n" +
|
||||
" var handler9 = function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
" };\n" +
|
||||
" var handler10 = function divDragOut() {\n" +
|
||||
" alert(10);\n" +
|
||||
" };\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").live) {\n" +
|
||||
" $(\"#livediv\").live(\"dblclick\", handler1);\n" +
|
||||
" $(\"#livediv\").live(\"dragstart\", handler2);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").delegate) {\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragleave\", handler3);\n" +
|
||||
" $(document).delegate(\"#livediv\", \"dragend\", handler4);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" if ($(\"#livediv\").on) {\n" +
|
||||
" $(document).on(\"drop\", \"#livediv\", handler5);\n" +
|
||||
" $(document).on(\"dragover\", \"#livediv\", handler6);\n" +
|
||||
" $(document).on(\"dragout\", \"#livediv:xxxxx\", handler10);\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" var div = $(\"div\")[0];\n" +
|
||||
" $(div).click(handler7);\n" +
|
||||
" $(div).click(handler8);\n" +
|
||||
" $(div).keydown(handler9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
() => {
|
||||
var handler1 = function liveDivDblClick() {
|
||||
alert(1);
|
||||
};
|
||||
var handler2 = function liveDivDragStart() {
|
||||
alert(2);
|
||||
};
|
||||
var handler3 = function liveDivDragLeave() {
|
||||
alert(3);
|
||||
};
|
||||
var handler4 = function liveDivDragEnd() {
|
||||
alert(4);
|
||||
};
|
||||
var handler5 = function liveDivDrop() {
|
||||
alert(5);
|
||||
};
|
||||
var handler6 = function liveDivDragOver() {
|
||||
alert(6);
|
||||
};
|
||||
var handler7 = function divClick1() {
|
||||
alert(7);
|
||||
};
|
||||
var handler8 = function divClick2() {
|
||||
alert(8);
|
||||
};
|
||||
var handler9 = function divKeyDown() {
|
||||
alert(9);
|
||||
};
|
||||
var handler10 = function divDragOut() {
|
||||
alert(10);
|
||||
};
|
||||
|
||||
if ($("#livediv").live) {
|
||||
$("#livediv").live("dblclick", handler1);
|
||||
$("#livediv").live("dragstart", handler2);
|
||||
}
|
||||
|
||||
if ($("#livediv").delegate) {
|
||||
$(document).delegate("#livediv", "dragleave", handler3);
|
||||
$(document).delegate("#livediv", "dragend", handler4);
|
||||
}
|
||||
|
||||
if ($("#livediv").on) {
|
||||
$(document).on("drop", "#livediv", handler5);
|
||||
$(document).on("dragover", "#livediv", handler6);
|
||||
$(document).on("dragout", "#livediv:xxxxx", handler10);
|
||||
}
|
||||
|
||||
var div = $("div")[0];
|
||||
$(div).click(handler7);
|
||||
$(div).click(handler8);
|
||||
$(div).keydown(handler9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -91,9 +92,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick1() {\n" +
|
||||
" alert(7);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick1() {
|
||||
alert(7);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "click",
|
||||
|
@ -101,9 +103,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divClick2() {\n" +
|
||||
" alert(8);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divClick2() {
|
||||
alert(8);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "keydown",
|
||||
|
@ -111,9 +114,10 @@ const TEST_DATA = [
|
|||
attributes: [
|
||||
"jQuery"
|
||||
],
|
||||
handler: "function divKeyDown() {\n" +
|
||||
" alert(9);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function divKeyDown() {
|
||||
alert(9);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -127,9 +131,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragEnd() {\n" +
|
||||
" alert(4);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragEnd() {
|
||||
alert(4);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragleave",
|
||||
|
@ -138,9 +143,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragLeave() {\n" +
|
||||
" alert(3);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragLeave() {
|
||||
alert(3);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "dragover",
|
||||
|
@ -149,9 +155,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDragOver() {\n" +
|
||||
" alert(6);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDragOver() {
|
||||
alert(6);
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "drop",
|
||||
|
@ -160,9 +167,10 @@ const TEST_DATA = [
|
|||
"jQuery",
|
||||
"Live"
|
||||
],
|
||||
handler: "function liveDivDrop() {\n" +
|
||||
" alert(5);\n" +
|
||||
"}"
|
||||
handler: `
|
||||
function liveDivDrop() {
|
||||
alert(5);
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function emptyFunction() {}"
|
||||
handler: `function emptyFunction() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -36,10 +36,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -53,7 +53,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function emptyFunction() {}"
|
||||
handler: `function emptyFunction() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -62,10 +62,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -79,7 +79,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function emptyFunction() {}"
|
||||
handler: `function emptyFunction() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -88,10 +88,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "onMouseUp",
|
||||
|
@ -100,10 +100,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -117,10 +117,10 @@ const TEST_DATA = [
|
|||
"Capturing",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function emptyFunction() {}"
|
||||
handler: `function emptyFunction() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -37,10 +37,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function emptyFunction() {}"
|
||||
handler: `function emptyFunction() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -63,10 +63,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -80,7 +80,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function emptyFunction() {}"
|
||||
handler: `function emptyFunction() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -89,10 +89,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "onMouseUp",
|
||||
|
@ -101,10 +101,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -118,10 +118,10 @@ const TEST_DATA = [
|
|||
"Capturing",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -36,10 +36,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -53,7 +53,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -62,10 +62,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -79,7 +79,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -88,10 +88,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "onMouseUp",
|
||||
|
@ -100,10 +100,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -117,10 +117,10 @@ const TEST_DATA = [
|
|||
"Capturing",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -37,10 +37,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -63,10 +63,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -80,7 +80,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -89,10 +89,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "onMouseUp",
|
||||
|
@ -101,10 +101,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -118,10 +118,10 @@ const TEST_DATA = [
|
|||
"Capturing",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -36,10 +36,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -53,7 +53,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -62,10 +62,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -79,7 +79,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -88,10 +88,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "onMouseUp",
|
||||
|
@ -100,10 +100,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -117,10 +117,10 @@ const TEST_DATA = [
|
|||
"Capturing",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -37,10 +37,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -63,10 +63,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -80,7 +80,7 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"DOM2"
|
||||
],
|
||||
handler: "function() {}"
|
||||
handler: `function() {}`
|
||||
},
|
||||
{
|
||||
type: "onClick",
|
||||
|
@ -89,10 +89,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalFunction() {
|
||||
alert("externalFunction");
|
||||
}`
|
||||
},
|
||||
{
|
||||
type: "onMouseUp",
|
||||
|
@ -101,10 +101,10 @@ const TEST_DATA = [
|
|||
"Bubbling",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
handler: `
|
||||
function inlineFunction() {
|
||||
alert("inlineFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -118,10 +118,10 @@ const TEST_DATA = [
|
|||
"Capturing",
|
||||
"React"
|
||||
],
|
||||
handler:
|
||||
`function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
handler: `
|
||||
function externalCapturingFunction() {
|
||||
alert("externalCapturingFunction");
|
||||
}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
/* import-globals-from helper_diff.js */
|
||||
"use strict";
|
||||
|
||||
const beautify = require("devtools/shared/jsbeautify/beautify");
|
||||
|
||||
loadHelperScript("helper_diff.js");
|
||||
|
||||
/**
|
||||
|
@ -129,7 +131,10 @@ async function checkEventsForNode(test, inspector, testActor) {
|
|||
"We are in expanded state and icon changed");
|
||||
|
||||
const editor = tooltip.eventTooltip._eventEditors.get(contentBox).editor;
|
||||
testDiff(editor.getText(), expected[i].handler,
|
||||
const tidiedHandler = beautify.js(expected[i].handler, {
|
||||
"indent_size": 2,
|
||||
});
|
||||
testDiff(editor.getText(), tidiedHandler,
|
||||
"handler matches for " + cssSelector, ok);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,12 @@ pref("devtools.inspector.fonthighlighter.enabled", true);
|
|||
pref("devtools.inspector.changes.enabled", true);
|
||||
// Enable the new Rules View
|
||||
pref("devtools.inspector.new-rulesview.enabled", false);
|
||||
// Hide the 'scrollable' markup-badges for now
|
||||
// Enable the 'scrollable' markup-badges in nightly only for now
|
||||
#if defined(NIGHTLY_BUILD)
|
||||
pref("devtools.inspector.scrollable-badges.enabled", true);
|
||||
#else
|
||||
pref("devtools.inspector.scrollable-badges.enabled", false);
|
||||
#endif
|
||||
|
||||
// Flexbox preferences
|
||||
pref("devtools.inspector.flexboxHighlighter.enabled", true);
|
||||
|
|
|
@ -71,18 +71,24 @@
|
|||
}
|
||||
|
||||
.frames .frames-group .frames-list {
|
||||
display: block;
|
||||
grid-column: 1 / -1;
|
||||
margin-block-start: 2px;
|
||||
/*
|
||||
* We want to display each frame name on its own row, without having new lines in the
|
||||
* clipboard when copying it. This does the trick.
|
||||
*/
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.frames .frames-group .frames-list .frame {
|
||||
padding-inline-start: 16px;
|
||||
display: block;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.frames .frames-group .frames-list {
|
||||
grid-column: 1 / -1;
|
||||
margin-block-start: 2px;
|
||||
.frames-group .frames-list .title {
|
||||
grid-column: -1 / 1;
|
||||
padding-inline-start: 16px;
|
||||
}
|
||||
|
||||
.frames .frames-group .frames-list .frame:first-of-type {
|
||||
|
|
|
@ -285,7 +285,6 @@ checkbox:-moz-focusring {
|
|||
}
|
||||
|
||||
/* Toolbar buttons */
|
||||
.devtools-menulist,
|
||||
.devtools-toolbarbutton,
|
||||
.devtools-button {
|
||||
-moz-appearance: none;
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче