fallbackEvalInInspectedWindow() — react Function Reference
Architecture documentation for the fallbackEvalInInspectedWindow() function in evalInInspectedWindow.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD adc0b8c2_0b4b_a9ab_cc59_45e157938f18["fallbackEvalInInspectedWindow()"] 5da5ec89_70b9_80cd_1b31_dcf27eddc57e["evalInInspectedWindow.js"] adc0b8c2_0b4b_a9ab_cc59_45e157938f18 -->|defined in| 5da5ec89_70b9_80cd_1b31_dcf27eddc57e style adc0b8c2_0b4b_a9ab_cc59_45e157938f18 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-extensions/src/main/evalInInspectedWindow.js lines 30–101
function fallbackEvalInInspectedWindow(
scriptId: EvalScriptIds,
args: any[],
callback: (value: any, exceptionInfo: ?ExceptionInfo) => void,
) {
if (!evalScripts[scriptId]) {
throw new Error(`No eval script with id "${scriptId}" exists.`);
}
const code = evalScripts[scriptId].code.apply(null, args);
const tabId = chrome.devtools.inspectedWindow.tabId;
const requestId = evalRequestId++;
chrome.runtime.sendMessage({
source: 'devtools-page',
payload: {
type: 'eval-in-inspected-window',
tabId,
requestId,
scriptId,
args,
},
});
const timeout = setTimeout(() => {
evalRequestCallbacks.delete(requestId);
if (callback) {
callback(null, {
code,
description:
'Timed out while waiting for eval response from the inspected window.',
isError: true,
isException: false,
value: undefined,
});
}
}, EVAL_TIMEOUT);
evalRequestCallbacks.set(requestId, ({result, error}) => {
clearTimeout(timeout);
evalRequestCallbacks.delete(requestId);
if (callback) {
if (error) {
callback(null, {
code,
description: undefined,
isError: false,
isException: true,
value: error,
});
return;
}
callback(result, null);
}
});
}
export function evalInInspectedWindow(
scriptId: EvalScriptIds,
args: any[],
callback: (value: any, exceptionInfo: ?ExceptionInfo) => void,
) {
if (!evalScripts[scriptId]) {
throw new Error(`No eval script with id "${scriptId}" exists.`);
}
const code = evalScripts[scriptId].code.apply(null, args);
chrome.devtools.inspectedWindow.eval(code, (result, exceptionInfo) => {
if (!exceptionInfo) {
callback(result, exceptionInfo);
return;
}
// If an exception (e.g. CSP Blocked) occurred,
// fallback to the content script eval context
fallbackEvalInInspectedWindow(scriptId, args, callback);
});
}
Domain
Subdomains
Source
Frequently Asked Questions
What does fallbackEvalInInspectedWindow() do?
fallbackEvalInInspectedWindow() is a function in the react codebase, defined in packages/react-devtools-extensions/src/main/evalInInspectedWindow.js.
Where is fallbackEvalInInspectedWindow() defined?
fallbackEvalInInspectedWindow() is defined in packages/react-devtools-extensions/src/main/evalInInspectedWindow.js at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free