Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

[DO NOT MERGE] testing phantomjs polifill #7958

Closed
wants to merge 11 commits into from
Closed
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 Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ module.exports = function (grunt) {
specs : '<%= meta.specs %>',
/* Keep in sync with test/SpecRunner.html dependencies */
vendor : [
'test/polyfills.js',
'src/thirdparty/jquery-2.1.0.min.js',
'src/thirdparty/CodeMirror2/lib/codemirror.js',
'src/thirdparty/CodeMirror2/lib/util/dialog.js',
Expand Down
12 changes: 11 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ require.config({

// The file system implementation. Change this value to use different
// implementations (e.g. cloud-based storage).
"fileSystemImpl" : "filesystem/impls/appshell/AppshellFileSystem"
"fileSystemImpl" : "filesystem/impls/appshell/AppshellFileSystem",

// The application shell implementation. Brackets-shell provides an
// instance of brackets.app, it will be used and the default value
// points to a void implementation. However, when running Brackets in a
// different environment, use this to load your implementation. For the
// definition of the interface, see appshell.app namespace at
// https://github.com/adobe/brackets-shell/blob/master/appshell/appshell_extensions.js
// Change this value to load custom implementation to run brackets in
// something else than Brackets shell (e.g. in a browser).
"appShellImpl" : "shellImpl/InBrowserShell"
}
});

Expand Down
32 changes: 32 additions & 0 deletions src/shellImpl/InBrowserShell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
define(function (require, exports, module) {
"use strict";

// this implementation is intentionally left empty
// see src/main.js for details

});
2 changes: 1 addition & 1 deletion src/utils/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ define(function (require, exports, module) {

// Create empty app namespace if running in-browser
if (!global.brackets.app) {
global.brackets.app = {};
global.brackets.app = require("appShellImpl");
}

// Loading extensions requires creating new require.js contexts, which
Expand Down
25 changes: 25 additions & 0 deletions test/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(function () {
"use strict";

if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}

var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof FNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
};

FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();

return fBound;
};
}
}());