fune/devtools/client/shared/webpack/shims/platform-stack-stub.js
Julian Descottes 0702847ccf Bug 1403489 - remove special loader rule for devtools/shared/platform;r=tromey
MozReview-Commit-ID: HwhAXHm8ipq

--HG--
rename : devtools/shared/platform/content/.eslintrc.js => devtools/client/shared/webpack/shims/.eslintrc.js
rename : devtools/shared/platform/content/moz.build => devtools/client/shared/webpack/shims/moz.build
rename : devtools/shared/platform/content/clipboard.js => devtools/client/shared/webpack/shims/platform-clipboard-stub.js
rename : devtools/shared/platform/content/stack.js => devtools/client/shared/webpack/shims/platform-stack-stub.js
rename : devtools/shared/platform/content/test/.eslintrc.js => devtools/client/shared/webpack/shims/test/.eslintrc.js
rename : devtools/shared/platform/content/test/mochitest.ini => devtools/client/shared/webpack/shims/test/mochitest.ini
rename : devtools/shared/platform/content/test/test_clipboard.html => devtools/client/shared/webpack/shims/test/test_clipboard.html
rename : devtools/shared/platform/content/test/test_stack.js => devtools/client/shared/webpack/shims/test/test_stack.js
rename : devtools/shared/platform/content/test/xpcshell.ini => devtools/client/shared/webpack/shims/test/xpcshell.ini
rename : devtools/shared/platform/chrome/clipboard.js => devtools/shared/platform/clipboard.js
rename : devtools/shared/platform/chrome/stack.js => devtools/shared/platform/stack.js
extra : rebase_source : d233c0d5b4691f595ec61cae52167921f57ee942
2017-09-27 12:38:23 +02:00

49 lines
1.5 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// A few wrappers for stack-manipulation. This version of the module
// is used in content code. Note that this particular copy of the
// file can only be loaded via require(), because Cu.import doesn't
// exist in the content case. So, we don't need the code to handle
// both require and import here.
"use strict";
/**
* Looks like Cu.callFunctionWithAsyncStack, but just calls the callee.
*/
function callFunctionWithAsyncStack(callee, stack, id) {
return callee();
}
/**
* Return a description of the Nth caller, suitable for logging.
*
* @param {Number} n the caller to describe
* @return {String} a description of the nth caller.
*/
function describeNthCaller(n) {
if (isWorker) {
return "";
}
let stack = new Error().stack.split("\n");
// Add one here to skip this function.
return stack[n + 1];
}
/**
* Return a stack object that can be serialized and, when
* deserialized, passed to callFunctionWithAsyncStack.
*/
function getStack() {
// There's no reason for this to do anything fancy, since it's only
// used to pass back into callFunctionWithAsyncStack, which we can't
// implement.
return null;
}
exports.callFunctionWithAsyncStack = callFunctionWithAsyncStack;
exports.describeNthCaller = describeNthCaller;
exports.getStack = getStack;