Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.*node_modules/config-chain.*
.*node_modules/documentation.*
.*node_modules/devtools-reps/src/object-inspector/index.js
.*node_modules/immutable/dist/immutable.js.flow
.*node_modules/jest-in-case/index.js
<PROJECT_ROOT>/firefox/.*
.*mozilla-central/.*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-react": "^7.2.1",
"expect.js": "^0.3.1",
"flow-bin": "0.53.0",
"flow-bin": "0.57.3",
"github-airtable-bridge": "0.0.5",
"glob": "^7.0.3",
"husky": "^0.14.2",
Expand Down
5 changes: 4 additions & 1 deletion src/actions/utils/middleware/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ function filterAction(action: Object): Object {
return fromPairs(toPairs(action).filter(pair => pair[0] !== PROMISE));
}

function promiseMiddleware({ dispatch, getState }: ThunkArgs) {
function promiseMiddleware({
dispatch,
getState
}: ThunkArgs): Function | Promise<mixed> {
return (next: Function) => (action: Object) => {
if (!(PROMISE in action)) {
return next(action);
Expand Down
2 changes: 1 addition & 1 deletion src/client/chrome/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function evaluate(script: string) {
return runtimeAgent.evaluate({ expression: script });
}

function debuggeeCommand(script: string) {
function debuggeeCommand(script: string): Promise<void> {
evaluate(script);
return Promise.resolve();
}
Expand Down
8 changes: 5 additions & 3 deletions src/client/firefox/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ function setBreakpoint(
});
}

function removeBreakpoint(generatedLocation: Location) {
function removeBreakpoint(
generatedLocation: Location
): Promise<void> | ?BreakpointResult {
try {
const id = makeLocationId(generatedLocation);
const bpClient = bpClients[id];
Expand Down Expand Up @@ -166,7 +168,7 @@ type EvaluateParam = {
frameId?: FrameId
};

function evaluate(script: Script, { frameId }: EvaluateParam) {
function evaluate(script: Script, { frameId }: EvaluateParam): Promise<mixed> {
const params = frameId ? { frameActor: frameId } : {};
if (!tabTarget || !tabTarget.activeConsole) {
return Promise.resolve();
Expand All @@ -181,7 +183,7 @@ function evaluate(script: Script, { frameId }: EvaluateParam) {
});
}

function debuggeeCommand(script: Script) {
function debuggeeCommand(script: Script): ?Promise<void> {
tabTarget.activeConsole.evaluateJS(script, () => {}, {});

if (!debuggerClient) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should be Promise.resolve

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 194, Promise.resolve() does not contain a parameter, so I'm giving a void type to Promise<>. Is this correct? 🤔

Expand Down
2 changes: 1 addition & 1 deletion src/utils/test-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function makeSymbolDeclaration(name: string, line: number) {
* @memberof utils/test-head
* @static
*/
function waitForState(store: any, predicate: any) {
function waitForState(store: any, predicate: any): Promise<void> {
return new Promise(resolve => {
const unsubscribe = store.subscribe(() => {
if (predicate(store.getState())) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function handleError(err: any) {
* @memberof utils/utils
* @static
*/
function promisify(context: any, method: any, ...args: any) {
function promisify(context: any, method: any, ...args: any): Promise<mixed> {
return new Promise((resolve, reject) => {
args.push(response => {
if (response.error) {
Expand Down Expand Up @@ -66,7 +66,7 @@ function throttle(func: any, ms: number) {
};
}

function waitForMs(ms: number) {
function waitForMs(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms));
}

Expand Down
1 change: 1 addition & 0 deletions src/utils/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type WasmState = {
offsets: Array<number>
};

// $FlowIgnore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use FlowIgnore because the flow errors produced on line 12 seem to be related to a bug from facebook/flow#4742.

I tried replacing WasmState with any, but it still gave me errors.
screen shot 2017-11-05 at 11 13 04 am

var wasmStates: { [string]: WasmState } = Object.create(null);

/**
Expand Down
Loading