-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failing test: Ember.onerror setup via instance initailizer leaks acro…
…ss visits
- Loading branch information
Showing
12 changed files
with
66,447 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
test/fixtures/onerror-per-visit/assets/onerror-per-visit-fastboot.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
define('~fastboot/app-factory', ['onerror-per-visit/app', 'onerror-per-visit/config/environment'], function(App, config) { | ||
App = App['default']; | ||
config = config['default']; | ||
|
||
return { | ||
'default': function() { | ||
return App.create(config.APP); | ||
} | ||
}; | ||
}); | ||
|
||
define("onerror-per-visit/initializers/ajax", ["exports"], function (_exports) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.default = void 0; | ||
const { | ||
get | ||
} = Ember; | ||
|
||
var nodeAjax = function (options) { | ||
let httpRegex = /^https?:\/\//; | ||
let protocolRelativeRegex = /^\/\//; | ||
let protocol = get(this, 'fastboot.request.protocol'); | ||
|
||
if (protocolRelativeRegex.test(options.url)) { | ||
options.url = protocol + options.url; | ||
} else if (!httpRegex.test(options.url)) { | ||
try { | ||
options.url = protocol + '//' + get(this, 'fastboot.request.host') + options.url; | ||
} catch (fbError) { | ||
throw new Error('You are using Ember Data with no host defined in your adapter. This will attempt to use the host of the FastBoot request, which is not configured for the current host of this request. Please set the hostWhitelist property for in your environment.js. FastBoot Error: ' + fbError.message); | ||
} | ||
} | ||
|
||
if (najax) { | ||
najax(options); | ||
} else { | ||
throw new Error('najax does not seem to be defined in your app. Did you override it via `addOrOverrideSandboxGlobals` in the fastboot server?'); | ||
} | ||
}; | ||
|
||
var _default = { | ||
name: 'ajax-service', | ||
initialize: function (application) { | ||
application.register('ajax:node', nodeAjax, { | ||
instantiate: false | ||
}); | ||
application.inject('adapter', '_ajaxRequest', 'ajax:node'); | ||
application.inject('adapter', 'fastboot', 'service:fastboot'); | ||
} | ||
}; | ||
_exports.default = _default; | ||
}); | ||
define("onerror-per-visit/initializers/error-handler", ["exports"], function (_exports) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.default = void 0; | ||
|
||
/** | ||
* Initializer to attach an `onError` hook to your app running in fastboot. It catches any run loop | ||
* exceptions and other errors and prevents the node process from crashing. | ||
* | ||
*/ | ||
var _default = { | ||
name: 'error-handler', | ||
initialize: function () { | ||
if (!Ember.onerror) { | ||
// if no onerror handler is defined, define one for fastboot environments | ||
Ember.onerror = function (err) { | ||
const errorMessage = "There was an error running your app in fastboot. More info about the error: \n ".concat(err.stack || err); | ||
console.error(errorMessage); | ||
}; | ||
} | ||
} | ||
}; | ||
_exports.default = _default; | ||
});//# sourceMappingURL=onerror-per-visit-fastboot.map |
1 change: 1 addition & 0 deletions
1
test/fixtures/onerror-per-visit/assets/onerror-per-visit-fastboot.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
260 changes: 260 additions & 0 deletions
260
test/fixtures/onerror-per-visit/assets/onerror-per-visit.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.