forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge autoland to mozilla-central. a=merge
- Loading branch information
Showing
68 changed files
with
1,387 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
devtools/shared/resources/tests/browser_resources_target_resources_race.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
const { | ||
ResourceWatcher, | ||
} = require("devtools/shared/resources/resource-watcher"); | ||
|
||
/** | ||
* Test initial target resources are correctly retrieved even when several calls | ||
* to watchResources are made simultaneously. | ||
* | ||
* This checks a race condition which occurred when calling watchResources | ||
* simultaneously. This made the "second" call to watchResources miss existing | ||
* resources (in case those are emitted from the target instead of the watcher). | ||
* See Bug 1663896. | ||
*/ | ||
add_task(async function() { | ||
// Disable the preloaded process as it creates processes intermittently | ||
// which forces the emission of RDP requests we aren't correctly waiting for. | ||
await pushPref("dom.ipc.processPrelaunch.enabled", false); | ||
|
||
const { | ||
client, | ||
resourceWatcher, | ||
targetList, | ||
} = await initResourceWatcherAndTarget(); | ||
|
||
const expectedPlatformMessage = "expectedMessage"; | ||
|
||
info("Log a message *before* calling ResourceWatcher.watchResources"); | ||
Services.console.logStringMessage(expectedPlatformMessage); | ||
|
||
info("Call watchResources from 2 separate call sites consecutively"); | ||
|
||
// Empty onAvailable callback for CSS MESSAGES, we only want to check that | ||
// the second resource we watch correctly provides existing resources. | ||
const onCssMessageAvailable = resources => {}; | ||
|
||
// First call to watchResources. | ||
// We do not await on `watchPromise1` here, in order to simulate simultaneous | ||
// calls to watchResources (which could come from 2 separate modules in a real | ||
// scenario). | ||
const initialWatchPromise = resourceWatcher.watchResources( | ||
[ResourceWatcher.TYPES.CSS_MESSAGE], | ||
{ | ||
onAvailable: onCssMessageAvailable, | ||
} | ||
); | ||
|
||
// `waitForNextResource` will trigger another call to `watchResources`. | ||
const onMessageReceived = waitForNextResource( | ||
resourceWatcher, | ||
ResourceWatcher.TYPES.PLATFORM_MESSAGE, | ||
{ | ||
ignoreExistingResources: false, | ||
predicate: r => r.message === expectedPlatformMessage, | ||
} | ||
); | ||
|
||
info("Waiting for the expected message to be received"); | ||
await onMessageReceived; | ||
ok(true, "All the expected messages were received"); | ||
|
||
info("Wait for the other watchResources promise to finish"); | ||
await initialWatchPromise; | ||
|
||
// Unwatch all resources. | ||
resourceWatcher.unwatchResources([ResourceWatcher.TYPES.CSS_MESSAGE], { | ||
onAvailable: onCssMessageAvailable, | ||
}); | ||
|
||
Services.console.reset(); | ||
targetList.destroy(); | ||
await client.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.