How to use crash method in Playwright Internal

Best JavaScript code snippet using playwright-internal

test_crash_manager.js

Source:test_crash_manager.js Github

copy

Full Screen

1/* Any copyright is dedicated to the Public Domain.2 * http://creativecommons.org/publicdomain/zero/1.0/ */3"use strict";4var { CrashStore, CrashManager } = ChromeUtils.import(5 "resource://gre/modules/CrashManager.jsm",6 null7);8ChromeUtils.import("resource://gre/modules/osfile.jsm", this);9ChromeUtils.import("resource://gre/modules/Services.jsm", this);10ChromeUtils.import("resource://gre/modules/TelemetryEnvironment.jsm", this);11ChromeUtils.import("resource://testing-common/CrashManagerTest.jsm", this);12ChromeUtils.import(13 "resource://testing-common/TelemetryArchiveTesting.jsm",14 this15);16const DUMMY_DATE = new Date(Date.now() - 10 * 24 * 60 * 60 * 1000);17DUMMY_DATE.setMilliseconds(0);18const DUMMY_DATE_2 = new Date(Date.now() - 20 * 24 * 60 * 60 * 1000);19DUMMY_DATE_2.setMilliseconds(0);20function run_test() {21 do_get_profile();22 configureLogging();23 TelemetryArchiveTesting.setup();24 run_next_test();25}26add_task(async function test_constructor_ok() {27 let m = new CrashManager({28 pendingDumpsDir: "/foo",29 submittedDumpsDir: "/bar",30 eventsDirs: [],31 storeDir: "/baz",32 });33 Assert.ok(m, "CrashManager can be created.");34});35add_task(async function test_constructor_invalid() {36 Assert.throws(() => {37 new CrashManager({ foo: true });38 }, /Unknown property in options/);39});40add_task(async function test_get_manager() {41 let m = await getManager();42 Assert.ok(m, "CrashManager obtained.");43 await m.createDummyDump(true);44 await m.createDummyDump(false);45});46// Unsubmitted dump files on disk are detected properly.47add_task(async function test_pending_dumps() {48 let m = await getManager();49 let now = Date.now();50 let ids = [];51 const COUNT = 5;52 for (let i = 0; i < COUNT; i++) {53 ids.push(await m.createDummyDump(false, new Date(now - i * 86400000)));54 }55 await m.createIgnoredDumpFile("ignored", false);56 let entries = await m.pendingDumps();57 Assert.equal(entries.length, COUNT, "proper number detected.");58 for (let entry of entries) {59 Assert.equal(typeof entry, "object", "entry is an object");60 Assert.ok("id" in entry, "id in entry");61 Assert.ok("path" in entry, "path in entry");62 Assert.ok("date" in entry, "date in entry");63 Assert.notEqual(ids.indexOf(entry.id), -1, "ID is known");64 }65 for (let i = 0; i < COUNT; i++) {66 Assert.equal(entries[i].id, ids[COUNT - i - 1], "Entries sorted by mtime");67 }68});69// Submitted dump files on disk are detected properly.70add_task(async function test_submitted_dumps() {71 let m = await getManager();72 let COUNT = 5;73 for (let i = 0; i < COUNT; i++) {74 await m.createDummyDump(true);75 }76 await m.createIgnoredDumpFile("ignored", true);77 let entries = await m.submittedDumps();78 Assert.equal(entries.length, COUNT, "proper number detected.");79 let hrID = await m.createDummyDump(true, new Date(), true);80 entries = await m.submittedDumps();81 Assert.equal(entries.length, COUNT + 1, "hr- in filename detected.");82 let gotIDs = new Set(entries.map(e => e.id));83 Assert.ok(gotIDs.has(hrID));84});85// The store should expire after inactivity.86add_task(async function test_store_expires() {87 let m = await getManager();88 Object.defineProperty(m, "STORE_EXPIRATION_MS", {89 value: 250,90 });91 let store = await m._getStore();92 Assert.ok(store);93 Assert.equal(store, m._store);94 await sleep(300);95 Assert.ok(!m._store, "Store has gone away.");96});97// Ensure discovery of unprocessed events files works.98add_task(async function test_unprocessed_events_files() {99 let m = await getManager();100 await m.createEventsFile("1", "test.1", new Date(), "foo", "{}", 0);101 await m.createEventsFile("2", "test.1", new Date(), "bar", "{}", 0);102 await m.createEventsFile("1", "test.1", new Date(), "baz", "{}", 1);103 let paths = await m._getUnprocessedEventsFiles();104 Assert.equal(paths.length, 3);105});106// Ensure only 1 aggregateEventsFiles() is allowed at a time.107add_task(async function test_aggregate_events_locking() {108 let m = await getManager();109 let p1 = m.aggregateEventsFiles();110 let p2 = m.aggregateEventsFiles();111 Assert.strictEqual(p1, p2, "Same promise should be returned.");112});113// Malformed events files should be deleted.114add_task(async function test_malformed_files_deleted() {115 let m = await getManager();116 await m.createEventsFile("1", "crash.main.1", new Date(), "foo\nbar");117 let count = await m.aggregateEventsFiles();118 Assert.equal(count, 1);119 let crashes = await m.getCrashes();120 Assert.equal(crashes.length, 0);121 count = await m.aggregateEventsFiles();122 Assert.equal(count, 0);123});124// Unknown event types should be ignored.125add_task(async function test_aggregate_ignore_unknown_events() {126 let m = await getManager();127 await m.createEventsFile("1", "crash.main.3", DUMMY_DATE, "id1", "{}");128 await m.createEventsFile("2", "foobar.1", new Date(), "dummy");129 let count = await m.aggregateEventsFiles();130 Assert.equal(count, 2);131 count = await m.aggregateEventsFiles();132 Assert.equal(count, 1);133 count = await m.aggregateEventsFiles();134 Assert.equal(count, 1);135});136add_task(async function test_prune_old() {137 let m = await getManager();138 let oldDate = new Date(Date.now() - 86400000);139 let newDate = new Date(Date.now() - 10000);140 await m.createEventsFile("1", "crash.main.3", oldDate, "id1", "{}");141 await m.addCrash(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_CRASH, "id2", newDate);142 await m.aggregateEventsFiles();143 let crashes = await m.getCrashes();144 Assert.equal(crashes.length, 2);145 await m.pruneOldCrashes(new Date(oldDate.getTime() + 10000));146 crashes = await m.getCrashes();147 Assert.equal(crashes.length, 1, "Old crash has been pruned.");148 let c = crashes[0];149 Assert.equal(c.id, "id2", "Proper crash was pruned.");150 // We can't test exact boundary conditions because dates from filesystem151 // don't have same guarantees as JS dates.152 await m.pruneOldCrashes(new Date(newDate.getTime() + 5000));153 crashes = await m.getCrashes();154 Assert.equal(crashes.length, 0);155});156add_task(async function test_schedule_maintenance() {157 let m = await getManager();158 await m.createEventsFile("1", "crash.main.3", DUMMY_DATE, "id1", "{}");159 let oldDate = new Date(160 Date.now() - m.PURGE_OLDER_THAN_DAYS * 2 * 24 * 60 * 60 * 1000161 );162 await m.createEventsFile("2", "crash.main.3", oldDate, "id2", "{}");163 await m.scheduleMaintenance(25);164 let crashes = await m.getCrashes();165 Assert.equal(crashes.length, 1);166 Assert.equal(crashes[0].id, "id1");167});168const crashId = "3cb67eba-0dc7-6f78-6a569a0e-172287ec";169const crashPingUuid = "103dbdf2-339b-4b9c-a7cc-5f9506ea9d08";170const productName = "Firefox";171const productId = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";172const sha256Hash =173 "f8410c3ac4496cfa9191a1240f0e365101aef40c7bf34fc5bcb8ec511832ed79";174const stackTraces = { status: "OK" };175add_task(async function test_main_crash_event_file() {176 let ac = new TelemetryArchiveTesting.Checker();177 await ac.promiseInit();178 let theEnvironment = TelemetryEnvironment.currentEnvironment;179 const sessionId = "be66af2f-2ee5-4330-ae95-44462dfbdf0c";180 // To test proper escaping, add data to the environment with an embedded181 // double-quote182 theEnvironment.testValue = 'MyValue"';183 let m = await getManager();184 const metadata = JSON.stringify({185 ProductName: productName,186 ProductID: productId,187 TelemetryEnvironment: JSON.stringify(theEnvironment),188 TelemetrySessionId: sessionId,189 MinidumpSha256Hash: sha256Hash,190 StackTraces: stackTraces,191 ThisShouldNot: "end-up-in-the-ping",192 });193 await m.createEventsFile(194 crashId,195 "crash.main.3",196 DUMMY_DATE,197 crashId,198 metadata199 );200 let count = await m.aggregateEventsFiles();201 Assert.equal(count, 1);202 let crashes = await m.getCrashes();203 Assert.equal(crashes.length, 1);204 Assert.equal(crashes[0].id, crashId);205 Assert.equal(crashes[0].type, "main-crash");206 Assert.equal(crashes[0].metadata.ProductName, productName);207 Assert.equal(crashes[0].metadata.ProductID, productId);208 Assert.ok(crashes[0].metadata.TelemetryEnvironment);209 Assert.equal(Object.getOwnPropertyNames(crashes[0].metadata).length, 7);210 Assert.equal(crashes[0].metadata.TelemetrySessionId, sessionId);211 Assert.ok(crashes[0].metadata.StackTraces);212 Assert.deepEqual(crashes[0].crashDate, DUMMY_DATE);213 let found = await ac.promiseFindPing("crash", [214 [["payload", "hasCrashEnvironment"], true],215 [["payload", "metadata", "ProductName"], productName],216 [["payload", "metadata", "ProductID"], productId],217 [["payload", "minidumpSha256Hash"], sha256Hash],218 [["payload", "crashId"], crashId],219 [["payload", "stackTraces", "status"], "OK"],220 [["payload", "sessionId"], sessionId],221 ]);222 Assert.ok(found, "Telemetry ping submitted for found crash");223 Assert.deepEqual(224 found.environment,225 theEnvironment,226 "The saved environment should be present"227 );228 Assert.equal(229 found.payload.metadata.ThisShouldNot,230 undefined,231 "Non-whitelisted fields should be filtered out"232 );233 count = await m.aggregateEventsFiles();234 Assert.equal(count, 0);235});236add_task(async function test_main_crash_event_file_noenv() {237 let ac = new TelemetryArchiveTesting.Checker();238 await ac.promiseInit();239 const metadata = JSON.stringify({240 ProductName: productName,241 ProductID: productId,242 });243 let m = await getManager();244 await m.createEventsFile(245 crashId,246 "crash.main.3",247 DUMMY_DATE,248 crashId,249 metadata250 );251 let count = await m.aggregateEventsFiles();252 Assert.equal(count, 1);253 let crashes = await m.getCrashes();254 Assert.equal(crashes.length, 1);255 Assert.equal(crashes[0].id, crashId);256 Assert.equal(crashes[0].type, "main-crash");257 Assert.deepEqual(crashes[0].metadata, {258 ProductName: productName,259 ProductID: productId,260 });261 Assert.deepEqual(crashes[0].crashDate, DUMMY_DATE);262 let found = await ac.promiseFindPing("crash", [263 [["payload", "hasCrashEnvironment"], false],264 [["payload", "metadata", "ProductName"], productName],265 [["payload", "metadata", "ProductID"], productId],266 ]);267 Assert.ok(found, "Telemetry ping submitted for found crash");268 Assert.ok(found.environment, "There is an environment");269 count = await m.aggregateEventsFiles();270 Assert.equal(count, 0);271});272add_task(async function test_crash_submission_event_file() {273 let m = await getManager();274 await m.createEventsFile("1", "crash.main.3", DUMMY_DATE, "crash1", "{}");275 await m.createEventsFile(276 "1-submission",277 "crash.submission.1",278 DUMMY_DATE_2,279 "crash1",280 "false\n"281 );282 // The line below has been intentionally commented out to make sure that283 // the crash record is created when one does not exist.284 // yield m.createEventsFile("2", "crash.main.1", DUMMY_DATE, "crash2");285 await m.createEventsFile(286 "2-submission",287 "crash.submission.1",288 DUMMY_DATE_2,289 "crash2",290 "true\nbp-2"291 );292 let count = await m.aggregateEventsFiles();293 Assert.equal(count, 3);294 let crashes = await m.getCrashes();295 Assert.equal(crashes.length, 2);296 let map = new Map(crashes.map(crash => [crash.id, crash]));297 let crash1 = map.get("crash1");298 Assert.ok(!!crash1);299 Assert.equal(crash1.remoteID, null);300 let crash2 = map.get("crash2");301 Assert.ok(!!crash2);302 Assert.equal(crash2.remoteID, "bp-2");303 Assert.equal(crash1.submissions.size, 1);304 let submission = crash1.submissions.values().next().value;305 Assert.equal(submission.result, m.SUBMISSION_RESULT_FAILED);306 Assert.equal(submission.requestDate.getTime(), DUMMY_DATE_2.getTime());307 Assert.equal(submission.responseDate.getTime(), DUMMY_DATE_2.getTime());308 Assert.equal(crash2.submissions.size, 1);309 submission = crash2.submissions.values().next().value;310 Assert.equal(submission.result, m.SUBMISSION_RESULT_OK);311 Assert.equal(submission.requestDate.getTime(), DUMMY_DATE_2.getTime());312 Assert.equal(submission.responseDate.getTime(), DUMMY_DATE_2.getTime());313 count = await m.aggregateEventsFiles();314 Assert.equal(count, 0);315});316add_task(async function test_multiline_crash_id_rejected() {317 let m = await getManager();318 await m.createEventsFile("1", "crash.main.1", DUMMY_DATE, "id1\nid2");319 await m.aggregateEventsFiles();320 let crashes = await m.getCrashes();321 Assert.equal(crashes.length, 0);322});323// Main process crashes should be remembered beyond the high water mark.324add_task(async function test_high_water_mark() {325 let m = await getManager();326 let store = await m._getStore();327 for (let i = 0; i < store.HIGH_WATER_DAILY_THRESHOLD + 1; i++) {328 await m.createEventsFile(329 "m" + i,330 "crash.main.3",331 DUMMY_DATE,332 "m" + i,333 "{}"334 );335 }336 let count = await m.aggregateEventsFiles();337 Assert.equal(count, CrashStore.prototype.HIGH_WATER_DAILY_THRESHOLD + 1);338 // Need to fetch again in case the first one was garbage collected.339 store = await m._getStore();340 Assert.equal(store.crashesCount, store.HIGH_WATER_DAILY_THRESHOLD + 1);341});342add_task(async function test_addCrash() {343 let m = await getManager();344 let crashes = await m.getCrashes();345 Assert.equal(crashes.length, 0);346 await m.addCrash(347 m.PROCESS_TYPE_MAIN,348 m.CRASH_TYPE_CRASH,349 "main-crash",350 DUMMY_DATE351 );352 await m.addCrash(353 m.PROCESS_TYPE_MAIN,354 m.CRASH_TYPE_HANG,355 "main-hang",356 DUMMY_DATE357 );358 await m.addCrash(359 m.PROCESS_TYPE_CONTENT,360 m.CRASH_TYPE_CRASH,361 "content-crash",362 DUMMY_DATE363 );364 await m.addCrash(365 m.PROCESS_TYPE_CONTENT,366 m.CRASH_TYPE_HANG,367 "content-hang",368 DUMMY_DATE369 );370 await m.addCrash(371 m.PROCESS_TYPE_PLUGIN,372 m.CRASH_TYPE_CRASH,373 "plugin-crash",374 DUMMY_DATE375 );376 await m.addCrash(377 m.PROCESS_TYPE_PLUGIN,378 m.CRASH_TYPE_HANG,379 "plugin-hang",380 DUMMY_DATE381 );382 await m.addCrash(383 m.PROCESS_TYPE_GMPLUGIN,384 m.CRASH_TYPE_CRASH,385 "gmplugin-crash",386 DUMMY_DATE387 );388 await m.addCrash(389 m.PROCESS_TYPE_GPU,390 m.CRASH_TYPE_CRASH,391 "gpu-crash",392 DUMMY_DATE393 );394 await m.addCrash(395 m.PROCESS_TYPE_VR,396 m.CRASH_TYPE_CRASH,397 "vr-crash",398 DUMMY_DATE399 );400 await m.addCrash(401 m.PROCESS_TYPE_RDD,402 m.CRASH_TYPE_CRASH,403 "rdd-crash",404 DUMMY_DATE405 );406 await m.addCrash(407 m.PROCESS_TYPE_SOCKET,408 m.CRASH_TYPE_CRASH,409 "socket-crash",410 DUMMY_DATE411 );412 await m.addCrash(413 m.PROCESS_TYPE_MAIN,414 m.CRASH_TYPE_CRASH,415 "changing-item",416 DUMMY_DATE417 );418 await m.addCrash(419 m.PROCESS_TYPE_CONTENT,420 m.CRASH_TYPE_HANG,421 "changing-item",422 DUMMY_DATE_2423 );424 crashes = await m.getCrashes();425 Assert.equal(crashes.length, 12);426 let map = new Map(crashes.map(crash => [crash.id, crash]));427 let crash = map.get("main-crash");428 Assert.ok(!!crash);429 Assert.equal(crash.crashDate, DUMMY_DATE);430 Assert.equal(crash.type, m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_CRASH);431 Assert.ok(crash.isOfType(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH));432 crash = map.get("main-hang");433 Assert.ok(!!crash);434 Assert.equal(crash.crashDate, DUMMY_DATE);435 Assert.equal(crash.type, m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_HANG);436 Assert.ok(crash.isOfType(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_HANG));437 crash = map.get("content-crash");438 Assert.ok(!!crash);439 Assert.equal(crash.crashDate, DUMMY_DATE);440 Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_CRASH);441 Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_CRASH));442 crash = map.get("content-hang");443 Assert.ok(!!crash);444 Assert.equal(crash.crashDate, DUMMY_DATE);445 Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_HANG);446 Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG));447 crash = map.get("plugin-crash");448 Assert.ok(!!crash);449 Assert.equal(crash.crashDate, DUMMY_DATE);450 Assert.equal(crash.type, m.PROCESS_TYPE_PLUGIN + "-" + m.CRASH_TYPE_CRASH);451 Assert.ok(crash.isOfType(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_CRASH));452 crash = map.get("plugin-hang");453 Assert.ok(!!crash);454 Assert.equal(crash.crashDate, DUMMY_DATE);455 Assert.equal(crash.type, m.PROCESS_TYPE_PLUGIN + "-" + m.CRASH_TYPE_HANG);456 Assert.ok(crash.isOfType(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_HANG));457 crash = map.get("gmplugin-crash");458 Assert.ok(!!crash);459 Assert.equal(crash.crashDate, DUMMY_DATE);460 Assert.equal(crash.type, m.PROCESS_TYPE_GMPLUGIN + "-" + m.CRASH_TYPE_CRASH);461 Assert.ok(crash.isOfType(m.PROCESS_TYPE_GMPLUGIN, m.CRASH_TYPE_CRASH));462 crash = map.get("gpu-crash");463 Assert.ok(!!crash);464 Assert.equal(crash.crashDate, DUMMY_DATE);465 Assert.equal(crash.type, m.PROCESS_TYPE_GPU + "-" + m.CRASH_TYPE_CRASH);466 Assert.ok(crash.isOfType(m.PROCESS_TYPE_GPU, m.CRASH_TYPE_CRASH));467 crash = map.get("vr-crash");468 Assert.ok(!!crash);469 Assert.equal(crash.crashDate, DUMMY_DATE);470 Assert.equal(crash.type, m.PROCESS_TYPE_VR + "-" + m.CRASH_TYPE_CRASH);471 Assert.ok(crash.isOfType(m.PROCESS_TYPE_VR, m.CRASH_TYPE_CRASH));472 crash = map.get("rdd-crash");473 Assert.ok(!!crash);474 Assert.equal(crash.crashDate, DUMMY_DATE);475 Assert.equal(crash.type, m.PROCESS_TYPE_RDD + "-" + m.CRASH_TYPE_CRASH);476 Assert.ok(crash.isOfType(m.PROCESS_TYPE_RDD, m.CRASH_TYPE_CRASH));477 crash = map.get("socket-crash");478 Assert.ok(!!crash);479 Assert.equal(crash.crashDate, DUMMY_DATE);480 Assert.equal(crash.type, m.PROCESS_TYPE_SOCKET + "-" + m.CRASH_TYPE_CRASH);481 Assert.ok(crash.isOfType(m.PROCESS_TYPE_SOCKET, m.CRASH_TYPE_CRASH));482 crash = map.get("changing-item");483 Assert.ok(!!crash);484 Assert.equal(crash.crashDate, DUMMY_DATE_2);485 Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_HANG);486 Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG));487});488add_task(async function test_child_process_crash_ping() {489 let m = await getManager();490 const EXPECTED_PROCESSES = [491 m.PROCESS_TYPE_CONTENT,492 m.PROCESS_TYPE_GPU,493 m.PROCESS_TYPE_VR,494 m.PROCESS_TYPE_RDD,495 m.PROCESS_TYPE_SOCKET,496 ];497 const UNEXPECTED_PROCESSES = [498 m.PROCESS_TYPE_PLUGIN,499 m.PROCESS_TYPE_GMPLUGIN,500 null,501 12, // non-string process type502 ];503 let ac = new TelemetryArchiveTesting.Checker();504 await ac.promiseInit();505 // Add a child-process crash for each allowed process type.506 for (let p of EXPECTED_PROCESSES) {507 // Generate a ping.508 const remoteType = p === m.PROCESS_TYPE_CONTENT ? "web" : undefined;509 let id = await m.createDummyDump();510 await m.addCrash(p, m.CRASH_TYPE_CRASH, id, DUMMY_DATE, {511 RemoteType: remoteType,512 StackTraces: stackTraces,513 MinidumpSha256Hash: sha256Hash,514 ipc_channel_error: "ShutDownKill",515 ThisShouldNot: "end-up-in-the-ping",516 });517 await m._pingPromise;518 let found = await ac.promiseFindPing("crash", [519 [["payload", "crashId"], id],520 [["payload", "minidumpSha256Hash"], sha256Hash],521 [["payload", "processType"], p],522 [["payload", "stackTraces", "status"], "OK"],523 ]);524 Assert.ok(found, "Telemetry ping submitted for " + p + " crash");525 let hoursOnly = new Date(DUMMY_DATE);526 hoursOnly.setSeconds(0);527 hoursOnly.setMinutes(0);528 Assert.equal(529 new Date(found.payload.crashTime).getTime(),530 hoursOnly.getTime()531 );532 Assert.equal(533 found.payload.metadata.ThisShouldNot,534 undefined,535 "Non-whitelisted fields should be filtered out"536 );537 Assert.equal(538 found.payload.metadata.RemoteType,539 remoteType,540 "RemoteType should be whitelisted for content crashes"541 );542 Assert.equal(543 found.payload.metadata.ipc_channel_error,544 "ShutDownKill",545 "ipc_channel_error should be whitelisted for content crashes"546 );547 }548 // Check that we don't generate a crash ping for invalid/unexpected process549 // types.550 for (let p of UNEXPECTED_PROCESSES) {551 let id = await m.createDummyDump();552 await m.addCrash(p, m.CRASH_TYPE_CRASH, id, DUMMY_DATE, {553 StackTraces: stackTraces,554 MinidumpSha256Hash: sha256Hash,555 ThisShouldNot: "end-up-in-the-ping",556 });557 await m._pingPromise;558 // Check that we didn't receive any new ping.559 let found = await ac.promiseFindPing("crash", [560 [["payload", "crashId"], id],561 ]);562 Assert.ok(563 !found,564 "No telemetry ping must be submitted for invalid process types"565 );566 }567});568add_task(async function test_generateSubmissionID() {569 let m = await getManager();570 const SUBMISSION_ID_REGEX = /^(sub-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;571 let id = m.generateSubmissionID();572 Assert.ok(SUBMISSION_ID_REGEX.test(id));573});574add_task(async function test_addSubmissionAttemptAndResult() {575 let m = await getManager();576 let crashes = await m.getCrashes();577 Assert.equal(crashes.length, 0);578 await m.addCrash(579 m.PROCESS_TYPE_MAIN,580 m.CRASH_TYPE_CRASH,581 "main-crash",582 DUMMY_DATE583 );584 await m.addSubmissionAttempt("main-crash", "submission", DUMMY_DATE);585 await m.addSubmissionResult(586 "main-crash",587 "submission",588 DUMMY_DATE_2,589 m.SUBMISSION_RESULT_OK590 );591 crashes = await m.getCrashes();592 Assert.equal(crashes.length, 1);593 let submissions = crashes[0].submissions;594 Assert.ok(!!submissions);595 let submission = submissions.get("submission");596 Assert.ok(!!submission);597 Assert.equal(submission.requestDate.getTime(), DUMMY_DATE.getTime());598 Assert.equal(submission.responseDate.getTime(), DUMMY_DATE_2.getTime());599 Assert.equal(submission.result, m.SUBMISSION_RESULT_OK);600});601add_task(async function test_addSubmissionAttemptEarlyCall() {602 let m = await getManager();603 let crashes = await m.getCrashes();604 Assert.equal(crashes.length, 0);605 let p = m606 .ensureCrashIsPresent("main-crash")607 .then(() => {608 return m.addSubmissionAttempt("main-crash", "submission", DUMMY_DATE);609 })610 .then(() => {611 return m.addSubmissionResult(612 "main-crash",613 "submission",614 DUMMY_DATE_2,615 m.SUBMISSION_RESULT_OK616 );617 });618 await m.addCrash(619 m.PROCESS_TYPE_MAIN,620 m.CRASH_TYPE_CRASH,621 "main-crash",622 DUMMY_DATE623 );624 crashes = await m.getCrashes();625 Assert.equal(crashes.length, 1);626 await p;627 let submissions = crashes[0].submissions;628 Assert.ok(!!submissions);629 let submission = submissions.get("submission");630 Assert.ok(!!submission);631 Assert.equal(submission.requestDate.getTime(), DUMMY_DATE.getTime());632 Assert.equal(submission.responseDate.getTime(), DUMMY_DATE_2.getTime());633 Assert.equal(submission.result, m.SUBMISSION_RESULT_OK);634});635add_task(async function test_setCrashClassifications() {636 let m = await getManager();637 await m.addCrash(638 m.PROCESS_TYPE_MAIN,639 m.CRASH_TYPE_CRASH,640 "main-crash",641 DUMMY_DATE642 );643 await m.setCrashClassifications("main-crash", ["a"]);644 let classifications = (await m.getCrashes())[0].classifications;645 Assert.ok(classifications.includes("a"));646});647add_task(async function test_setRemoteCrashID() {648 let m = await getManager();649 await m.addCrash(650 m.PROCESS_TYPE_MAIN,651 m.CRASH_TYPE_CRASH,652 "main-crash",653 DUMMY_DATE654 );655 await m.setRemoteCrashID("main-crash", "bp-1");656 Assert.equal((await m.getCrashes())[0].remoteID, "bp-1");657});658add_task(async function test_telemetryHistogram() {659 let Telemetry = Services.telemetry;660 let h = Telemetry.getKeyedHistogramById("PROCESS_CRASH_SUBMIT_ATTEMPT");661 h.clear();662 Telemetry.clearScalars();663 let m = await getManager();664 let processTypes = [];665 let crashTypes = [];666 // Gather all process and crash types667 for (let field in m) {668 if (field.startsWith("PROCESS_TYPE_")) {669 processTypes.push(m[field]);670 } else if (field.startsWith("CRASH_TYPE_")) {671 crashTypes.push(m[field]);672 }673 }674 let keysCount = 0;675 let keys = [];676 for (let processType of processTypes) {677 for (let crashType of crashTypes) {678 let key = processType + "-" + crashType;679 keys.push(key);680 h.add(key, 1);681 keysCount++;682 }683 }684 // Check that we have the expected keys.685 let snap = h.snapshot();686 Assert.equal(687 Object.keys(snap).length,688 keysCount,689 "Some crash types have not been recorded, see the list in Histograms.json"690 );691 Assert.deepEqual(692 Object.keys(snap).sort(),693 keys.sort(),694 "Some crash types do not match"695 );...

