<commit_before>import React, { PropTypes } from 'react'
import classNames from 'classnames'
import { completeUrl } from '../../util'
import { loadSuccess } from '../../actions'
import style from './frame.css'

const handleLoad = ({ dispatch, id }) => () => dispatch(loadSuccess(id))

const Frame = ({ tabs, dispatch }) => (
  <div className={style.content}>
    {tabs.map(({ id, url, isActive }) => (
      <iframe
        className={classNames({ [style.hidden]: !isActive })}
        src={url ? completeUrl(url) : null}
        key={id}
        onLoad={handleLoad({ dispatch, id })}
      />
    ))}
  </div>
)

Frame.propTypes = {
  tabs: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.string.isRequired,
    url: PropTypes.string,
    isActive: PropTypes.bool,
    isFailed: PropTypes.bool,
  })),<commit_msg>prevent top location change<commit_after>import React, { PropTypes } from 'react'
import classNames from 'classnames'
import { completeUrl } from '../../util'
import { loadSuccess } from '../../actions'
import style from './frame.css'

const handleLoad = ({ dispatch, id }) => () => dispatch(loadSuccess(id))

// Remove iframe's sandbox allow-top-navigation to prevent top location change
const Frame = ({ tabs, dispatch }) => (
  <div className={style.content}>
    {tabs.map(({ id, url, isActive }) => (
      <iframe
        className={classNames({ [style.hidden]: !isActive })}
        src={url ? completeUrl(url) : null}
        key={id}
        onLoad={handleLoad({ dispatch, id })}
        sandbox="allow-same-origin allow-forms allow-scripts"
      />
    ))}
  </div>
)

Frame.propTypes = {
  tabs: PropTypes.arrayOf(PropTypes.shape({
    id: PropTypes.string.isRequired,
    url: PropTypes.string,
    isActive: PropTypes.bool,
    isFailed: PropTypes.bool,
  })),
{'fraction_non_alphanumeric': 0.16731734523145567, 'fraction_numerical': 0.0, 'mean_word_length': 3.2411347517730498, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '218374', 'n_tokens_mistral': 541, 'n_tokens_neox': 548, 'n_words': 133}