Unify oss and internal version of stack trace editor opener

Reviewed By: @vjeux

Differential Revision: D2519344

fb-gh-sync-id: 022d8865cd8eea3b0b51f9070c000f15c464dc6a
This commit is contained in:
Martín Bigio 2015-10-08 14:15:14 -07:00 committed by facebook-github-bot-4
parent 35f9ac89a7
commit f37ad56afd
2 changed files with 23 additions and 12 deletions

View File

@ -0,0 +1,21 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
const launchEditor = require('./launchEditor');
module.exports = function(req, res, next) {
if (req.url === '/open-stack-frame') {
var frame = JSON.parse(req.rawBody);
launchEditor(frame.file, frame.lineNumber);
res.end('OK');
} else {
next();
}
};

View File

@ -20,7 +20,7 @@ const checkNodeVersion = require('./checkNodeVersion');
const connect = require('connect');
const formatBanner = require('./formatBanner');
const getDevToolsMiddleware = require('./getDevToolsMiddleware');
const launchEditor = require('./launchEditor.js');
const openStackFrameInEditorMiddleware = require('./openStackFrameInEditorMiddleware');
const parseCommandLine = require('./parseCommandLine.js');
const ReactPackager = require('./react-packager');
const webSocketProxy = require('./webSocketProxy.js');
@ -167,16 +167,6 @@ function loadRawBody(req, res, next) {
});
}
function openStackFrameInEditor(req, res, next) {
if (req.url === '/open-stack-frame') {
var frame = JSON.parse(req.rawBody);
launchEditor(frame.file, frame.lineNumber);
res.end('OK');
} else {
next();
}
}
// A status page so the React/project.pbxproj build script
// can verify that packager is running on 8081 and not
// another program / service.
@ -279,8 +269,8 @@ function runServer(
) {
var app = connect()
.use(loadRawBody)
.use(openStackFrameInEditor)
.use(getDevToolsMiddleware(options))
.use(openStackFrameInEditorMiddleware)
.use(statusPageMiddleware)
.use(systraceProfileMiddleware)
.use(cpuProfileMiddleware)