Full Screen

Full Screen

test_crash_store.js

Source:test_crash_store.js Github

copy

Full Screen

...41add_task(async function test_constructor() {42 let s = new CrashStore("/some/path");43 Assert.ok(s instanceof CrashStore);44});45add_task(async function test_add_crash() {46 let s = await getStore();47 Assert.equal(s.crashesCount, 0);48 let d = new Date(Date.now() - 5000);49 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", d));50 Assert.equal(s.crashesCount, 1);51 let crashes = s.crashes;52 Assert.equal(crashes.length, 1);53 let c = crashes[0];54 Assert.equal(c.id, "id1", "ID set properly.");55 Assert.equal(c.crashDate.getTime(), d.getTime(), "Date set.");56 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id2", new Date()));57 Assert.equal(s.crashesCount, 2);58});59add_task(async function test_reset() {60 let s = await getStore();61 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", DUMMY_DATE));62 Assert.equal(s.crashes.length, 1);63 s.reset();64 Assert.equal(s.crashes.length, 0);65});66add_task(async function test_save_load() {67 let s = await getStore();68 await s.save();69 let d1 = new Date();70 let d2 = new Date(d1.getTime() - 10000);71 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", d1));72 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id2", d2));73 Assert.ok(s.addSubmissionAttempt("id1", "sub1", d1));74 Assert.ok(s.addSubmissionResult("id1", "sub1", d2, SUBMISSION_RESULT_OK));75 Assert.ok(s.setRemoteCrashID("id1", "bp-1"));76 await s.save();77 await s.load();78 Assert.ok(!s.corruptDate);79 let crashes = s.crashes;80 Assert.equal(crashes.length, 2);81 let c = s.getCrash("id1");82 Assert.equal(c.crashDate.getTime(), d1.getTime());83 Assert.equal(c.remoteID, "bp-1");84 Assert.ok(!!c.submissions);85 let submission = c.submissions.get("sub1");86 Assert.ok(!!submission);87 Assert.equal(submission.requestDate.getTime(), d1.getTime());88 Assert.equal(submission.responseDate.getTime(), d2.getTime());89 Assert.equal(submission.result, SUBMISSION_RESULT_OK);90});91add_task(async function test_corrupt_json() {92 let s = await getStore();93 let buffer = new TextEncoder().encode("{bad: json-file");94 await OS.File.writeAtomic(s._storePath, buffer, { compression: "lz4" });95 await s.load();96 Assert.ok(s.corruptDate, "Corrupt date is defined.");97 let date = s.corruptDate;98 await s.save();99 s._data = null;100 await s.load();101 Assert.ok(s.corruptDate);102 Assert.equal(date.getTime(), s.corruptDate.getTime());103});104add_task(async function test_add_main_crash() {105 let s = await getStore();106 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", new Date()));107 Assert.equal(s.crashesCount, 1);108 let c = s.crashes[0];109 Assert.ok(c.crashDate);110 Assert.equal(c.type, PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH);111 Assert.ok(c.isOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH));112 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id2", new Date()));113 Assert.equal(s.crashesCount, 2);114 // Duplicate.115 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id1", new Date()));116 Assert.equal(s.crashesCount, 2);117 Assert.ok(118 s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH, "id3", new Date(), {119 OOMAllocationSize: 1048576,120 })121 );122 Assert.equal(s.crashesCount, 3);123 Assert.deepEqual(s.crashes[2].metadata, { OOMAllocationSize: 1048576 });124 let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH);125 Assert.equal(crashes.length, 3);126});127add_task(async function test_add_main_hang() {128 let s = await getStore();129 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "id1", new Date()));130 Assert.equal(s.crashesCount, 1);131 let c = s.crashes[0];132 Assert.ok(c.crashDate);133 Assert.equal(c.type, PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_HANG);134 Assert.ok(c.isOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG));135 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "id2", new Date()));136 Assert.equal(s.crashesCount, 2);137 Assert.ok(s.addCrash(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG, "id1", new Date()));138 Assert.equal(s.crashesCount, 2);139 let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_HANG);140 Assert.equal(crashes.length, 2);141});142add_task(async function test_add_content_crash() {143 let s = await getStore();144 Assert.ok(145 s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "id1", new Date())146 );147 Assert.equal(s.crashesCount, 1);148 let c = s.crashes[0];149 Assert.ok(c.crashDate);150 Assert.equal(c.type, PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_CRASH);151 Assert.ok(c.isOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH));152 Assert.ok(153 s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "id2", new Date())154 );155 Assert.equal(s.crashesCount, 2);156 Assert.ok(157 s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH, "id1", new Date())158 );159 Assert.equal(s.crashesCount, 2);160 let crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_CRASH);161 Assert.equal(crashes.length, 2);162});163add_task(async function test_add_content_hang() {164 let s = await getStore();165 Assert.ok(166 s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "id1", new Date())167 );168 Assert.equal(s.crashesCount, 1);169 let c = s.crashes[0];170 Assert.ok(c.crashDate);171 Assert.equal(c.type, PROCESS_TYPE_CONTENT + "-" + CRASH_TYPE_HANG);172 Assert.ok(c.isOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG));173 Assert.ok(174 s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "id2", new Date())175 );176 Assert.equal(s.crashesCount, 2);177 Assert.ok(178 s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "id1", new Date())179 );180 Assert.equal(s.crashesCount, 2);181 let crashes = s.getCrashesOfType(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG);182 Assert.equal(crashes.length, 2);183});184add_task(async function test_add_plugin_crash() {185 let s = await getStore();186 Assert.ok(187 s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_CRASH, "id1", new Date())188 );189 Assert.equal(s.crashesCount, 1);190 let c = s.crashes[0];191 Assert.ok(c.crashDate);192 Assert.equal(c.type, PROCESS_TYPE_PLUGIN + "-" + CRASH_TYPE_CRASH);193 Assert.ok(c.isOfType(PROCESS_TYPE_PLUGIN, CRASH_TYPE_CRASH));194 Assert.ok(195 s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_CRASH, "id2", new Date())196 );197 Assert.equal(s.crashesCount, 2);198 Assert.ok(199 s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_CRASH, "id1", new Date())200 );201 Assert.equal(s.crashesCount, 2);202 let crashes = s.getCrashesOfType(PROCESS_TYPE_PLUGIN, CRASH_TYPE_CRASH);203 Assert.equal(crashes.length, 2);204});205add_task(async function test_add_plugin_hang() {206 let s = await getStore();207 Assert.ok(208 s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_HANG, "id1", new Date())209 );210 Assert.equal(s.crashesCount, 1);211 let c = s.crashes[0];212 Assert.ok(c.crashDate);213 Assert.equal(c.type, PROCESS_TYPE_PLUGIN + "-" + CRASH_TYPE_HANG);214 Assert.ok(c.isOfType(PROCESS_TYPE_PLUGIN, CRASH_TYPE_HANG));215 Assert.ok(216 s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_HANG, "id2", new Date())217 );218 Assert.equal(s.crashesCount, 2);219 Assert.ok(220 s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_HANG, "id1", new Date())221 );222 Assert.equal(s.crashesCount, 2);223 let crashes = s.getCrashesOfType(PROCESS_TYPE_PLUGIN, CRASH_TYPE_HANG);224 Assert.equal(crashes.length, 2);225});226add_task(async function test_add_gmplugin_crash() {227 let s = await getStore();228 Assert.ok(229 s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "id1", new Date())230 );231 Assert.equal(s.crashesCount, 1);232 let c = s.crashes[0];233 Assert.ok(c.crashDate);234 Assert.equal(c.type, PROCESS_TYPE_GMPLUGIN + "-" + CRASH_TYPE_CRASH);235 Assert.ok(c.isOfType(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH));236 Assert.ok(237 s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "id2", new Date())238 );239 Assert.equal(s.crashesCount, 2);240 Assert.ok(241 s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "id1", new Date())242 );243 Assert.equal(s.crashesCount, 2);244 let crashes = s.getCrashesOfType(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH);245 Assert.equal(crashes.length, 2);246});247add_task(async function test_add_gpu_crash() {248 let s = await getStore();249 Assert.ok(s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id1", new Date()));250 Assert.equal(s.crashesCount, 1);251 let c = s.crashes[0];252 Assert.ok(c.crashDate);253 Assert.equal(c.type, PROCESS_TYPE_GPU + "-" + CRASH_TYPE_CRASH);254 Assert.ok(c.isOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH));255 Assert.ok(s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id2", new Date()));256 Assert.equal(s.crashesCount, 2);257 Assert.ok(s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id1", new Date()));258 Assert.equal(s.crashesCount, 2);259 let crashes = s.getCrashesOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH);260 Assert.equal(crashes.length, 2);261});262add_task(async function test_add_vr_crash() {263 let s = await getStore();264 Assert.ok(s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "id1", new Date()));265 Assert.equal(s.crashesCount, 1);266 let c = s.crashes[0];267 Assert.ok(c.crashDate);268 Assert.equal(c.type, PROCESS_TYPE_VR + "-" + CRASH_TYPE_CRASH);269 Assert.ok(c.isOfType(PROCESS_TYPE_VR, CRASH_TYPE_CRASH));270 Assert.ok(s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "id2", new Date()));271 Assert.equal(s.crashesCount, 2);272 Assert.ok(s.addCrash(PROCESS_TYPE_VR, CRASH_TYPE_CRASH, "id1", new Date()));273 Assert.equal(s.crashesCount, 2);274 let crashes = s.getCrashesOfType(PROCESS_TYPE_VR, CRASH_TYPE_CRASH);275 Assert.equal(crashes.length, 2);276});277add_task(async function test_add_rdd_crash() {278 let s = await getStore();279 Assert.ok(s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "id1", new Date()));280 Assert.equal(s.crashesCount, 1);281 let c = s.crashes[0];282 Assert.ok(c.crashDate);283 Assert.equal(c.type, PROCESS_TYPE_RDD + "-" + CRASH_TYPE_CRASH);284 Assert.ok(c.isOfType(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH));285 Assert.ok(s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "id2", new Date()));286 Assert.equal(s.crashesCount, 2);287 Assert.ok(s.addCrash(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH, "id1", new Date()));288 Assert.equal(s.crashesCount, 2);289 let crashes = s.getCrashesOfType(PROCESS_TYPE_RDD, CRASH_TYPE_CRASH);290 Assert.equal(crashes.length, 2);291});292add_task(async function test_add_socket_crash() {293 let s = await getStore();294 Assert.ok(295 s.addCrash(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH, "id1", new Date())296 );297 Assert.equal(s.crashesCount, 1);298 let c = s.crashes[0];299 Assert.ok(c.crashDate);300 Assert.equal(c.type, PROCESS_TYPE_SOCKET + "-" + CRASH_TYPE_CRASH);301 Assert.ok(c.isOfType(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH));302 Assert.ok(303 s.addCrash(PROCESS_TYPE_SOCKET, CRASH_TYPE_CRASH, "id2", new Date())304 );305 Assert.equal(s.crashesCount, 2);306 Assert.ok(...

Full Screen

Full Screen

map_2.0.js

Source:map_2.0.js Github

copy

Full Screen

1function init_map (config){2 /**3 * Create the map4 */5 var map = AmCharts.makeChart( "chartdiv", config );6 return map;7}8var mouseManager = new function MousePosition(){9 var x = 0, y = 0;10 var callbacks = [];11 document.querySelector("body").onmousemove = function(mouseEvent){12 x = mouseEvent ? mouseEvent.screenX : typeof(window.event) != 'undefined' ? window.event.screenX : this.x;13 y = mouseEvent ? mouseEvent.screenY : typeof(window.event) != 'undefined' ? window.event.screenY : this.y;14 for(var i = 0; i<callbacks.length; i++){15 callbacks[i](x,y);16 }17 };18 this.addCallback = function(callback){19 callbacks.push(callback);20 };21 this.getX = function(){22 return x;23 };24 this.getY = function(){25 return y;26 };27};28mouseManager.addCallback(function(currX, currY){29 /*30 var isControlerOpen = document.querySelector("aside").style.visibility != "hidden";31 if(currX < 80 && !isControlerOpen){32 document.querySelector("aside").style.visibility = "visible";33 }34 else if(currX > 300 && isControlerOpen){35 document.querySelector("aside").style.visibility = "hidden";36 }37 */38});39var sideMenuManager = new function(){40 var companyResult = null;41 document.addEventListener('DOMContentLoaded', function(){42 companyResult = document.querySelectorAll(".airlines tr");43 }.bind(this));44 this.updateResult = function(sortedResultList){45 if(companyResult == null || sortedResultList.length == 0){46 return;47 }48 var reducer = function(acc, newElem){49 if(isNaN(newElem[1])){50 return acc;51 }52 else {53 return acc + newElem[1];54 }55 };56 var totalCrashes = sortedResultList.reduce(reducer,0.00001);57 for(var i = 0; i< Math.min(sortedResultList.length, companyResult.length); i++){58 // first row dedicated to label59 var cells = companyResult[i].querySelectorAll("td");60 cells[0].innerHTML = sortedResultList[i][0].substr(0,30);61 cells[1].innerHTML = sortedResultList[i][1];62 cells[2].innerHTML = Math.round(parseFloat(sortedResultList[i][1])/totalCrashes*100)+"%";63 }64 for(var i = Math.min(sortedResultList.length, companyResult.length); i<companyResult.length; i++){65 var cells = companyResult[i].querySelectorAll("td");66 cells[0].innerHTML = "";67 cells[1].innerHTML = "";68 cells[2].innerHTML = "";69 }70 };71};72var CrashChart = new function(){73 var marginX = 10;74 var marginY = 30;75 var chartWidth = 300;76 var chartHeight = 150;77 var path = null;78 var graphicXaxis = null, graphicYaxis = null;79 document.addEventListener('DOMContentLoaded', function() {80 var chart = d3.select("svg")81 .attr("width", chartWidth)82 .attr("height", chartHeight)83 .attr("overflow","visible")84 .append("g");85 graphicYaxis = d3.select("svg").append("g")86 .attr("class", "y axis")87 .attr("transform", "translate("+marginX/2+",0)");88 graphicXaxis = d3.select("svg").append("g")89 .attr("class", "x axis")90 .attr("transform", "translate(0,"+(-marginY/2)+")");91 path = chart.append("path")92 .attr("class", "chartPath")93 .style("stroke-width", 2)94 .style("stroke-opacity", 0.7)95 .style("stroke", "#904b58")96 .style("fill", "none");97 }.bind(this));98 this.update = function(fromYear, toYear, data){99 if(path == null){100 return;101 }102 var minX = fromYear;103 var maxX = toYear;104 var minY = 0;105 var maxY = 0;106 for(var i = 0; i<data.length; i++){107 maxY = Math.max(maxY, data[i][1]);108 }109 var xScaler = d3.scaleLinear()110 .domain([minX, maxX])111 .range([marginX,chartWidth]);112 var yScaler = d3.scaleLinear()113 .domain([minY, maxY])114 .range([chartHeight - marginY,0]);115 var yAxis = d3.axisRight().scale(yScaler).ticks(3).tickFormat(function(d){116 return d;117 });118 var xAxis = d3.axisTop().scale(xScaler).ticks(3).tickFormat(function(d){119 return d;120 });121 graphicYaxis.call(yAxis);122 graphicXaxis.call(xAxis);123 var line = d3.line()124 .x(function(d){125 return xScaler(d[0]);126 })127 .y(function(d){128 return yScaler(d[1]);129 });130 path.attr("d", line(data));131 }.bind(this);132};133function animateCrash(dep,arr,crash,targetSVG, planeSVG,depLabel, arrLabel, crashDescription,map,crashId){134 /**135 * Animate single crash136 */137 return new Promise(function(resolve,reject){138 var arc = -0.8;139 var shadowAlpha = 0.3;140 var planeScale = 0.05;141 var dashLength = 2;142 var flightLineAlpha = 0.5;143 var initialImgAlpha = 1;144 var afterAnimImgAlpha = 0.5;145 var positionScale = 2;146 var flightLineArc = {147 "id": "flightLineArc"+crashId,148 "dashLength": dashLength,149 //"arc": arc,150 "alpha": flightLineAlpha,151 "arrowAlpha": flightLineAlpha,152 "latitudes": [dep[0],arr[0]],153 "longitudes": [dep[1],arr[1]]154 };155 var crashLine = {156 "id": "crashLine"+crashId,157 "arrowAlpha":0,158 "color":'#FF0000',159 "alpha": 0,160 "latitudes": [dep[0],crash[0]],161 "longitudes": [dep[1],crash[1]]162 };163 var crashLineArc = {164 "color":'#FF0000',165 "id": "crashLineArc"+crashId,166 "alpha": 0,167 "arrowAlpha":0,168 "arc": arc,169 "latitudes": [dep[0],crash[0]],170 "longitudes": [dep[1],crash[1]]171 };172 /*map["dataProvider"]["lines"].push(crashLine);173 map["dataProvider"]["lines"].push(crashLineArc);*/174 // Create images (with and without animation)175 var crashImg= {176 "id": "crash"+crashId,177 "imageURL":'https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Skull_%26_crossbones.svg/513px-Skull_%26_crossbones.svg.png',178 "title": crashDescription,179 "latitude": crash[0],180 "longitude": crash[1],181 "rollOverScale":3,182 "alpha":initialImgAlpha183 //"linkToObject": ["arrTarget"+crashId,"depTarget"+crashId]184 };185 var depTarget= {186 "id": "depTarget"+crashId,187 "svgPath": targetSVG,188 "title": depLabel,189 "latitude": dep[0],190 "longitude": dep[1],191 "rollOverScale":2,192 "alpha":initialImgAlpha,193 "LinkToObject":"crash"+crashId194 };195 var arrTarget= {196 "id": "arrTarget"+crashId,197 "svgPath": targetSVG,198 "title": arrLabel,199 "latitude": arr[0],200 "longitude":arr[1],201 "rollOverScale":2,202 "alpha":initialImgAlpha,203 "LinkToObject":"crash"+crashId204 };205 var crashPathShadow = {206 "svgPath": planeSVG,207 "positionOnLine": 0,208 "color": "#585869",209 "alpha": shadowAlpha,210 "animateAlongLine": true,211 "lineId": "crashLine"+crashId,212 "flipDirection": false,213 "loop": false,214 "scale": planeScale,215 "positionScale": positionScale216 };217 var flightCrash = {218 "svgPath": planeSVG,219 "positionOnLine": 0,220 "color": "#a20819",221 "alpha": 0.7,222 "animateAlongLine": true,223 "lineId": "crashLineArc"+crashId,224 "flipDirection": false,225 "loop": false,226 "scale": planeScale,227 "positionScale": positionScale228 };229 /*var crash_descriptor = {230 id:crashId,231 lines: lines.slice(),232 images: images.slice()233 };*/234 var animDuration = map["imagesSettings"]["animationDuration"]*1500;235 map["dataProvider"]["lines"].push(flightLineArc,crashLine,crashLineArc);236 map["dataProvider"]["images"].push(depTarget,arrTarget,crashImg,flightCrash,crashPathShadow);237 setTimeout(function(){238 //if(map["dataProvider"]["lines"].length>3)239 map.validateData();240 map["dataProvider"]["images"].pop();241 map["dataProvider"]["images"].pop();242 var len = (map["dataProvider"]["images"]).length;243 map["dataProvider"]["images"][len-1]["alpha"]= afterAnimImgAlpha;244 map["dataProvider"]["images"][len-2]["alpha"]= afterAnimImgAlpha;245 map["dataProvider"]["images"][len-3]["alpha"]= afterAnimImgAlpha;246 resolve();247 },animDuration);248 });249}250/**251 * Created by noodle on 10.12.17.252 */253/**
 chartMap254 * id#255 * id#256 * Date#257 * Route#258 * Type#259 * LatLongCrash#260 * Start City Crash#261 * End City Crash#262 * Start City Geo Crash#263 * End City Geo Crash#264 * To_show#265 * Operator#266 * Summary#267 * Aboard#268 * Fatalities269 *270 *271 * id#272 * Date#273 * Time#274 * Location#275 * Operator#276 * Route#277 * Type#278 * Aboard#279 * Fatalities#280 * Summary#281 * LatLongCrash#282 * Start City Crash#283 * End City Crash#284 * Start City Geo Crash#285 * End City Geo Crash#286 * To_show287 */288var ChartMapParser = new function(){289 function parsePosition(latLongString){290 var resStr = latLongString.substr(1,latLongString.length-1).split(",");291 return {292 lat: parseFloat(resStr[0]),293 long:parseFloat(resStr[1])294 };295 }296 /**297 id#Year#Country#city#latitude#longitude#AttackType#Killed#Wounded#Group298 */299 this.lineParser = function(line){300 var cols = line.split("#");301 console.log("parsed");302 return {303 id:parseInt(cols[0]),304 company:cols[9],305 dep_lat:parseFloat(cols[4]),306 dep_long:parseFloat(cols[5]),307 arr_lat:parseFloat(cols[4]),308 arr_long:parseFloat(cols[5]),309 crash_lat:parseFloat(cols[4]),310 crash_long:parseFloat(cols[5]),311 startCity:"",312 endCity:"",313 description:cols[9],314 nb_a_bord:"",315 nb_mort:parseInt(cols[7]),316 year:parseInt(cols[1])317 };318 };319 this.filter = function(line){320 return true;321 };322};323/**
 chartLine324 id#Year#Country#city#latitude#longitude#AttackType#Killed#Wounded#Group325 */326var LineChartParser = new function(){327 this.lineParser = function(line){328 var cols = line.split("#");329 console.log("year : "+cols[1]);330 var res = {331 id:cols[0],332 nb_mort:parseInt(cols[7]),333 company:cols[9],334 year:parseInt(cols[1])335 };336 return res;337 };338 this.filter = function(line){339 return true;340 };341};342function load_data(filePath, lineParser, filter){343 return new Promise(function(resolve, error){344 var rawFile = new XMLHttpRequest();345 rawFile.open("GET", filePath, true);346 rawFile.onreadystatechange = function() {347 if (rawFile.readyState == 4) {348 var allText = rawFile.responseText;349 var lines = allText.split("\n");350 var objects = [];351 for(var i = 1; i<lines.length; i++){352 if(filter(lines[i])){353 objects.push(lineParser(lines[i]))354 }355 }356 resolve(new function(){357 var allData = objects;358 this.data = allData;359 this.getData = function(fromYear, toYear){360 var requiredData = [];361 for(var i = 0; i<allData.length; i++){362 if(fromYear <= allData[i].year && allData[i].year <= toYear){363 requiredData.push(allData[i]);364 }365 }366 return requiredData;367 }.bind(this);368 });369 }370 };371 rawFile.send();372 });373}374function ChartLineData(objects){375 var allData = objects;376 this.data = allData;377 this.getData = function(fromYear, toYear){378 var requiredData = [];379 for(var i = 0; i<allData.length; i++){380 if(fromYear <= allData[i].year && allData[i].year <= toYear){381 requiredData.push(allData[i]);382 }383 }384 return requiredData;385 }.bind(this);386 // TODO :387 var yearAndDeath = (388 function(){

389 var tmp = {};

390 for(var i = 0; i<objects.length; i++){
391 if(!(objects[i].year in tmp)){
392 tmp[objects[i].year] = 0;
393 }394 tmp[objects[i].year] += 1;395 }

396 var yearAndDeath = [];

397 for(var key in tmp){
398 yearAndDeath.push([parseInt(key), tmp[key]]);
399 }


400 return yearAndDeath;
401 })();402 

this.getYearAndCrashes = function(fromYear, toYear){
403 return yearAndDeath.filter(t => fromYear <= t[0] && t[0]<=toYear);
404 }.bind(this);
405 this.companyAndDeathSorted = function(fromYear, toYear){

406 var data = this.getData(fromYear, toYear);
407 var crashCompanyCounter = {};

408 for(var i = 0; i<data.length; i++){
409 if(!(data[i].company in crashCompanyCounter)){
410 crashCompanyCounter[data[i].company] = 0;
411 }
412 if(!isNaN(data[i].nb_mort)){413 crashCompanyCounter[data[i].company] += data[i].nb_mort;
414 }415 }

416 var tmp = [];

417 for(var key in crashCompanyCounter){
418 tmp.push([key, crashCompanyCounter[key]]);
419 }

420 crashCompanyCounter = tmp;
421 crashCompanyCounter.sort(function(e1,e2){ return e2[1]-e1[1];});

422 return crashCompanyCounter;
423 }.bind(this);424}425function visualiseData(data,map,targetSVG,planeSVG){426 /**427 * visualise the all the crashes428 */429 return new Promise(function(resolve,reject){430 if (data.length==0) {431 return;432 }433 var crash = data.shift();434 var dep = [crash["dep_lat"],crash["dep_long"]];435 var arr = [crash["arr_lat"],crash["arr_long"]];436 var crashPos = [crash["crash_lat"],crash["crash_long"]];437 var depLabel= crash.startCity;438 var arrLabel = crash.endCity;439 var crashDescription= crash["description"];440 var crashId = crash['id'];441 animateCrash(dep,arr,crashPos,targetSVG, planeSVG,depLabel, arrLabel, crashDescription,map,crashId)442 .then(function(res,err){443 visualiseData(data,map,targetSVG,planeSVG);444 }) ;445 });446}447function init_range_selector(begin,end){448 $( function() {449 $( "#slider-range" ).slider({450 range: true,451 min: begin,452 max: end,453 animate: true,454 values: [ begin, end ],455 slide: function( event, ui ) {456 if(dataLoader == null){457 return;458 }459 data=dataLoader.getData(ui.values[0], ui.values[1]);460 var companySorted = chartLineData.companyAndDeathSorted(ui.values[0], ui.values[1]);461 CrashChart.update(ui.values[0], ui.values[1], chartLineData.getYearAndCrashes(ui.values[0],ui.values[1]));462 sideMenuManager.updateResult(companySorted);463 document.querySelector(".yearRangeTable .fromValue").innerHTML = ui.values[0];464 document.querySelector(".yearRangeTable .toValue").innerHTML = ui.values[1];465 }.bind(this)466 });467 $( "#amount" ).val( $( "#slider-range" ).slider( "values", 0 ) +468 " - " + $( "#slider-range" ).slider( "values", 1 ) );469 } );470}471function showCrashes(data){472 map["dataProvider"]["images"]=[];473 var arrayLength = data.length;474 for (var i = 0; i < arrayLength; i++) {475 var crash = data[i];476 var dep = [crash["dep_lat"],crash["dep_long"]];477 var arr = [crash["arr_lat"],crash["arr_long"]];478 var crashPos = [crash["crash_lat"],crash["crash_long"]];479 var depLabel= crash.startCity;480 var arrLabel = crash.endCity;481 var crashDescription= crash["description"];482 var crashId = crash['id'];483 staticCrash(dep,arr,crashPos,targetSVG, planeSVG,depLabel, arrLabel, crashDescription,map,crashId);484 //Do something485 }486 map.validateData();487}488function staticCrash(dep,arr,crash,targetSVG, planeSVG, depLabel, arrLabel, crashDescription,map,crashId) {489 var crashImg = {490 "id": "crash"+crashId,491 "imageURL":'crash.png',492 "title": crashDescription,493 "latitude": crash[0],494 "longitude": crash[1],495 "rollOverScale":1.5,496 "alpha":1,497 "scale":2,498 "fixedSize":false499 };500 map["dataProvider"]["images"].push(crashImg);501}502/**503 * Created by noodle on 14.11.17.504 */505/**506 * Created by noodle on 26.10.17.507 */508function animate(elem, property, fromValue, toValue, unit, duration){509 var frameDuration = 20;510 var totalFrames = duration/frameDuration;511 elem.style[property] = fromValue +unit;512 return new Promise(function(resolve, reject) {513 var currFrame = 0;514 var mon = setInterval(function(){515 var rate = currFrame/totalFrames;516 var newValue = rate*toValue + (1-rate)*fromValue;517 elem.style[property] = newValue+unit;518 if(currFrame>=totalFrames){519 elem.style[property] = toValue+unit;520 clearInterval(mon);521 resolve();522 }523 currFrame+=1;524 },frameDuration);525 });526}527function titleAnim(title, newTitleName, backgroundColor, duration){528 var txtWrapper = document.createElement("span");529 txtWrapper.appendChild(document.createTextNode(newTitleName));530 var colorWrapper = document.createElement("div");531 var paddingTitleTop = parseInt(window.getComputedStyle(title).paddingTop);532 var paddingTitleBottom = parseInt(window.getComputedStyle(title).paddingBottom);533 title.style.paddingTop = "0px";534 title.style.paddingBottom="0px";535 colorWrapper.style.position="absolute";536 colorWrapper.style.width="0px";537 colorWrapper.style.backgroundColor=backgroundColor;538 colorWrapper.style.height=title.clientHeight+"px";539 console.log(paddingTitleTop);540 title.style.paddingTop = paddingTitleTop+"px";541 title.style.paddingBottom = paddingTitleBottom+"px";542 colorWrapper.style.width="0px";543 colorWrapper.style.marginLeft = "0px";544 animate(title, "opacity", 1, 0, "", duration)545 .then(function(res){546 title.style.opacity ="1";547 txtWrapper.style.opacity="0";548 while (title.firstChild) {549 title.removeChild(title.firstChild);550 }551 title.appendChild(colorWrapper);552 title.appendChild(txtWrapper);553 return animate(colorWrapper, "width", 0, title.clientWidth , "px", duration/2);554 })555 .then(function(res){556 txtWrapper.style.opacity="1";557 animate(colorWrapper, "margin-left", 0, title.clientWidth, "px", duration/3)558 return animate(colorWrapper, "width", title.clientWidth, 0, "px", duration/2);559 });...

Full Screen

Full Screen

config_old.js

Source:config_old.js Github

copy

Full Screen

1/**2 * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license4 */5CKEDITOR.editorConfig = function( config ) {6 // Define changes to default configuration here. For example:7 config.language = 'en';8 //config.uiColor = '#AADC6E';9 //config.extraPlugins = 'codesnippetgeshi';10 //%REMOVE_START%11 config.plugins =12 'api,' + /* Add No Crash */13 'ajax,' + /* Add No Crash */14 'about,' +15 'a11yhelp,' +16 17 'autocomplete,' + /* Add No Crash */18 19 'autogrow,' + /* Add No Crash */20 21 'basicstyles,' +22 23 'bgimage,' + /* Add No Crash - Working Perfect */24 25 'bidi,' +26 'blockquote,' +27 28 'balloontoolbar,' + /* Add No Crash - appears to not do jack shit */ 29 30 'balloonpanel,' + /* Add No Crash - appears to not do jack shit */ 31 32 33 'button,' + /* Add No Crash */34 35 'ccmsconfighelper,' + /* Add No Crash - doesnot apperar to do shit in this dev */36 37 'chart,' + /* Tested and working kinda kewl needs work */38 39 'clipboard,' +40 'codesnippet,' + /* Tested and working fucking awesome */41 42 /* 'codesnippetgeshi,' + Tested and broken as a mother fucker - piece of shit s far */43 44 'colorbutton,' +45 'colordialog,' +46 47 'computedstyles,' + /* Add No Crash - doesnot apperar to do shit can't tell */48 49 'copyformatting,' +50 'contextmenu,' +51 52 'deselect,' + /* Add No Crash - appears to not do jack shit */53 54 'detail,' + /* Add No Crash - Fucking Awesome */55 56 /* 'cssanim,' + works but can't find the .CSS file */57 58 'dialogadvtab,' +59 'dialogui,' + /* Add No Crash */60 'dialog,' + /* Add No Crash */61 'div,' +62 63 'docprops,' + /* Add No Crash */64 65 'docfont,' + /* Add No Crash - not sure could not tell if it did anything I DO SEE A FONT DROP DOWN BUT I THINK IT WAS THERE ALREADY */66 67 'eqneditor,' + /* Add No Crash WORKING - codecogs equation symbols */68 69 'elementspath,' +70 71 'embedbase,' + /* Add No Crash - appears to not do shit in this dev */72 73 'emoji,' + /* Add No Crash WORKS AWESOME */74 75 'enterkey,' +76 'entities,' +77 78 'fakeobjects,' + /* Add No Crash */ 79 80 'filebrowser,' +81 82 'filetools,' + /* Add No Crash */83 84 'find,' +85 'flash,' +86 'floatingspace,' +87 88 'floatpanel,' + /* Add No Crash */89 90 'font,' +91 'format,' +92 'forms,' +93 'horizontalrule,' +94 95 'htmlbuttons,' + /* Add No Crash */96 97 'htmlwriter,' +98 99 'html5video,' + /* Add No Crash WORKS PERFECT */100 101 /* 'imagebase,' + Add No Crash */102 'image,' +103 104 /* 'imageuploader,' + - re write it ghost ts broken */105 /* 'imgupload,' + brk piece of shit does not work with curret dev */ 106 107 /* 'image2,' + Add No Crash WORKING - Seems like a shitty version of image GARBAGE IN my eyes! */108 109 'iframe,' +110 111 'iframedialog,' + /* Add No Crash */112 113 'indent,' + /* Add No Crash */114 115 'indentlist,' +116 'indentblock,' +117 'justify,' +118 'language,' +119 120 'listblock,' + /* Add No Crash */121 122 'lineutils,' + /* Add No Crash */123 'lightbox,' + /* Add No Crash - Works great no problems */124 125 'link,' +126 127 /* 'SimpleLink,' + SHITTY VERSION of 'link,' + */ 128 129 'list,' +130 'liststyle,' +131 'magicline,' +132 'maximize,' +133 134 'menu,' + /* Add No Crash */135 'menubutton,' + 136 137 'mediaembed,' + /* Add No Crash */138 139 'newpage,' +140 141 'notification,' + /* Add No Crash */142 'notificationaggregator,' + /* Add No Crash */143 144 /* 'niftytimers,' + No crash but is missing files */ 145 146 'panelbutton,' + /* Add No Crash */147 'panel,' + /* Add No Crash */148 149 'pagebreak,' +150 151 'pastefromexcel,' + /* Add No Crash - appears to not work */152 153 'pastefromword,' +154 'pastetext,' +155 156 'popup,' + /* Add No Crash */157 158 'preview,' +159 'print,' +160 'removeformat,' +161 'resize,' +162 163 'richcombo,' + /* Add No Crash */164 165 'save,' +166 167 'scayt,' + /* Add No Crash WORKING */168 169 'selectallcontextmenu,' + /* Add No Crash must be sae as 'selectall,' + */170 171 'selectall,' +172 173 174 'showblocks,' +175 'showborders,' + 176 177 'slideshow,' + /* Add No Crash WORKING - Slide Show Works but where do you put the fucking images? */178 179 'smiley,' +180 'sourcearea,' +181 'specialchar,' +182 183 'spoiler,' + /* Add No Crash WORKING - fucking works awesome */184 185 'symbol,' + /* Add No Crash WORKING - A more extnded version of 'specialchar,' + */186 187 'stylescombo,' +188 'tab,' +189 'table,' +190 'tableselection,' +191 'tabletools,' +192 'tableresize,' + /* Add No Crash WORKING */193 'tabletoolstoolbar,' + /* Add No Crash - Working Perfect */ 194 195 'templates,' +196 197 'textmatch,' + /* Add No Crash */198 199 'textwatcher,' + /* Add No Crash */200 201 /* 'Text2Speech,' + broke dick piece of shit */ 202 203 'toolbar,' +204 'undo,' +205 206 'uploadcare,' + /* Add No Crash WORKING */207 208 'uploadwidget,' + /* Add No Crash */209 210 'uploadimage,' + /* already here but does it worl I can't tell? */211 212 'uploadfile,' + /* Added - looks like some broken ass shit to me */213 214 'videodetector,' + /* Add No Crash WORKING - needs to be fixed to have a default video size */215 216 217 218 'widgetselection,' + /* Add No Crash */219 'widget,' + /* Add No Crash */220 221 'wsc,' + /* Add No Crash */222 223 'xml,' + /* Add No Crash */224 225 'zoom,' + /* Add No Crash WORKING */226 /* 'Audio,' + Added and it breaks the editor in 4 dev GARBAGE */ 227 228 'wysiwygarea';229 // %REMOVE_END%230};...

Full Screen

Full Screen

config.js

Source:config.js Github

copy

Full Screen

1/**2 * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license4 */5CKEDITOR.editorConfig = function( config ) {6 // Define changes to default configuration here. For example:7 config.language = 'en';8 //config.uiColor = '#AADC6E';9 //config.extraPlugins = 'codesnippetgeshi';10 //%REMOVE_START%11 config.plugins =12 'api,' + /* Add No Crash */13 'ajax,' + /* Add No Crash */14 'about,' +15 'a11yhelp,' +16 17 'autocomplete,' + /* Add No Crash */18 19 'autogrow,' + /* Add No Crash */20 21 'basicstyles,' +22 23 'bgimage,' + /* Add No Crash - Working Perfect */24 25 'bidi,' +26 'blockquote,' +27 28 'balloontoolbar,' + /* Add No Crash - appears to not do jack shit */ 29 30 'balloonpanel,' + /* Add No Crash - appears to not do jack shit */ 31 32 33 'button,' + /* Add No Crash */34 35 'ccmsconfighelper,' + /* Add No Crash - doesnot apperar to do shit in this dev */36 37 'chart,' + /* Tested and working kinda kewl needs work */38 39 'clipboard,' +40 'codesnippet,' + /* Tested and working fucking awesome */41 42 /* 'codesnippetgeshi,' + Tested and broken as a mother fucker - piece of shit s far */43 44 'colorbutton,' +45 'colordialog,' +46 47 'computedstyles,' + /* Add No Crash - doesnot apperar to do shit can't tell */48 49 'copyformatting,' +50 'contextmenu,' +51 52 'deselect,' + /* Add No Crash - appears to not do jack shit */53 54 'detail,' + /* Add No Crash - Fucking Awesome */55 56 /* 'cssanim,' + works but can't find the .CSS file */57 58 'dialogadvtab,' +59 'dialogui,' + /* Add No Crash */60 'dialog,' + /* Add No Crash */61 'div,' +62 63 'docprops,' + /* Add No Crash */64 65 'docfont,' + /* Add No Crash - not sure could not tell if it did anything I DO SEE A FONT DROP DOWN BUT I THINK IT WAS THERE ALREADY */66 67 'eqneditor,' + /* Add No Crash WORKING - codecogs equation symbols */68 69 'elementspath,' +70 71 'embedbase,' + /* Add No Crash - appears to not do shit in this dev */72 73 'emoji,' + /* Add No Crash WORKS AWESOME */74 75 'enterkey,' +76 'entities,' +77 78 'fakeobjects,' + /* Add No Crash */ 79 80 'filebrowser,' +81 82 'filetools,' + /* Add No Crash */83 84 'find,' +85 'flash,' +86 'floatingspace,' +87 88 'floatpanel,' + /* Add No Crash */89 90 'font,' +91 'format,' +92 'forms,' +93 'horizontalrule,' +94 95 'htmlbuttons,' + /* Add No Crash */96 97 'htmlwriter,' +98 99 'html5video,' + /* Add No Crash WORKS PERFECT */100 101 'imagebase,' + /* Add No Crash */102 'image,' +103 104 /* 'imageuploader,' + - re write it ghost ts broken */105 /* 'imgupload,' + brk piece of shit does not work with curret dev */ 106 107 /* 'image2,' + Add No Crash WORKING - Seems like a shitty version of image GARBAGE IN my eyes! */108 109 'iframe,' +110 111 'iframedialog,' + /* Add No Crash */112 113 'indent,' + /* Add No Crash */114 115 'indentlist,' +116 'indentblock,' +117 'justify,' +118 'language,' +119 120 'listblock,' + /* Add No Crash */121 122 'lineutils,' + /* Add No Crash */123 'lightbox,' + /* Add No Crash - Works great no problems */124 125 'link,' +126 127 /* 'SimpleLink,' + SHITTY VERSION of 'link,' + */ 128 129 'list,' +130 'liststyle,' +131 'magicline,' +132 'maximize,' +133 134 'menu,' + /* Add No Crash */135 'menubutton,' + 136 137 'mediaembed,' + /* Add No Crash */138 139 'newpage,' +140 141 'notification,' + /* Add No Crash */142 'notificationaggregator,' + /* Add No Crash */143 144 /* 'niftytimers,' + No crash but is missing files */ 145 146 'panelbutton,' + /* Add No Crash */147 'panel,' + /* Add No Crash */148 149 'pagebreak,' +150 151 'pastefromexcel,' + /* Add No Crash - appears to not work */152 153 'pastefromword,' +154 'pastetext,' +155 156 'popup,' + /* Add No Crash */157 158 'preview,' +159 'print,' +160 'removeformat,' +161 'resize,' +162 163 'richcombo,' + /* Add No Crash */164 165 'save,' +166 167 'scayt,' + /* Add No Crash WORKING */168 169 'selectallcontextmenu,' + /* Add No Crash must be sae as 'selectall,' + */170 171 'selectall,' +172 173 174 'showblocks,' +175 'showborders,' + 176 177 'slideshow,' + /* Add No Crash WORKING - Slide Show Works but where do you put the fucking images? */178 179 'smiley,' +180 'sourcearea,' +181 'specialchar,' +182 183 'spoiler,' + /* Add No Crash WORKING - fucking works awesome */184 185 'symbol,' + /* Add No Crash WORKING - A more extnded version of 'specialchar,' + */186 187 'stylescombo,' +188 'tab,' +189 'table,' +190 'tableselection,' +191 'tabletools,' +192 'tableresize,' + /* Add No Crash WORKING */193 'tabletoolstoolbar,' + /* Add No Crash - Working Perfect */ 194 195 'templates,' +196 197 'textmatch,' + /* Add No Crash */198 199 'textwatcher,' + /* Add No Crash */200 201 /* 'Text2Speech,' + broke dick piece of shit */ 202 203 'toolbar,' +204 'undo,' +205 206 'uploadcare,' + /* Add No Crash WORKING */207 208 'uploadwidget,' + /* Add No Crash */209 210 'uploadimage,' + /* already here but does it worl I can't tell? */211 212 'uploadfile,' + /* Added - looks like some broken ass shit to me */213 214 'videodetector,' + /* Add No Crash WORKING - needs to be fixed to have a default video size */215 216 217 218 'widgetselection,' + /* Add No Crash */219 'widget,' + /* Add No Crash */220 221 'wsc,' + /* Add No Crash */222 223 'xml,' + /* Add No Crash */224 225 'zoom,' + /* Add No Crash WORKING */226 /* 'Audio,' + Added and it breaks the editor in 4 dev GARBAGE */ 227 228 'wysiwygarea';229 // %REMOVE_END%230};...

Full Screen

Full Screen

patch-electron_spec_api-crash-reporter-spec.js

Source:patch-electron_spec_api-crash-reporter-spec.js Github

copy

Full Screen

1--- electron/spec/api-crash-reporter-spec.js.orig 2020-03-24 05:00:48 UTC2+++ electron/spec/api-crash-reporter-spec.js3@@ -19,7 +19,7 @@ describe('crashReporter module', () => {4 if (process.mas || process.env.DISABLE_CRASH_REPORTER_TESTS) return;5 6 // TODO(alexeykuzmin): [Ch66] Fails. Fix it and enable back.7- if (process.platform === 'linux') return;8+ if (process.platform === 'linux' || process.platform === 'freebsd') return;9 10 let originalTempDirectory = null;11 let tempDirectory = null;12@@ -90,7 +90,7 @@ describe('crashReporter module', () => {13 let dumpFile;14 let crashesDir = crashReporter.getCrashesDirectory();15 const existingDumpFiles = new Set();16- if (process.platform !== 'linux') {17+ if (process.platform !== 'linux' && process.platform !== 'freebsd') {18 // crashpad puts the dump files in the "completed" subdirectory19 if (process.platform === 'darwin') {20 crashesDir = path.join(crashesDir, 'completed');21@@ -101,7 +101,7 @@ describe('crashReporter module', () => {22 }23 const testDone = (uploaded) => {24 if (uploaded) return done(new Error('Uploaded crash report'));25- if (process.platform !== 'linux') crashReporter.setUploadToServer(true);26+ if (process.platform !== 'linux' && process.platform !== 'freebsd') crashReporter.setUploadToServer(true);27 expect(fs.existsSync(dumpFile)).to.be.true();28 done();29 };30@@ -151,7 +151,7 @@ describe('crashReporter module', () => {31 });32 33 it('should send minidump with updated extra parameters when node processes crash', function (done) {34- if (process.platform === 'linux') {35+ if (process.platform === 'linux' || process.platform === 'freebsd') {36 // FIXME(alexeykuzmin): Skip the test.37 // this.skip()38 return;39@@ -305,7 +305,7 @@ describe('crashReporter module', () => {40 expect(() => require('electron').crashReporter.getUploadToServer()).to.throw();41 });42 it('returns true when uploadToServer is set to true', function () {43- if (process.platform === 'linux') {44+ if (process.platform === 'linux' || process.platform === 'freebsd') {45 // FIXME(alexeykuzmin): Skip the test.46 // this.skip()47 return;48@@ -319,7 +319,7 @@ describe('crashReporter module', () => {49 expect(crashReporter.getUploadToServer()).to.be.true();50 });51 it('returns false when uploadToServer is set to false', function () {52- if (process.platform === 'linux') {53+ if (process.platform === 'linux' || process.platform === 'freebsd') {54 // FIXME(alexeykuzmin): Skip the test.55 // this.skip()56 return;57@@ -340,7 +340,7 @@ describe('crashReporter module', () => {58 expect(() => require('electron').crashReporter.setUploadToServer('arg')).to.throw();59 });60 it('sets uploadToServer false when called with false', function () {61- if (process.platform === 'linux') {62+ if (process.platform === 'linux' || process.platform === 'freebsd') {63 // FIXME(alexeykuzmin): Skip the test.64 // this.skip()65 return;66@@ -355,7 +355,7 @@ describe('crashReporter module', () => {67 expect(crashReporter.getUploadToServer()).to.be.false();68 });69 it('sets uploadToServer true when called with true', function () {70- if (process.platform === 'linux') {71+ if (process.platform === 'linux' || process.platform === 'freebsd') {72 // FIXME(alexeykuzmin): Skip the test.73 // this.skip()74 return;75@@ -382,7 +382,7 @@ describe('crashReporter module', () => {76 expect(parameters).to.be.an('object');77 });78 it('adds a parameter to current parameters', function () {79- if (process.platform === 'linux') {80+ if (process.platform === 'linux' || process.platform === 'freebsd') {81 // FIXME(alexeykuzmin): Skip the test.82 // this.skip()83 return;84@@ -397,7 +397,7 @@ describe('crashReporter module', () => {85 expect(crashReporter.getParameters()).to.have.a.property('hello');86 });87 it('removes a parameter from current parameters', function () {88- if (process.platform === 'linux') {89+ if (process.platform === 'linux' || process.platform === 'freebsd') {90 // FIXME(alexeykuzmin): Skip the test.91 // this.skip()92 return;93@@ -490,7 +490,7 @@ const startServer = ({ callback, processType, done, pr94 server.listen(port, '127.0.0.1', () => {95 port = server.address().port;96 remote.process.port = port;97- if (process.platform !== 'linux') {98+ if (process.platform !== 'linux' && process.platform !== 'freebsd') {99 crashReporter.start({100 companyName: 'Umbrella Corporation',...

Full Screen

Full Screen

SecurityPrivacyView.js

Source:SecurityPrivacyView.js Github

copy

Full Screen

1import React from 'react';2import { Switch } from 'react-native';3import PropTypes from 'prop-types';4import { connect } from 'react-redux';5import AsyncStorage from '@react-native-community/async-storage';6import { toggleCrashReport as toggleCrashReportAction, toggleAnalyticsEvents as toggleAnalyticsEventsAction } from '../actions/crashReport';7import { SWITCH_TRACK_COLOR } from '../constants/colors';8import StatusBar from '../containers/StatusBar';9import * as List from '../containers/List';10import I18n from '../i18n';11import { CRASH_REPORT_KEY, ANALYTICS_EVENTS_KEY } from '../lib/rocketchat';12import {13 loggerConfig, analytics, logEvent, events14} from '../utils/log';15import SafeAreaView from '../containers/SafeAreaView';16import { isFDroidBuild } from '../constants/environment';17import { getUserSelector } from '../selectors/login';18class SecurityPrivacyView extends React.Component {19 static navigationOptions = () => ({20 title: I18n.t('Security_and_privacy')21 });22 static propTypes = {23 navigation: PropTypes.object,24 allowCrashReport: PropTypes.bool,25 allowAnalyticsEvents: PropTypes.bool,26 e2eEnabled: PropTypes.bool,27 toggleCrashReport: PropTypes.func,28 toggleAnalyticsEvents: PropTypes.func,29 user: PropTypes.shape({30 roles: PropTypes.array,31 id: PropTypes.string32 })33 }34 toggleCrashReport = (value) => {35 logEvent(events.SE_TOGGLE_CRASH_REPORT);36 AsyncStorage.setItem(CRASH_REPORT_KEY, JSON.stringify(value));37 const { toggleCrashReport } = this.props;38 toggleCrashReport(value);39 if (!isFDroidBuild) {40 loggerConfig.autoNotify = value;41 if (value) {42 loggerConfig.clearBeforeSendCallbacks();43 } else {44 loggerConfig.registerBeforeSendCallback(() => false);45 }46 }47 }48 toggleAnalyticsEvents = (value) => {49 logEvent(events.SE_TOGGLE_ANALYTICS_EVENTS);50 const { toggleAnalyticsEvents } = this.props;51 AsyncStorage.setItem(ANALYTICS_EVENTS_KEY, JSON.stringify(value));52 toggleAnalyticsEvents(value);53 analytics().setAnalyticsCollectionEnabled(value);54 }55 navigateToScreen = (screen) => {56 logEvent(events[`SP_GO_${ screen.replace('View', '').toUpperCase() }`]);57 const { navigation } = this.props;58 navigation.navigate(screen);59 }60 renderCrashReportSwitch = () => {61 const { allowCrashReport } = this.props;62 return (63 <Switch64 value={allowCrashReport}65 trackColor={SWITCH_TRACK_COLOR}66 onValueChange={this.toggleCrashReport}67 />68 );69 }70 renderAnalyticsEventsSwitch = () => {71 const { allowAnalyticsEvents } = this.props;72 return (73 <Switch74 value={allowAnalyticsEvents}75 trackColor={SWITCH_TRACK_COLOR}76 onValueChange={this.toggleAnalyticsEvents}77 />78 );79 }80 render() {81 const { e2eEnabled } = this.props;82 return (83 <SafeAreaView testID='security-privacy-view'>84 <StatusBar />85 <List.Container testID='security-privacy-view-list'>86 <List.Section>87 <List.Separator />88 {e2eEnabled89 ? (90 <>91 <List.Item92 title='E2E_Encryption'93 showActionIndicator94 onPress={() => this.navigateToScreen('E2EEncryptionSecurityView')}95 testID='security-privacy-view-e2e-encryption'96 />97 <List.Separator />98 </>99 )100 : null101 }102 <List.Item103 title='Screen_lock'104 showActionIndicator105 onPress={() => this.navigateToScreen('ScreenLockConfigView')}106 testID='security-privacy-view-screen-lock'107 />108 <List.Separator />109 </List.Section>110 {!isFDroidBuild ? (111 <>112 <List.Section>113 <List.Separator />114 <List.Item115 title='Log_analytics_events'116 testID='security-privacy-view-analytics-events'117 right={() => this.renderAnalyticsEventsSwitch()}118 />119 <List.Separator />120 <List.Item121 title='Send_crash_report'122 testID='security-privacy-view-crash-report'123 right={() => this.renderCrashReportSwitch()}124 />125 <List.Separator />126 <List.Info info='Crash_report_disclaimer' />127 </List.Section>128 </>129 ) : null}130 </List.Container>131 </SafeAreaView>132 );133 }134}135const mapStateToProps = state => ({136 user: getUserSelector(state),137 allowCrashReport: state.crashReport.allowCrashReport,138 allowAnalyticsEvents: state.crashReport.allowAnalyticsEvents,139 e2eEnabled: state.settings.E2E_Enable140});141const mapDispatchToProps = dispatch => ({142 toggleCrashReport: params => dispatch(toggleCrashReportAction(params)),143 toggleAnalyticsEvents: params => dispatch(toggleAnalyticsEventsAction(params))144});...

Full Screen

Full Screen

crashes.js

Source:crashes.js Github

copy

Full Screen

1// Copyright (c) 2012 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4/* Id for tracking automatic refresh of crash list. */5var refreshCrashListId = undefined;6/**7 * Requests the list of crashes from the backend.8 */9function requestCrashes() {10 chrome.send('requestCrashList');11}12/**13 * Callback from backend with the list of crashes. Builds the UI.14 * @param {boolean} enabled Whether or not crash reporting is enabled.15 * @param {boolean} dynamicBackend Whether the crash backend is dynamic.16 * @param {array} crashes The list of crashes.17 * @param {string} version The browser version.18 */19function updateCrashList(enabled, dynamicBackend, crashes, version) {20 $('countBanner').textContent = loadTimeData.getStringF('crashCountFormat',21 crashes.length);22 var crashSection = $('crashList');23 $('enabledMode').hidden = !enabled;24 $('disabledMode').hidden = enabled;25 $('crashUploadStatus').hidden = !enabled || !dynamicBackend;26 if (!enabled)27 return;28 // Clear any previous list.29 crashSection.textContent = '';30 var productName = loadTimeData.getString('shortProductName');31 for (var i = 0; i < crashes.length; i++) {32 var crash = crashes[i];33 if (crash['local_id'] == '')34 crash['local_id'] = productName;35 var crashBlock = document.createElement('div');36 var title = document.createElement('h3');37 title.textContent = loadTimeData.getStringF('crashHeaderFormat',38 crash['id'],39 crash['local_id']);40 crashBlock.appendChild(title);41 var date = document.createElement('p');42 date.textContent = loadTimeData.getStringF('crashTimeFormat',43 crash['time']);44 crashBlock.appendChild(date);45 var linkBlock = document.createElement('p');46 var link = document.createElement('a');47 var commentLines = [48 'Chrome Version: ' + version,49 // TODO(tbreisacher): fill in the OS automatically?50 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"',51 '',52 'URL (if applicable) where crash occurred:',53 '',54 'Can you reproduce this crash?',55 '',56 'What steps will reproduce this crash? (or if it\'s not ' +57 'reproducible, what were you doing just before the crash)?',58 '',59 '1.', '2.', '3.',60 '',61 '*Please note that issues filed with no information filled in ' +62 'above will be marked as WontFix*',63 '',64 '****DO NOT CHANGE BELOW THIS LINE****',65 'report_id:' + crash.id66 ];67 var params = {68 template: 'Crash Report',69 comment: commentLines.join('\n'),70 };71 var href = 'http://code.google.com/p/chromium/issues/entry';72 for (var param in params) {73 href = appendParam(href, param, params[param]);74 }75 link.href = href;76 link.target = '_blank';77 link.textContent = loadTimeData.getString('bugLinkText');78 linkBlock.appendChild(link);79 crashBlock.appendChild(linkBlock);80 crashSection.appendChild(crashBlock);81 }82 $('noCrashes').hidden = crashes.length != 0;83}84/**85 * Request crashes get uploaded in the background.86 */87function requestCrashUpload() {88 // Don't need locking with this call because the system crash reporter89 // has locking built into itself.90 chrome.send('requestCrashUpload');91 // Trigger a refresh in 5 seconds. Clear any previous requests.92 clearTimeout(refreshCrashListId);93 refreshCrashListId = setTimeout(requestCrashes, 5000);94}95document.addEventListener('DOMContentLoaded', function() {96 $('uploadCrashes').onclick = requestCrashUpload;97 requestCrashes();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const crash = page._delegate.crash;7 crash();8})();9 at Page._onCrash (C:\Users\user\playwright\lib\server\page.js:127:24)10 at CDPSession.Page._client.on.event (C:\Users\user\playwright\lib\server\page.js:110:62)11 at CDPSession.emit (events.js:315:20)12 at CDPSession._onMessage (C:\Users\user\playwright\lib\server\cdpsession.js:120:12)13 at Connection._onMessage (C:\Users\user\playwright\lib\server\connection.js:200:24)14 at WebSocketTransport._ws.addEventListener.event (C:\Users\user\playwright\lib\server\transport.js:34:24)15 at WebSocketTransport.emit (events.js:315:20)16 at WebSocketTransport._ws.onmessage (C:\Users\user\playwright\lib\server\transport.js:72:10)17 at WebSocket.onMessage (C:\Users\user\playwright\lib\server\webSocketTransport.js:19:49)18 at WebSocket.emit (events.js:315:20)

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 for (const browserType of BROWSER) {4 const browser = await playwright[browserType].launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.crash();8 await browser.close();9 }10})();11const playwright = require('playwright');12(async () => {13 for (const browserType of BROWSER) {14 const browser = await playwright[browserType].launch();15 const context = await browser.newContext();16 const page = await context.newPage();17 await page.crash();18 await browser.close();19 }20})();21const playwright = require('playwright');22(async () => {23 for (const browserType of BROWSER) {24 const browser = await playwright[browserType].launch();25 const context = await browser.newContext();26 const page = await context.newPage();27 await page.crash();28 await browser.close();29 }30})();31const playwright = require('playwright');32(async () => {33 for (const browserType of BROWSER) {34 const browser = await playwright[browserType].launch();35 const context = await browser.newContext();36 const page = await context.newPage();37 await page.crash();38 await browser.close();39 }40})();41const playwright = require('playwright');42(async () => {43 for (const browserType of BROWSER) {44 const browser = await playwright[browserType].launch();45 const context = await browser.newContext();46 const page = await context.newPage();47 await page.crash();48 await browser.close();49 }50})();51const playwright = require('playwright');52(async () => {53 for (const browserType of BROWSER) {54 const browser = await playwright[browserType].launch();55 const context = await browser.newContext();56 const page = await context.newPage();57 await page.crash();58 await browser.close();59 }60})();61const playwright = require('playwright');62(async () => {63 for (const browserType of BROWSER) {

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 const browser = await playwright['chromium'].launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.crash();7 await browser.close();8})();9 at Promise (C:\Users\pavithra\Documents\puppeteer\playwright\playwright\lib\transport.js:77:23)10 at new Promise (<anonymous>)11 at CDPSession.send (C:\Users\pavithra\Documents\puppeteer\playwright\playwright\lib\transport.js:76:12)12 at Page.crash (C:\Users\pavithra\Documents\puppeteer\playwright\playwright\lib\page.js:390:33)13 at processTicksAndRejections (internal/process/task_queues.js:97:5)14 at async Object.<anonymous> (C:\Users\pavithra\Documents\puppeteer\playwright\playwright\test.js:9:3)

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 const browser = await playwright.chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.crash();7 await browser.close();8})();9at processTicksAndRejections (internal/process/task_queues.js:93:5)10at async Promise.all (index 0)11at async Promise.all (index 0)12at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)13at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)14at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)15at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)16at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)17at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)18at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)19at async PlaywrightTestRunner._runMocha (/Users/username/Projects/Playwright/playwright-test/node_modules/@playwright/test/lib/test/runner.js:114:9)

