angular: Script blocking app for some seconds ?
I’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
I have an angular which i am loading via an iframe . The angular app is hanging the whole web browser for about 3 seconds while loading .
I am loading this iframe on window.onload I am only getting this issue in chrome.
What have i debugged:
- I have seen the sources tab in devtools which show that there is one file which has no domain is causing problem which loading .
- I opened this file and the code seems like this
(function(define, require, requireNative, requireAsync, exports, console, privates, apiBridge, bindingUtil, getInternalApi,$Array, $Function, $JSON, $Object, $RegExp, $String, $Error) {'use strict';// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Custom binding for the app API.
var appNatives = requireNative('app');
var process = requireNative('process');
var extensionId = process.GetExtensionId();
var logActivity = requireNative('activityLogger');
function wrapForLogging(fun) {
if (!extensionId)
return fun; // nothing interesting to log without an extension
return function() {
// TODO(ataly): We need to make sure we use the right prototype for
// fun.apply. Array slice can either be rewritten or similarly defined.
logActivity.LogAPICall(extensionId, "app." + fun.name,
$Array.slice(arguments));
return $Function.apply(fun, this, arguments);
};
}
// This becomes chrome.app
var app = {
getIsInstalled: wrapForLogging(appNatives.GetIsInstalled),
getDetails: wrapForLogging(appNatives.GetDetails),
runningState: wrapForLogging(appNatives.GetRunningState)
};
// Tricky; "getIsInstalled" is actually exposed as the getter "isInstalled",
// but we don't have a way to express this in the schema JSON (nor is it
// worth it for this one special case).
//
// So, define it manually, and let the getIsInstalled function act as its
// documentation.
var isInstalled = wrapForLogging(appNatives.GetIsInstalled);
$Object.defineProperty(
app, 'isInstalled',
{
__proto__: null,
configurable: true,
enumerable: true,
get: function() { return isInstalled(); },
});
// Called by app_bindings.cc.
function onInstallStateResponse(state, callbackId) {
var callback = callbacks[callbackId];
delete callbacks[callbackId];
if (typeof callback == 'function') {
try {
callback(state);
} catch (e) {
console.error('Exception in chrome.app.installState response handler: ' +
e.stack);
}
}
}
// TODO(kalman): move this stuff to its own custom bindings.
var callbacks = { __proto__: null };
var nextCallbackId = 1;
function getInstallState(callback) {
var callbackId = nextCallbackId++;
callbacks[callbackId] = callback;
appNatives.GetInstallState(callbackId);
}
$Object.defineProperty(
app, 'installState',
{
__proto__: null,
configurable: true,
enumerable: true,
value: wrapForLogging(getInstallState),
writable: true,
});
exports.$set('binding', app);
exports.$set('onInstallStateResponse', onInstallStateResponse);
})
Expected behavior
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Angular version:
ng -v
Angular CLI: 1.6.6
Node: 9.4.0
OS: linux x64
Angular: 4.4.6
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router
... tsc-wrapped
@angular/cdk: 2.0.0-beta.8
@angular/cli: 1.6.6
@angular/material: 2.0.0-beta.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.6
@schematics/angular: 0.1.17
typescript: 2.2.2
webpack: 3.10.0
Browser:
- [x] Chrome (desktop) version XX
- [x] Chrome (Android) version XX
- [x] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
node -v = v9.4.0
npm -v = 5.6.0
Others:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (7 by maintainers)
You’re responsible for providing the minimal reproduction in bug report, rather than asking other to debug your app.