Full Screen

Using AI Code Generation

copy

Full Screen

1const playwright = require('playwright');2(async () => {3 const browser = await playwright.chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.crash();7 await browser.close();8})();9const playwright = require('playwright');10(async () => {11 const browser = await playwright.chromium.launch();12 const context = await browser.newContext();13 const page = await context.newPage();14 await page.crash();15 await browser.close();16})();17const playwright = require('playwright');18(async () => {19 const browser = await playwright.chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page.crash();23 await browser.close();24})();25const playwright = require('playwright');26(async () => {27 const browser = await playwright.chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.crash();31 await browser.close();32})();33const playwright = require('playwright');34(async () => {35 const browser = await playwright.chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.crash();39 await browser.close();40})();41const playwright = require('playwright');42(async () => {43 const browser = await playwright.chromium.launch();44 const context = await browser.newContext();45 const page = await context.newPage();46 await page.crash();47 await browser.close();48})();49const playwright = require('playwright');50(async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.crash();6 await browser.close();7})();8const { chromium } = require('playwright');9(async () => {10 const browser = await chromium.launch();11 const page = await browser.newPage();12 await page.crash();13 await browser.close();14})();15const { chromium } = require('playwright');16(async () => {17 const browser = await chromium.launch();18 const page = await browser.newPage();19 await page.crash();20 await browser.close();21})();22const { chromium } = require('playwright');23(async () => {24 const browser = await chromium.launch();25 const page = await browser.newPage();26 await page.crash();27 await browser.close();28})();29const { chromium } = require('playwright');30(async () => {31 const browser = await chromium.launch();32 const page = await browser.newPage();33 await page.crash();34 await browser.close();35})();36const { chromium } = require('playwright');37(async () => {38 const browser = await chromium.launch();39 const page = await browser.newPage();40 await page.crash();41 await browser.close();42})();43const { chromium } = require('playwright');44(async () => {45 const browser = await chromium.launch();46 const page = await browser.newPage();47 await page.crash();48 await browser.close();49})();

Full Screen

Using AI Code Generation

copy

Full Screen

1(async () => {2})();3const { chromium } = require('playwright');4(async () => {5 const browser = await chromium.launch();6 const context = await browser.newContext();7 const page = await context.newPage();8 await page.crash();9})();10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 await page.crash();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const context = await browser.newContext();21 const page = await context.newPage();22 await page.crash();23})();24const { chromium } = require('playwright');25(async () => {26 const browser = await chromium.launch();27 const context = await browser.newContext();28 const page = await context.newPage();29 await page.crash();30})();31const { chromium } = require('playwright');32(async () => {33 const browser = await chromium.launch();34 const context = await browser.newContext();35 const page = await context.newPage();36 await page.crash();37})();38const { chromium } = require('playwright');39(async () => {40 const browser = await chromium.launch();41 const context = await browser.newContext();42 const page = await context.newPage();43 await page.crash();44})();45const { chromium } = require('play

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = async ({ page, context, testInfo }) => {2 await page.crash();3};4module.exports = {5 launchOptions: {6 },7};8module.exports = {9 testEnvironmentOptions: {10 'jest-playwright': {11 launchOptions: {12 },13 },14 },15 {16 },17};18"scripts": {19 },

Full Screen

Using AI Code Generation

copy

Full Screen

1const { crash } = require('playwright/lib/server/crashReporter');2crash('test');3 at Object.<anonymous> (/home/user/test.js:4:1)4 at step (/home/user/test.js:33:23)5 at Object.throw (/home/user/test.js:14:53)6 at rejected (/home/user/test.js:6:65)7 at processTicksAndRejections (node:internal/process/task_queues:94:5)

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful